From patchwork Fri Oct 15 12:51:29 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: 12561451 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 1C2DFC433F5 for ; Fri, 15 Oct 2021 12:56:30 +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 D691760F56 for ; Fri, 15 Oct 2021 12:56:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D691760F56 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=f8e8QNDJjMojI0 ieN4kGUIBBOSY6VHjX26Ffk/ULNEvEwp6VwlUBNOtQi55WpiHvPYHK8hKj7iLEnqE3s7qrqJJLxpV CHEoBGZvtnOUbpm73izmPYTt1nce7Rg4urx+Vbmx1vp92tQfbWeQcsm9bsLYcYZBqhErP6Rv9s13D X++ItjGQiYrhFjKoF+ALqcu8K/pWAsXcbxcXcX0E6ZIq5Z6gJaU/HRiBHMUqtAWjmCo11LYZchntU fcZeqjTU10euDRYjfZgICincJAANwKCx9/HsmA/WPYTFzSustYa86IuM8QdckNj5HnHzIQWx2P5x2 ezwZf42zyFB/5ciSEACQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mbMji-0073Ew-Uu; Fri, 15 Oct 2021 12:54:59 +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 1mbMgO-0071HN-E3 for linux-arm-kernel@lists.infradead.org; Fri, 15 Oct 2021 12:51:35 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 863D161090; Fri, 15 Oct 2021 12:51:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634302292; bh=0rk2OE9N625FCZQR+v+3LZ8V9a5HPzPHQNru9UNWLCU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PTzaLMqDCU1dZD4zb8xwT3cob7cIYib7RNENvAMHhlqU1Avjl02iXp893Ar23k1kb 7HU/G+exNHot3r0UWLogKtbMsKwb6bTOGwMSIZJPq8+6UbU2ciemaAvkd1hCheFLQq NfBWlf2eIjLuAUlHP1rZ6muOPSlteyDFux7MvdeZnbUIo5G/d1t2ZEUeHaqgduMjd6 ugiYtiRCumJUlBlkNv8L8qZbH7K7xwewrBS9500K9QtcV7BmQVW8J0GTZRLyxqgdmg ZbvzyvLdC9ucAsqAmHnpZCw2OgvwiDqmcTaAnDxT0BxuE8RIJmOxYNIFd2aG8FPIMp cyWtlUbnOEMQw== 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 05/10] arm64: kprobes: Make a frame pointer on __kretprobe_trampoline Date: Fri, 15 Oct 2021 21:51:29 +0900 Message-Id: <163430228904.459050.16973178880543757481.stgit@devnote2> X-Mailer: git-send-email 2.25.1 In-Reply-To: <163430224341.459050.2369208860773018092.stgit@devnote2> References: <163430224341.459050.2369208860773018092.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-20211015_055132_533315_FF0B740A X-CRM114-Status: GOOD ( 11.79 ) 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