From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796099282; b=gnxYCXZj+TEl0h8Yk3nZ+rGJMkzeRGlZaxLYqZ7cdirDnk4dRQuDUmYG18x+ipC1evCB vZAkeIyoOSJlopw4K3X954FJ69dHgiNIRFik0DtynQ64Z3CqEaSLV3beirY/6mlyrqmNc 8FbJdKtDmS8kyBMys89IQ/PGEGTHmYKNPmKWaviYNyAm8+UM4YJKYw9Y5DYpMSX6RXuPy Ym9OTTePms2/AJCBhJEbIPRAvT5KDJy+9Q2Wbef9M3x8WQf65tUd+1NY8jA2ahMnZgYmW exzw21VjeXh+iV64swJDGazEDssgnaXJbw9/6oUGXhA4Lrh52aBU36GJuOBdi4X2vbA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796099282; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=dasx14zow8fTlua03EdSW1uWI4cYJlhPWAbHnG8oxSs=; b=U30cpQm2hNThGp7/laeJO2ambR0cXLnMXCLlVQx0pFcYVDj95sKvBae+ma+E21FyJOqG 0HeXtWpbmyLjbCaiVQI9RJU1HTZO4nlmOBzu6i6HROTHbMLPo839i1KU9Etdr7Lc70z3q JEeK6OfTYFxl2bRI+dggC6zGwAOeoQ7HwoVvMbtzxRoJ3eKI9C0uDBKeKP3d7+7xF9vz7 KWuGK7Mp47+JjHOyf5AXCrvIabklCHfopl8TMQaTUGM/5+6Mvv8XtZxMTxMYdtza1+Z2z wkyMOo0oMLUIQo6OR/3CnoeZJLK9VQPNQgZMgh66ZU/UMtFnTftvM/cqgSSyRpZhdxA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=GdETD80f; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F2A36606A31A; Tue, 1 Dec 2026 04:28:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=GdETD80f Received: by smtp.kernel.org (Postfix) with ESMTPSA id 599151F0089A; Tue, 1 Dec 2026 04:27:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796099281; bh=dasx14zow8fTlua03EdSW1uWI4cYJlhPWAbHnG8oxSs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=GdETD80fH51iR07FUcwy5SB1KIlQf0IhxIsLzcF+pOlDyfRU59J5IgDRsNKkJXHFc GPGrHNZkJpxVgEAs6ajjC9xSa9y/D4/dMUQ4He61U4DTtqgofjtQcxg3XOrCNttV+R o044VUNhp20FjZtrZILnMWNYK2SY0nbF4O1mVKULaKQerRLXfo9agXwI3zNluKlfWJ 5Wzir7iviUnSh8P9I0cJV3x15LhG8VCUxHobBbm6UGil98n/Tj/6VjxIk1DI0jABtz qaGGjA61rZEqBEehn3eDx+cooWkZOuuLeoL9TUrLX34nlEqoWqcyTnMPMFRt+m8N76 mxp7cpRjNihMw== From: Song Liu To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, live-patching@vger.kernel.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, bpf@vger.kernel.org Cc: rostedt@goodmis.org, mhiramat@kernel.org, mark.rutland@arm.com, peterz@infradead.org, tglx@kernel.org, frederic@kernel.org, paulmck@kernel.org, catalin.marinas@arm.com, will@kernel.org, maddy@linux.ibm.com, mpe@ellerman.id.au, npiggin@gmail.com, chleroy@kernel.org, pjw@kernel.org, palmer@dabbelt.com, aou@eecs.berkeley.edu, alex@ghiti.fr, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, ojeda@kernel.org, kernel-team@meta.com, Song Liu Subject: [PATCH v3 19/22] arm64: Mark the stack unwinder helpers notrace Date: Mon, 30 Nov 2026 20:21:58 -0800 Message-ID: <20261201042201.3199928-20-song@kernel.org> X-Mailer: git-send-email 2.53.1 In-Reply-To: <20261201042201.3199928-1-song@kernel.org> References: <20261201042201.3199928-1-song@kernel.org> X-Mailing-List: live-patching@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Commit 0fbcd8abf337 ("arm64: Prohibit instrumentation on arch_stack_walk()") made arch_stack_walk() noinstr, and made the inline functions it calls __always_inline, so that it cannot be instrumented: lockdep calls it through return_address(), and a kprobe on it crashed the kernel. The helpers in and , such as stackinfo_get_irq(), on_task_stack() and unwind_consume_stack(), are still plain inline functions. With clang, an arm64 defconfig build has out-of-line copies of several of them, called from arch_stack_walk(), arch_stack_walk_reliable() and arch_bpf_stack_walk(). The copies are untraced only because inline implies notrace. Mark these helpers notrace explicitly. No functional change. Assisted-by: Claude:claude-opus-5 Signed-off-by: Song Liu --- arch/arm64/include/asm/stacktrace.h | 16 ++++++++-------- arch/arm64/include/asm/stacktrace/common.h | 10 +++++----- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/arch/arm64/include/asm/stacktrace.h b/arch/arm64/include/asm/stacktrace.h index 6d3280932bf5..56d49234402d 100644 --- a/arch/arm64/include/asm/stacktrace.h +++ b/arch/arm64/include/asm/stacktrace.h @@ -22,7 +22,7 @@ extern void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk, DECLARE_PER_CPU(unsigned long *, irq_stack_ptr); -static inline struct stack_info stackinfo_get_irq(void) +static inline struct stack_info notrace stackinfo_get_irq(void) { unsigned long low = (unsigned long)raw_cpu_read(irq_stack_ptr); unsigned long high = low + IRQ_STACK_SIZE; @@ -33,13 +33,13 @@ static inline struct stack_info stackinfo_get_irq(void) }; } -static inline bool on_irq_stack(unsigned long sp, unsigned long size) +static inline bool notrace on_irq_stack(unsigned long sp, unsigned long size) { struct stack_info info = stackinfo_get_irq(); return stackinfo_on_stack(&info, sp, size); } -static inline struct stack_info stackinfo_get_task(const struct task_struct *tsk) +static inline struct stack_info notrace stackinfo_get_task(const struct task_struct *tsk) { unsigned long low = (unsigned long)task_stack_page(tsk); unsigned long high = low + THREAD_SIZE; @@ -50,7 +50,7 @@ static inline struct stack_info stackinfo_get_task(const struct task_struct *tsk }; } -static inline bool on_task_stack(const struct task_struct *tsk, +static inline bool notrace on_task_stack(const struct task_struct *tsk, unsigned long sp, unsigned long size) { struct stack_info info = stackinfo_get_task(tsk); @@ -61,7 +61,7 @@ static inline bool on_task_stack(const struct task_struct *tsk, DECLARE_PER_CPU(unsigned long [OVERFLOW_STACK_SIZE/sizeof(long)], overflow_stack); -static inline struct stack_info stackinfo_get_overflow(void) +static inline struct stack_info notrace stackinfo_get_overflow(void) { unsigned long low = (unsigned long)raw_cpu_ptr(overflow_stack); unsigned long high = low + OVERFLOW_STACK_SIZE; @@ -76,7 +76,7 @@ static inline struct stack_info stackinfo_get_overflow(void) DECLARE_PER_CPU(unsigned long *, sdei_stack_normal_ptr); DECLARE_PER_CPU(unsigned long *, sdei_stack_critical_ptr); -static inline struct stack_info stackinfo_get_sdei_normal(void) +static inline struct stack_info notrace stackinfo_get_sdei_normal(void) { unsigned long low = (unsigned long)raw_cpu_read(sdei_stack_normal_ptr); unsigned long high = low + SDEI_STACK_SIZE; @@ -87,7 +87,7 @@ static inline struct stack_info stackinfo_get_sdei_normal(void) }; } -static inline struct stack_info stackinfo_get_sdei_critical(void) +static inline struct stack_info notrace stackinfo_get_sdei_critical(void) { unsigned long low = (unsigned long)raw_cpu_read(sdei_stack_critical_ptr); unsigned long high = low + SDEI_STACK_SIZE; @@ -105,7 +105,7 @@ static inline struct stack_info stackinfo_get_sdei_critical(void) #ifdef CONFIG_EFI extern u64 *efi_rt_stack_top; -static inline struct stack_info stackinfo_get_efi(void) +static inline struct stack_info notrace stackinfo_get_efi(void) { unsigned long high = (u64)efi_rt_stack_top; unsigned long low = high - THREAD_SIZE; diff --git a/arch/arm64/include/asm/stacktrace/common.h b/arch/arm64/include/asm/stacktrace/common.h index 821a8fdd31af..d592e65db321 100644 --- a/arch/arm64/include/asm/stacktrace/common.h +++ b/arch/arm64/include/asm/stacktrace/common.h @@ -35,7 +35,7 @@ struct unwind_state { int nr_stacks; }; -static inline struct stack_info stackinfo_get_unknown(void) +static inline struct stack_info notrace stackinfo_get_unknown(void) { return (struct stack_info) { .low = 0, @@ -43,7 +43,7 @@ static inline struct stack_info stackinfo_get_unknown(void) }; } -static inline bool stackinfo_on_stack(const struct stack_info *info, +static inline bool notrace stackinfo_on_stack(const struct stack_info *info, unsigned long sp, unsigned long size) { if (!info->low) @@ -55,7 +55,7 @@ static inline bool stackinfo_on_stack(const struct stack_info *info, return true; } -static inline void unwind_init_common(struct unwind_state *state) +static inline void notrace unwind_init_common(struct unwind_state *state) { state->stack = stackinfo_get_unknown(); } @@ -99,7 +99,7 @@ static struct stack_info *unwind_find_stack(struct unwind_state *state, * * Return: 0 upon success, an error code otherwise. */ -static inline void unwind_consume_stack(struct unwind_state *state, +static inline void notrace unwind_consume_stack(struct unwind_state *state, struct stack_info *info, unsigned long sp, unsigned long size) @@ -142,7 +142,7 @@ static inline void unwind_consume_stack(struct unwind_state *state, * * Return: 0 upon success, an error code otherwise. */ -static inline int +static inline int notrace unwind_next_frame_record(struct unwind_state *state) { struct stack_info *info; -- 2.53.1-Meta