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=1796102260; b=IJJ+6uqPJbPWZvwmDFz2u3NMV45L/jmxdOthpRR+QfDc6GZ8Nt/rKI7cNlm9OIs8cNnt 3dmJAxcsxg88vLm3Li9jq+kYMzp3vjlgS7NsJBGSp1XWom+3DvB3B0WC17zYyee2Uh7qj FYsFtsie3+eoscp5dcMspeZlYJ58puVvXeT28FXD2mbT5bCCIvpSzxTza7kLdymDW5VlT PIdtv8uSFcM6huMdkx0U56rgJ9FMt7VO+Gy4y1Ghqfslb6HxAlW1GPOLe19YZW1lHCNNs 3zFGAVRImhYJHAeWVV0QvMaxpgeuKMHLGH9xAecR5pwMalia9B2eKjsW/rsgvnoJpfA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796102260; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=NPL+8yqLPGWDoTwXkvXfNNyVXQSzzoWUG/6kISBKGUs=; b=ZI1rICuHKo5ERUWm3erVfQmpmlsrmzwDp/qxH1YYA+nR7ZA33D5GpwTF4RgahCkAtpjC +jVVFylxG9kirM3Jz81diUt0P22nVd3oe2gkLZUEtWkBRh7GzbeB/d4QkFH3E5b0HAA8M YlsXnkfCqCKDfznzvMvJ6VXYIM8ijVUGbJrk6jcslr776KaS0qHcz1TWsziWqJPZWWMLB 8fzWrqgCNE4/OoBve4fNDiK3iMh464lExNmvkDgfKJgmYDdAFjkX6It2C2eix0DiQZ7QR k6zu79+Zka5OJ4KhaS1oQximCEVpNnT5LCCfcWP5i7r3MSpz5vjWZ4OuYkmstVz+0PA== 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=HRegl0LD; 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 48D14606A31A; Tue, 1 Dec 2026 05:17:40 +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=HRegl0LD Received: by smtp.kernel.org (Postfix) with ESMTPSA id B11341F000C1; Tue, 1 Dec 2026 05:17:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796102259; bh=NPL+8yqLPGWDoTwXkvXfNNyVXQSzzoWUG/6kISBKGUs=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=HRegl0LDaq7fVS0Sx5df6i5QM3gnr/sH85tQlijIBMkNCe19xHvwUNkJt676oK0Os GckxJwGcpFDQpbW3rjXV0mpmIM21JL8dOsODmM3hsCWt2Jg7PjDA8VgEKs+3SlyK4o cCAOX4vbDHUnuInDpAySCXP9fOuh38j1htj58ZuCfQ14S+8QS/BA41ToK3nv0ftDAR hTf8Rv5fty+5JabO3jliQ/yFKgIbsT5L+9u60fiyi5zUAgPQUPHDO6Rtp6AI0SYxCj PyghZXl8aI1bQneXl73C31RlHOyZF2bySqPn7LWI6llDrpHKQIkLAEVYF4oqWUvuzx c1+Z695V/K0Vg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v3 22/22] compiler_types: Move notrace from inline to __always_inline Reply-To: sashiko-reviews@lists.linux.dev To: "Song Liu" , linux-trace-kernel@vger.kernel.org, live-patching@vger.kernel.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 In-Reply-To: <20261201042201.3199928-23-song@kernel.org> References: <20261201042201.3199928-1-song@kernel.org> <20261201042201.3199928-23-song@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 01 Dec 2026 05:17:38 +0000 X-Mailing-List: bpf@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 5 potential issues to consider: - [High] compiler_attributes: undefined notrace in __always_inline breaks powerpc build - [Medium] microblaze: missing notrace on current_thread_info() after inline change - [Medium] compiler_types: missing notrace on powerpc/loongarch local_t and seqlock helpers - [Medium] srcu: tiny SRCU helpers called by notrace paths lack notrace after inline change - [Medium] context_tracking: missing notrace on !CONFIG_CONTEXT_TRACKING_USER stubs -- commit 5cd366f4e5c4bf3ecfbc5c1521c4971b8756f081 Author: Song Liu compiler_types: Move notrace from inline to __always_inline This commit removes notrace from the inline macro in include/linux/compiler_types.h and adds it to __always_inline in include/linux/compiler_attributes.h so that out-of-line copies of plain inline functions can be traced and livepatched. > diff --git a/include/linux/compiler_attributes.h b/include/linux/compiler= _attributes.h > index 476c4c560d174..5fdc07b3e380d 100644 > --- a/include/linux/compiler_attributes.h > +++ b/include/linux/compiler_attributes.h > @@ -49,10 +49,14 @@ > * to its docs (and also "warning: always_inline function might not be > * inlinable [-Wattributes]" is emitted). > * > + * The compiler still emits an out-of-line copy of an __always_inline fu= nction > + * when its address is taken or when it has external linkage. These func= tions > + * are often used by code that must not be traced, so mark them notrace. > + * > * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.= html#index-always_005finline-function-attribute > * clang: mentioned > */ > -#define __always_inline inline __attribute__((__always_i= nline__)) > +#define __always_inline inline __attribute__((__always_i= nline__)) notrace [Severity: High] Does adding notrace to __always_inline in compiler_attributes.h break translation units that include compiler_attributes.h without compiler_types.h? notrace is only defined in include/linux/compiler_types.h under __KERNEL__. In arch/powerpc/boot/Makefile, the pre-boot wrapper is built with -include include/linux/compiler_attributes.h and without compiler_types.h or -D__KERNEL__. When CONFIG_KERNEL_XZ=3Dy, arch/powerpc/boot/decompress.c includes lib/decompress_unxz.c and lib/xz/xz_dec_lzma2.c, where static __always_inline helpers such as rc_normalize() expand with an undeclared notrace token and fail to compile. > diff --git a/include/linux/compiler_types.h b/include/linux/compiler_type= s.h > index c5921f1390079..ea7f2a928b4da 100644 > --- a/include/linux/compiler_types.h > +++ b/include/linux/compiler_types.h > @@ -230,9 +230,8 @@ struct ftrace_likely_data { > * externally visible function. This makes extern inline behave as per g= nu89 > * semantics rather than c99. This prevents multiple symbol definition e= rrors > * of extern inline functions at link time. > - * A lot of inline functions can cause havoc with function tracing. > */ > -#define inline inline __gnu_inline __inline_maybe_unused notrace > +#define inline inline __gnu_inline __inline_maybe_unused [Severity: Medium] Can removing notrace from inline cause infinite ftrace recursion via current_thread_info() on MicroBlaze? MicroBlaze selects HAVE_FUNCTION_TRACER and uses generic preempt_count() and preempt_count_ptr() from include/asm-generic/preempt.h, which both call current_thread_info(). In include/linux/trace_recursion.h, trace_test_and_set_recursion() calls trace_get_context_bit() -> interrupt_context_level() -> preempt_count() before setting current->trace_recursion. Because current_thread_info() in arch/microblaze/include/asm/thread_info.h is a plain static inline function without notrace or __always_inline, any out-of-line copy emitted by the compiler will be instrumented by ftrace and recurse indefinitely. [Severity: Medium] Does dropping notrace from inline leave the PowerPC and LoongArch local_t helpers and the 32-bit seqlock helpers traceable from notrace BPF paths? The notrace BPF trampoline helpers (__bpf_prog_enter_recur() -> bpf_prog_inc_misses_counter() and __bpf_prog_exit_recur() -> __update_prog_stats()) and bpf_mem_alloc helpers (unit_alloc(), unit_free(), unit_free_rcu()) call local_inc(), local_dec(), local_add(), local_inc_return() and __u64_stats_update_begin() / __u64_stats_update_end(). Both 64-bit PowerPC and LoongArch implement BPF trampolines, but local_add(), local_add_return() and local_sub_return() in arch/powerpc/include/asm/local.h, local_add_return() in arch/loongarch/include/asm/local.h, and arch_atomic64_add() / arch_atomic64_sub() in arch/loongarch/include/asm/atomic-amo.h remain plain static inline functions without notrace. On 32-bit builds, __u64_stats_update_begin() and __u64_stats_update_end() also call write_seqcount_begin() and write_seqcount_end(), whose underlying helpers in include/linux/seqlock.h (such as do_raw_write_seqcount_begin()) are plain static inline. If the compiler emits an out-of-line copy of any of these helpers, attaching a BPF fentry/fexit program to it can trigger infinite trampoline recursion or re-enter bpf_mem_alloc around c->active updates. [Severity: Medium] Should __srcu_read_lock(), __srcu_ptr_to_ctr() and __srcu_ctr_to_ptr() in include/linux/srcutiny.h also be marked notrace? With CONFIG_TINY_SRCU=3Dy, the notrace helpers __srcu_read_lock_fast(), __srcu_read_unlock_fast() and srcu_read_lock_notrace() call those three functions directly: include/linux/srcutiny.h:__srcu_read_lock_fast() { return __srcu_ctr_to_ptr(ssp, __srcu_read_lock(ssp)); } Because __srcu_read_lock(), __srcu_ptr_to_ctr() and __srcu_ctr_to_ptr() are still plain static inline without notrace, any out-of-line copy emitted by the compiler will be instrumented by ftrace when called from tracepoints or other notrace SRCU paths. [Severity: Medium] Can the !CONFIG_CONTEXT_TRACKING_USER stubs in include/linux/context_tracking.h be traced when inline loses notrace? When CONFIG_CONTEXT_TRACKING_USER is disabled, user_enter_irqoff(), user_exit_irqoff(), exception_enter() and exception_exit() in include/linux/context_tracking.h are defined as plain static inline functions without __always_inline or notrace: include/linux/context_tracking.h: static inline void user_enter_irqoff(void) { } static inline void user_exit_irqoff(void) { } static inline int exception_enter(void) { return 0; } static inline void exception_exit(enum ctx_state prev_ctx) { } user_exit_irqoff() and user_enter_irqoff() are called from noinstr entry and exit paths (enter_from_user_mode() and exit_to_user_mode() in include/linux/irq-entry-common.h) and from notrace exit paths in arch/powerpc/kernel/interrupt.c, while exception_enter() and exception_exit() are called from preempt_schedule_notrace() in kernel/sched/core.c. If the compiler emits an out-of-line copy of these stubs, it will be instrumented by ftrace and cause noinstr violations or trace within non-traceable entry and preemption paths. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261201042201.3199= 928-1-song@kernel.org?part=3D22