[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <66e54eb9-58b3-4559-af32-66a77fe1ea01@kernel.org>
Date: Wed, 9 Apr 2025 13:07:11 +0200
From: Jiri Slaby <jirislaby@...nel.org>
To: Uros Bizjak <ubizjak@...il.com>, x86@...nel.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, linux-bcachefs@...r.kernel.org,
linux-arch@...r.kernel.org, netdev@...r.kernel.org
Cc: Nadav Amit <nadav.amit@...il.com>, Dennis Zhou <dennis@...nel.org>,
Tejun Heo <tj@...nel.org>, Christoph Lameter <cl@...ux.com>,
Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...nel.org>,
Borislav Petkov <bp@...en8.de>, Dave Hansen <dave.hansen@...ux.intel.com>,
"H. Peter Anvin" <hpa@...or.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Andy Lutomirski <luto@...nel.org>, Brian Gerst <brgerst@...il.com>,
Peter Zijlstra <peterz@...radead.org>
Subject: Re: [PATCH v4 6/6] percpu/x86: Enable strict percpu checks via named
AS qualifiers
On 27. 01. 25, 17:05, Uros Bizjak wrote:
> This patch declares percpu variables in __seg_gs/__seg_fs named AS
> and keeps them named AS qualified until they are dereferenced with
> percpu accessor. This approach enables various compiler check
> for cross-namespace variable assignments.
So this causes modpost to fail to version some symbols:
> WARNING: modpost: EXPORT symbol "xen_vcpu_id" [vmlinux] version generation failed, symbol will not be versioned.
> Is "xen_vcpu_id" prototyped in <asm/asm-prototypes.h>?
> WARNING: modpost: EXPORT symbol "irq_stat" [vmlinux] version generation failed, symbol will not be versioned.
> Is "irq_stat" prototyped in <asm/asm-prototypes.h>?
> WARNING: modpost: EXPORT symbol "fred_rsp0" [vmlinux] version generation failed, symbol will not be versioned.
> Is "fred_rsp0" prototyped in <asm/asm-prototypes.h>?
> WARNING: modpost: EXPORT symbol "cpu_dr7" [vmlinux] version generation failed, symbol will not be versioned.
> Is "cpu_dr7" prototyped in <asm/asm-prototypes.h>?
> WARNING: modpost: EXPORT symbol "cpu_tss_rw" [vmlinux] version generation failed, symbol will not be versioned.
> Is "cpu_tss_rw" prototyped in <asm/asm-prototypes.h>?
> WARNING: modpost: EXPORT symbol "__tss_limit_invalid" [vmlinux] version generation failed, symbol will not be versioned.
> Is "__tss_limit_invalid" prototyped in <asm/asm-prototypes.h>?
> WARNING: modpost: EXPORT symbol "irq_fpu_usable" [vmlinux] version generation failed, symbol will not be versioned.
> Is "irq_fpu_usable" prototyped in <asm/asm-prototypes.h>?
> WARNING: modpost: EXPORT symbol "cpu_info" [vmlinux] version generation failed, symbol will not be versioned.
> Is "cpu_info" prototyped in <asm/asm-prototypes.h>?
> WARNING: modpost: EXPORT symbol "gdt_page" [vmlinux] version generation failed, symbol will not be versioned.
> Is "gdt_page" prototyped in <asm/asm-prototypes.h>?
> ...
That happens both with 6.15-rc1 and today's -next. Ideas?
Config:
https://github.com/SUSE/kernel-source/blob/master/config/x86_64/default
It is enough to:
make CC='ccache gcc-14' O=../our -j160 vmlinux
to see the above.
> Signed-off-by: Uros Bizjak <ubizjak@...il.com>
> Acked-by: Nadav Amit <nadav.amit@...il.com>
> Cc: Dennis Zhou <dennis@...nel.org>
> Cc: Tejun Heo <tj@...nel.org>
> Cc: Christoph Lameter <cl@...ux.com>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> Cc: Ingo Molnar <mingo@...nel.org>
> Cc: Borislav Petkov <bp@...en8.de>
> Cc: Dave Hansen <dave.hansen@...ux.intel.com>
> Cc: "H. Peter Anvin" <hpa@...or.com>
> Cc: Linus Torvalds <torvalds@...ux-foundation.org>
> Cc: Andy Lutomirski <luto@...nel.org>
> Cc: Brian Gerst <brgerst@...il.com>
> Cc: Peter Zijlstra <peterz@...radead.org>
> ---
> arch/x86/include/asm/percpu.h | 15 ++++++++++++---
> 1 file changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/include/asm/percpu.h b/arch/x86/include/asm/percpu.h
> index 27f668660abe..474d648bca9a 100644
> --- a/arch/x86/include/asm/percpu.h
> +++ b/arch/x86/include/asm/percpu.h
> @@ -95,9 +95,18 @@
>
> #endif /* CONFIG_SMP */
>
> -#define __my_cpu_type(var) typeof(var) __percpu_seg_override
> -#define __my_cpu_ptr(ptr) (__my_cpu_type(*(ptr))*)(__force uintptr_t)(ptr)
> -#define __my_cpu_var(var) (*__my_cpu_ptr(&(var)))
> +#if defined(CONFIG_USE_X86_SEG_SUPPORT) && defined(USE_TYPEOF_UNQUAL)
> +# define __my_cpu_type(var) typeof(var)
> +# define __my_cpu_ptr(ptr) (ptr)
> +# define __my_cpu_var(var) (var)
> +
> +# define __percpu_qual __percpu_seg_override
> +#else
> +# define __my_cpu_type(var) typeof(var) __percpu_seg_override
> +# define __my_cpu_ptr(ptr) (__my_cpu_type(*(ptr))*)(__force uintptr_t)(ptr)
> +# define __my_cpu_var(var) (*__my_cpu_ptr(&(var)))
> +#endif
> +
> #define __percpu_arg(x) __percpu_prefix "%" #x
> #define __force_percpu_arg(x) __force_percpu_prefix "%" #x
thanks,
--
js
suse labs
Powered by blists - more mailing lists