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=1796100830; b=ladQqDQpH6l03zXuLAE9YhWpaBtu0nhaBxlBiCpPCBJvHl5ZVP2xYoAnlsIi2sMV3DC/ lFTg7G8ipPMB6zmcortzafWRJuOrukZAcGXUKc9nsM5UryXHJiC8SDKzlxYYExMoo85lv U7oA/VtXUKcmpW3VBLFYKs1+dq0Oxu0zfISS8Tpz2HY1FpXYPrEeEg0ELg/uaZdWE8NS+ /BGOoTZItMFs6ShqO6N6Ue+e2G88REe1J7MrU9/Mbm07cVGB347iWhmh7k3t+TL2wCD8I iGA1XmO5hcalXlEKgeq97qUbWKjpm1foB/lmCypxerWQVEXkTuVurKJsG6JXXad5v4g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796100830; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=3tZ7cSXkiI6UAbUJ2qAWtkKZXUPmPHXsfRr+sQl+oXw=; b=SWQ3xj5lDMDE7nkcEEsoHE4R3beSh6KsIJPzbnvKBuw7Lo2xYeCrkWB4m/GQuOGZEoLD BKrFb4xuA5IWn6biH7SM6hKKkui0F3yhjsO5DqgV12cBBS8Nf3y6KzApJF5WGwTN+b/K4 RCZcaXu39Dx/QbrasZtN8/pIKG6OfiFs4zmdKhaCBMy2SuI/iK9/KAwpMr5TqByKPkPU9 WXVmZ77DIv91p3jKtu/TWZSz2fbUw4td+p7qRKRLY7xjeFSzbgUdl4UmLTP8QvtEZXpnu uwnp3eWnxBE7cloYBMdCGiG9dO1W75EdPw7qTQWeT3A6zqlYz6OHJbso+/nu91Uu5uQ== 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=XD78Qt9o; 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 AE668606A31A; Tue, 1 Dec 2026 04:53:50 +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=XD78Qt9o Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26C681F00897; Tue, 1 Dec 2026 04:53:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796100830; bh=3tZ7cSXkiI6UAbUJ2qAWtkKZXUPmPHXsfRr+sQl+oXw=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=XD78Qt9oGyWTBby0f9WZB9lghEy8VTDcZInEtV6J/Sw8cU7bh9FtylD2sA0ELrPPM cJb7a9CDqxc2/sl6oTIQgCqLd4fingPAEW4H0oy9ziOOxYej1SOVFzqW7NtHqdToFe ALxFuEAEP74fopvmJZHppwezgd/o+x/HD/T5G5RbQiZdRUt8kqx/Zdv53A13fOG2H9 CUEbzlDfkneYZYCUcXryac8NfcLXvmxA7nLC8W3u/VZ5TTEp77ZVFb6xrZt3HOI9qt 6CcPmofcYHnP/q73GsrckZMGmDT7OlFGB8beOkEUTQjMKLQG6kJ1lZaGsCNhb8Wnb/ YnE5scEgAEYig== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v3 18/22] arm64: Mark helpers called from noinstr code notrace 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-19-song@kernel.org> References: <20261201042201.3199928-1-song@kernel.org> <20261201042201.3199928-19-song@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 01 Dec 2026 04:53:48 +0000 X-Mailing-List: live-patching@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 2 potential issues to consider: - [Medium] arm64: noinstr helpers use static inline notrace instead of __always_inline - [Medium] arm64: missing notrace/__always_inline on is_pkvm_initialized() and gic_read_pmr() -- commit 58c12e9a90cffb79899ef34a6a22fce486bc0793 Author: Song Liu arm64: Mark helpers called from noinstr code notrace This commit marks several arm64 inline helpers called from noinstr and cpuidle paths as notrace so out-of-line copies emitted by Clang are not traced by ftrace. > diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm= /cpufeature.h > index 7d7b8eb7f72fb..e1602d5de94f2 100644 > --- a/arch/arm64/include/asm/cpufeature.h > +++ b/arch/arm64/include/asm/cpufeature.h > @@ -774,7 +774,7 @@ static __always_inline bool system_supports_fpsimd(vo= id) > return alternative_has_cap_likely(ARM64_HAS_FPSIMD); > } > =20 > -static inline bool system_uses_hw_pan(void) > +static inline bool notrace system_uses_hw_pan(void) > { > return alternative_has_cap_unlikely(ARM64_HAS_PAN); > } > @@ -955,7 +955,7 @@ static inline bool cpu_has_hw_af(void) > ID_AA64MMFR1_EL1_HAFDBS_SHIFT); > } > =20 > -static inline bool cpu_has_pan(void) > +static inline bool notrace cpu_has_pan(void) > { > u64 mmfr1 =3D read_cpuid(ID_AA64MMFR1_EL1); > return cpuid_feature_extract_unsigned_field(mmfr1, > diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/mem= ory.h > index a2b7a33966ff1..e9a89fb32d505 100644 > --- a/arch/arm64/include/asm/memory.h > +++ b/arch/arm64/include/asm/memory.h > @@ -223,7 +223,7 @@ > #include > #include > =20 > -static inline u64 __pure read_tcr(void) > +static inline u64 __pure notrace read_tcr(void) > { > u64 tcr; > =20 > diff --git a/arch/arm64/include/asm/mmu.h b/arch/arm64/include/asm/mmu.h > index 5e1211c540ab2..0889a37c42997 100644 > --- a/arch/arm64/include/asm/mmu.h > +++ b/arch/arm64/include/asm/mmu.h > @@ -55,7 +55,7 @@ typedef struct { > */ > #define ASID(mm) (atomic64_read(&(mm)->context.id) & 0xffff) > =20 > -static inline bool arm64_kernel_unmapped_at_el0(void) > +static inline bool notrace arm64_kernel_unmapped_at_el0(void) > { > return alternative_has_cap_unlikely(ARM64_UNMAP_KERNEL_AT_EL0); > } > diff --git a/arch/arm64/include/asm/percpu.h b/arch/arm64/include/asm/per= cpu.h > index 3cc316091d665..0cb3a02b1f5f2 100644 > --- a/arch/arm64/include/asm/percpu.h > +++ b/arch/arm64/include/asm/percpu.h > @@ -37,7 +37,7 @@ static inline unsigned long __hyp_my_cpu_offset(void) > "mrs " dst ", tpidr_el2", \ > ARM64_HAS_VIRT_HOST_EXTN) > =20 > -static inline unsigned long __kern_my_cpu_offset(void) > +static inline unsigned long notrace __kern_my_cpu_offset(void) > { > unsigned long off; > =20 > diff --git a/arch/arm64/include/asm/ptrace.h b/arch/arm64/include/asm/ptr= ace.h > index ad0ad30b36cda..5927ccfdf6b54 100644 > --- a/arch/arm64/include/asm/ptrace.h > +++ b/arch/arm64/include/asm/ptrace.h > @@ -360,7 +360,7 @@ static inline unsigned long regs_get_kernel_argument(= struct pt_regs *regs, > struct task_struct; > int valid_user_regs(struct user_pt_regs *regs, struct task_struct *task); > =20 > -static inline unsigned long instruction_pointer(struct pt_regs *regs) > +static inline unsigned long notrace instruction_pointer(struct pt_regs *= regs) > { > return regs->pc; > } > diff --git a/arch/arm64/include/asm/vdso/processor.h b/arch/arm64/include= /asm/vdso/processor.h > index 7abb0cc81cd6e..4b246882d41cb 100644 > --- a/arch/arm64/include/asm/vdso/processor.h > +++ b/arch/arm64/include/asm/vdso/processor.h > @@ -7,7 +7,7 @@ > =20 > #ifndef __ASSEMBLER__ > =20 > -static inline void cpu_relax(void) > +static inline void notrace cpu_relax(void) > { > asm volatile("yield" ::: "memory"); > } > diff --git a/arch/arm64/include/asm/virt.h b/arch/arm64/include/asm/virt.h > index a5bde8cc5df51..6b5e557b8ba2e 100644 > --- a/arch/arm64/include/asm/virt.h > +++ b/arch/arm64/include/asm/virt.h > @@ -104,7 +104,7 @@ static inline bool pkvm_force_reclaim_guest_page(phys= _addr_t phys) > #endif > =20 > /* Reports the availability of HYP mode */ > -static inline bool is_hyp_mode_available(void) > +static inline bool notrace is_hyp_mode_available(void) > { > /* > * If KVM protected mode is initialized, all CPUs must have been booted [Severity: Medium] Should these eight helpers be marked static __always_inline instead of static inline notrace? Because noinstr and __cpuidle expand to include __no_profile, Clang refuses to inline a plain inline callee that lacks __no_profile into a noinstr or __cpuidle caller, emitting out-of-line copies in regular .text. Even with notrace, those out-of-line copies sit outside .noinstr.text and .cpuidle.text and lack __no_kcsan, __no_sanitize_address, __no_sanitize_coverage and __no_sanitize_memory: - They are not covered by the .noinstr.text kprobe blacklist, so placing a kprobe on system_uses_hw_pan(), cpu_has_pan(), arm64_kernel_unmapped_at_el0() or __kern_my_cpu_offset() called from __sdei_handler() before exception registers are saved and before vbar_el1 is switched off the KPTI trampoline vectors clobbers live exception registers or traps into the unpopulated current-EL KPTI vectors. - In translation units that do not disable sanitizers or coverage in the Makefile (such as kvm_patch_ich_vtr_el2() calling is_hyp_mode_available(), or el0_pc() calling instruction_pointer()), the out-of-line copies remain subject to KCOV, KASAN and KCSAN while RCU is not watching. - cpu_relax() called from __cpuidle cpu_idle_poll() executes in .text outside __cpuidle_text_start..__cpuidle_text_end, causing cpu_in_idle() to return false. [Severity: Medium] Should is_pkvm_initialized() and gic_read_pmr() also be marked __always_inline (or notrace)? is_hyp_mode_available() calls is_pkvm_initialized() unconditionally when invoked from noinstr kvm_patch_ich_vtr_el2(), and __cpuidle cpu_do_idle() calls gic_read_pmr() via arm_cpuidle_save_irq_context() while RCU is not watching when CONFIG_ARM64_PSEUDO_NMI=3Dy: arch/arm64/include/asm/arch_gicv3.h: static inline u32 gic_read_pmr(void) { return read_sysreg_s(SYS_ICC_PMR_EL1); } static __always_inline void gic_write_pmr(u32 val) Once commit "compiler_types: Move notrace from inline to __always_inline" removes notrace from plain inline, Clang emits an out-of-line traceable copy of gic_read_pmr() from __cpuidle cpu_do_idle() (and of is_pkvm_initialized() if is_hyp_mode_available() is inlined into kvm_patch_ich_vtr_el2()), allowing ftrace to trace them while RCU is not watching. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261201042201.3199= 928-1-song@kernel.org?part=3D18