From patchwork Thu Oct 21 00:55:00 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: 12573583 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 53CBBC433F5 for ; Thu, 21 Oct 2021 00:57: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 14DD460F02 for ; Thu, 21 Oct 2021 00:57:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 14DD460F02 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=hj8pcxbL6q1Ra/ojlsbu6a4FHIMvmsks9QS9qiSLMwo=; b=BfOo6CpMCJPWjR RwitW0Eqm+tNtJBtvYOtHv+gZEWo9FyGlSL6Q4cIeCdo5j9iPnJYqIGHHle5TsVoT82aUZNhwBvWK YT+won2ds2NpuEu2+78LKdJOeB9+NIrxz1V/q7+af8X+aVBer57hTLBVZWbSQ16V9Wka7ZHKSib4P GA7ueMNoyKcQ0GydxHlQqZHYirFaXDIiCsjD7KIT9K+RIz0l8mp4o61jD/gVyxKi4yHApcY1YzFJ2 Hew5/wVQUDg/DuGq1n0akl+lHtB1T/7OBra4xahG6T4OiEBr4mN/FH8G82QKesLmu46exKa1m4rUS EGUDGtfg9L4QOO50LM6A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdMMn-00680E-Nz; Thu, 21 Oct 2021 00:55:34 +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 1mdMMK-0067kb-Fh for linux-arm-kernel@lists.infradead.org; Thu, 21 Oct 2021 00:55:05 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 581D46109F; Thu, 21 Oct 2021 00:55:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634777704; bh=0rk2OE9N625FCZQR+v+3LZ8V9a5HPzPHQNru9UNWLCU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P91/QN5A7bqy0csO+1nkNuw+VXcDNxEz3rYnHPaxbhJQMAGRPHEAVPhZ9q+U9v/aM gT+vR28bzZzU6wnBhQJkMasi3k4W8NDfwC9E4No68uK1iA6aV/ccgMsBj650Sw0zUO LQJ3kUbALQqy/ZVJKauGULqJvz/eGicPEZZIj60DYbzAAyHA+D5OuX7wBxL0Ef6z6z jkLsI7QZt1yRTeflWf9MW4b4Q99T3CaZfyZcWc5GqKz8WLaK9lWXIYQ1kptuFVGZ/C 8pYdCxx1QLT5ENo3vxf0Ano+42ZzOTEwIurspX/H6wPmGD6908XXcsQmJMU/yrD0fJ 7upT3TSOpYtJA== 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 v3 5/9] arm64: kprobes: Make a frame pointer on __kretprobe_trampoline Date: Thu, 21 Oct 2021 09:55:00 +0900 Message-Id: <163477770064.264901.14799557129514500033.stgit@devnote2> X-Mailer: git-send-email 2.25.1 In-Reply-To: <163477765570.264901.3851692300287671122.stgit@devnote2> References: <163477765570.264901.3851692300287671122.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-20211020_175504_575528_5A0B32B9 X-CRM114-Status: GOOD ( 11.82 ) 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 Make a frame pointer (make the x29 register points the address of pt_regs->regs[29]) on __kretprobe_trampoline. This frame pointer will be used by the stacktracer when it is called from the kretprobe handlers. In this case, the stack tracer will unwind stack to trampoline_probe_handler() and find the next frame pointer in the stack frame of the __kretprobe_trampoline(). Signed-off-by: Masami Hiramatsu Acked-by: Will Deacon --- arch/arm64/kernel/probes/kprobes_trampoline.S | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm64/kernel/probes/kprobes_trampoline.S b/arch/arm64/kernel/probes/kprobes_trampoline.S index 520ee8711db1..9a6499bed58b 100644 --- a/arch/arm64/kernel/probes/kprobes_trampoline.S +++ b/arch/arm64/kernel/probes/kprobes_trampoline.S @@ -66,6 +66,9 @@ SYM_CODE_START(__kretprobe_trampoline) save_all_base_regs + /* Setup a frame pointer. */ + add x29, sp, #S_FP + mov x0, sp bl trampoline_probe_handler /* @@ -74,6 +77,7 @@ SYM_CODE_START(__kretprobe_trampoline) */ mov lr, x0 + /* The frame pointer (x29) is restored with other registers. */ restore_all_base_regs add sp, sp, #PT_REGS_SIZE