Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp118697pxb; Wed, 20 Oct 2021 17:58:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJznPK9q5tyRyGVvi/kJIUq/qnxOInTgIX0sVVZLM7u2pum1ADDXw6QwxRZe0la1WSyUhZjJ X-Received: by 2002:a05:6402:3512:: with SMTP id b18mr3153535edd.15.1634777916790; Wed, 20 Oct 2021 17:58:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634777916; cv=none; d=google.com; s=arc-20160816; b=PMQCQYduF9E06PGPsFb2EnypFcoPb+xVM8HyjV/AHIF7kLkBO4Mtj18nmjbGyaQaXY P3f6AszSmtLvYuLc/J7uApSCZ68EOKdOfZo6KFQ1IqcIMtB4KgT6fwrwv2eX7c7TLKf0 X3MkSOBwsJo9EtrcRl+5T9VpmQVlAStOiH3+YcsDwWhiAvQsuPB+UleNGFz5CY59cN3L IZTJ0QgfLaKdCIIVHeiQsyG06r6+G/bEWPvg0SQqXtye3drG0OnaGLYFn4DyIsz79kvm iTDiNP2IWxJRqBZJMuIAKrXsJPdd2MzNHz76kZ1IrEj6ZRaZ+Z0zmL79p/GipgGSABc6 mtmQ== 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=n/rqfEdzdtaQC14ahew3sqHmuSzreEijqr57qtHrMyz3f5+TgmezHVgK8hhOIAn4PC LWsasi/8lgbrK4uR3kuHv+pHHvsN+aHMCysRBjQNOEkL3BLTXGrN8mdmBokBi0uulw0P u30IAo37EX4YhRYaCg49cgNCrIfrEFqXlk05uht2ibxWL2Nk4yWa2qirlxvFz1560M0W hpJsTUTXndnOdf6b8RPkjxIMahEBrg4Q/ioMtXn8RgxpkTfR1aPOb/7yUERh1/qhfb0p oitoTw3meUIk6D+pBzLfsR6UK7tH+RzozAPBoczB+rCHZVQaW4OKssEFH6mRxyVppc5J ffRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="P91/QN5A"; 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 d22si5403220ejj.387.2021.10.20.17.58.13; Wed, 20 Oct 2021 17:58:36 -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="P91/QN5A"; 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 S231472AbhJUA5V (ORCPT + 99 others); Wed, 20 Oct 2021 20:57:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:51544 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231444AbhJUA5T (ORCPT ); Wed, 20 Oct 2021 20:57:19 -0400 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 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