Re: [PATCH v5 01/16] x86/stackprotector: Work around strict Clang TLS symbol requirements

From: Brian Gerst
Date: Fri Dec 06 2024 - 09:10:16 EST


On Fri, Dec 6, 2024 at 6:52 AM Oleg Nesterov <oleg@xxxxxxxxxx> wrote:
>
> On 11/05, Brian Gerst wrote:
> >
> > --- a/arch/x86/kernel/vmlinux.lds.S
> > +++ b/arch/x86/kernel/vmlinux.lds.S
> > @@ -468,6 +468,9 @@ SECTIONS
> > . = ASSERT((_end - LOAD_OFFSET <= KERNEL_IMAGE_SIZE),
> > "kernel image bigger than KERNEL_IMAGE_SIZE");
> >
> > +/* needed for Clang - see arch/x86/entry/entry.S */
> > +PROVIDE(__ref_stack_chk_guard = __stack_chk_guard);
>
> Don't we need the simple fix below?
>
> without this patch I can't build the kernel with CONFIG_STACKPROTECTOR=n.
>
> Oleg.
>
> diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
> index fab3ac9a4574..2ff48645bab9 100644
> --- a/arch/x86/kernel/vmlinux.lds.S
> +++ b/arch/x86/kernel/vmlinux.lds.S
> @@ -472,8 +472,10 @@ SECTIONS
> . = ASSERT((_end - LOAD_OFFSET <= KERNEL_IMAGE_SIZE),
> "kernel image bigger than KERNEL_IMAGE_SIZE");
>
> +#ifdef CONFIG_STACKPROTECTOR
> /* needed for Clang - see arch/x86/entry/entry.S */
> PROVIDE(__ref_stack_chk_guard = __stack_chk_guard);
> +#endif
>
> #ifdef CONFIG_X86_64
> /*

Which compiler are you using? It builds fine with GCC 14 and clang 18.


Brian Gerst