Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp890822pxb; Fri, 15 Oct 2021 19:19:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwLz8Hmh/bYTwSmrtj6WZwzE89EJ9qgeUOBn9uH4KM9f48602nV/gdd7m3q1zsrspBlLu3u X-Received: by 2002:a63:ef58:: with SMTP id c24mr11639342pgk.299.1634350750173; Fri, 15 Oct 2021 19:19:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634350750; cv=none; d=google.com; s=arc-20160816; b=YRnCa/39fYaZXFgxMNseR0w59y26RFPYzpqXsAPb6mCWHgOcg8QQ3TO3dxb+dQFP6k Dkxo39BXjpUh5bkgD2FtVVCcv0MGhS4h8Eg4IFaPdjA/tWCJP/kMeBem2NmCevw35Z5Z eEyJcBO1m09WjSJOEGZuG3JyN/yi9LrL7Dh8huH87ienFrRGdf7sCp5C04RvN2iaUhTk qi5VTDof+6TbVqODEv2k0uUx6I36hA43fhbSecGEGILc7BvspzKBRYaA6Uiq+Paz5fNY 1r2brb0HRGHE8gdZHuqE1m4hgJSMARsyHD3Y7fab3kkNx+JUlSwqYjZ/TzU4PsSPUxmk 42FA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+ckwKjK9J35hJNTjIR74sLuZuyrabj98GW7w5+dfxbw=; b=dpBROJNsCGyZPLCzJDJYVVfw+zulpFBu3l8TxQYGWHNQIiRtYNyQrK7jEqLY7Le7DU ZQuuTTSXrMcRcWqo9dXj74c+AwJiDG1oUgOgAQtPYN870vbBF01GxgBnifoLynVOs9jc GQS1N0bBjGQP/h7O13LBUAuTMboSsbU92al3niV8kZmzX42x/ByBDeZ9RfEfzeZPRIQF goTlFmi3PgMk4qosA+1wVUou2hQzLqf04lwAYxvBbF5mCI8dj+a4kJQpk7FexGWNc6AA +kEHxskwwaVCe8eG8BYiIMDbiHCHISbyESp4980fwfbwPuMqwe8Qlu9Pn9QvuSZaj183 3luw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PTzaLMqD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l6si10440935pff.337.2021.10.15.19.18.28; Fri, 15 Oct 2021 19:19:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PTzaLMqD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239237AbhJOMxx (ORCPT + 99 others); Fri, 15 Oct 2021 08:53:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:53284 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239281AbhJOMxj (ORCPT ); Fri, 15 Oct 2021 08:53:39 -0400 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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