From patchwork Fri Oct 8 12:28:49 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: 12545247 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 636F5C433F5 for ; Fri, 8 Oct 2021 12:35:27 +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 3247660F93 for ; Fri, 8 Oct 2021 12:35:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3247660F93 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=Q6BzsCjyyi4HsXXo0hpGAA6ig1+/6SV/LpjA+wzRw1I=; b=MuM3pAqjUEO4ps +HNQ42DcjOsVcvp/PyROzxnQcH8Zf22G3OcgXU2cXYjqsdlX8KXlW6f4hrr/KVD2qHzwR9ZOdgyEA guqfXxgIaEWG2GuU88tOPXPsAjep8PHrxMdl+3jj2iIMPRUAJCTUvcGbqcf04SoVjPcKxC6UypSPL UV+neegP3mdM/sg7LnmruSHR+1FlC9zaj9ovnMhm8h81FW2YvxOk9s+djWoJJUEppnPllW3EKTpqH RnhD4fy7DYZuZP2jfnB/Vavsz5j0Dc1CY69IusqYnhNnDjsoDNGuQl1iFIOGzZvZuvsF6nuOzI9AB 3QRZfTxvMR62KQ2LsvuQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mYp3u-002jdE-Rx; Fri, 08 Oct 2021 12:33:19 +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 1mYozd-002i5n-HR for linux-arm-kernel@lists.infradead.org; Fri, 08 Oct 2021 12:28:54 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6A36360FC2; Fri, 8 Oct 2021 12:28:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1633696133; bh=DDWSnIkSXXxhQSQVm1lvRkcHmdLh5M6ojrT3AbCWFpQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IS/u79LiqdIkNAN7MNKV0e/+ErXFmTq71qnLSzWDZoREx+dUFZoPTQYY0nxfmRuYQ yUUETSZs40NozRwPVpyzHMN1Aapbx9rv2Qo8e58ksM1KMRfixQ87w1ZaWCXCcUPtrD t4AUoVZMkUtiB/WwA5pgxKmf9lUPB6lcaDeUJH20GnSKeX5FvKE2eouWBTMN3xAuDM owncWUN/FSmJNBbFA0/rQEjoKU4oZapEXN+KL/J4P4n9iKNtn8E/JNad4mrpm5VvOv ISXvIiCT4aoPiJyS9rfhiXPXqG0zhDQVKG9B3RFL6QmvMV7ANAkPvSS5EvDbSzCWtA tpRa+x0ijMUaw== 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 4/8] arm64: kprobes: Make a frame pointer on __kretprobe_trampoline Date: Fri, 8 Oct 2021 21:28:49 +0900 Message-Id: <163369612899.636038.6691283708565501775.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_052853_632165_B5AD2570 X-CRM114-Status: GOOD ( 11.77 ) 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