From patchwork Fri Oct 8 12:28:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Masami Hiramatsu (Google)" X-Patchwork-Id: 12545245 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4FF9C433EF for ; Fri, 8 Oct 2021 12:34:07 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8185260F93 for ; Fri, 8 Oct 2021 12:34:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8185260F93 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=QGRvn1xXeOUVcUunFYxzs1Q/W5EIXoWVykKpXVfpC34=; b=L4C5H8V998/EQ3 xPXSpvwnpwjfqyGLrPAIUjRMwksxKwACyOezqUVwV3/oXdZP3MB1ZRLhRfNGHRUIqJ7wkazJDJ28a YPuEbcm02MPvZOvOkmlprWgo3S6Yv80fP1e1IhvTRiWxpGcGchGBpYEuJ4hm6tCl8Ym6zQij3i3ih SUNyH4bK9cKyDJr7MWw7oISRtxp5pZZPVylCsk2qB5S47BeUAyAkVfuZ27UQ+KCDvEwodCOb9yOBO X6XMFbzjP9zcbDeELpwwHBROXBENXYq3Rz8FfkGAS3dMpMXPbZJMneoNVNtbbBmEZhG6f4fTJaCt6 WcnjAbCleBuXKIq82Xtg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mYp2p-002jFL-Uk; Fri, 08 Oct 2021 12:32:12 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mYozU-002i20-3m for linux-arm-kernel@lists.infradead.org; Fri, 08 Oct 2021 12:28:45 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7DE7E60F48; Fri, 8 Oct 2021 12:28:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1633696123; bh=GWqObyYz57gQD0h5e1G31uUpDZjmjLaxrlrmxBydL5k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r1NqNFoLXvsH3EDKidrpCSxq+y6IvMcALoGwjQcO0Irk+S5LKgAAZzTIROTAtgKqO DK7RI+b4X2rBUsNUFUbX28wn3ajC2YqPUpL1EPCTrQ2+6jtuKdg8lkv3AYBKs+e/Di dHwHhEaUUtdkwGj6MgggEewrNAn6s3wbBAEKkb2xPzRuEKlLX/T/bNi/2v+e4ru0/t P5p1WZuZ7CPBDh+RPkRRnCyHLT52L17svMK1yQxLL1oXOas7VH33EEXOn9T1TGOi0E GB7VzPKBnQFm4Hwiz0OvJ4FcbpAkktNKRO0g/vweonAByLYBnbxTfcUUPZR/S/N8Il m3YKzlYYGbQCA== From: Masami Hiramatsu To: Steven Rostedt Cc: "Naveen N . Rao" , Ananth N Mavinakayanahalli , Ingo Molnar , linux-kernel@vger.kernel.org, mhiramat@kernel.org, Sven Schnelle , Catalin Marinas , Will Deacon , Russell King , Nathan Chancellor , Nick Desaulniers , linux-arm-kernel@lists.infradead.org Subject: [PATCH 3/8] arm64: kprobes: Record frame pointer with kretprobe instance Date: Fri, 8 Oct 2021 21:28:39 +0900 Message-Id: <163369611948.636038.11552166777773804729.stgit@devnote2> X-Mailer: git-send-email 2.25.1 In-Reply-To: <163369609308.636038.15295764725220907794.stgit@devnote2> References: <163369609308.636038.15295764725220907794.stgit@devnote2> User-Agent: StGit/0.19 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211008_052844_212158_7B4C051F X-CRM114-Status: GOOD ( 11.49 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Record the frame pointer instead of stack address with kretprobe instance as the identifier on the instance list. Since arm64 always enable CONFIG_FRAME_POINTER, we can use the actual frame pointer (x29). Signed-off-by: Masami Hiramatsu Acked-by: Will Deacon Acked-by: Mark Rutland --- arch/arm64/kernel/probes/kprobes.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kernel/probes/kprobes.c b/arch/arm64/kernel/probes/kprobes.c index e7ad6da980e8..d9dfa82c1f18 100644 --- a/arch/arm64/kernel/probes/kprobes.c +++ b/arch/arm64/kernel/probes/kprobes.c @@ -401,14 +401,14 @@ int __init arch_populate_kprobe_blacklist(void) void __kprobes __used *trampoline_probe_handler(struct pt_regs *regs) { - return (void *)kretprobe_trampoline_handler(regs, (void *)kernel_stack_pointer(regs)); + return (void *)kretprobe_trampoline_handler(regs, (void *)regs->regs[29]); } void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri, struct pt_regs *regs) { ri->ret_addr = (kprobe_opcode_t *)regs->regs[30]; - ri->fp = (void *)kernel_stack_pointer(regs); + ri->fp = (void *)regs->regs[29]; /* replace return addr (x30) with trampoline */ regs->regs[30] = (long)&__kretprobe_trampoline;