Re: [PATCH] powerpc/vdso: Drop -mstack-protector-guard flags in 32-bit files with clang

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

On Wed, Nov 06, 2024 at 09:55:58AM +0100, Christophe Leroy wrote:
> Le 30/10/2024 à 19:41, Nathan Chancellor a écrit :
> >Under certain conditions, the 64-bit '-mstack-protector-guard' flags may
> >end up in the 32-bit vDSO flags, resulting in build failures due to the
> >structure of clang's argument parsing of the stack protector options,
> >which validates the arguments of the stack protector guard flags
> >unconditionally in the frontend, choking on the 64-bit values when
> >targeting 32-bit:
> >
> >   clang: error: invalid value 'r13' in 'mstack-protector-guard-reg=', 
> >   expected one of: r2
> >   clang: error: invalid value 'r13' in 'mstack-protector-guard-reg=', 
> >   expected one of: r2
> >   make[3]: *** [arch/powerpc/kernel/vdso/Makefile:85: 
> >   arch/powerpc/kernel/vdso/vgettimeofday-32.o] Error 1
> >   make[3]: *** [arch/powerpc/kernel/vdso/Makefile:87: 
> >   arch/powerpc/kernel/vdso/vgetrandom-32.o] Error 1
> >
> >Remove these flags by adding them to the CC32FLAGSREMOVE variable, which
> >already handles situations similar to this. Additionally, reformat and
> >align a comment better for the expanding CONFIG_CC_IS_CLANG block.
> 
> Is the problem really exclusively for 32-bit VDSO on 64-bit kernel ?
> In any case, it is just wrong to have anything related to stack 
> protection in VDSO, for this reason we have the following in Makefile:
> 
> ccflags-y += $(call cc-option, -fno-stack-protector)
> 
> If it is not enough, should we have more complete ?

The -mstack-protector-guard-reg= doesn't do anything if you aren't
doing stack protection.  It allows any base register (so, r1..r31).
Setting it to any valid reg should be fine and not do anything harmful,
unless perhaps you *do* enable stack protector, then it better be the
expected stuff ;-)

Apparently clang does not implement it correctly?  This is just a clang
bug, please report it with them?

(r2 is the default for -m32, r13 is the default for -m64, it appears
that clang does not implement this option at all, it simply checks if
you set the default, and explodes if not).


Segher




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux