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

Christophe Leroy christophe.leroy at csgroup.eu
Wed Nov 6 19:55:58 AEDT 2024



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 ?

Christophe


More information about the Linuxppc-dev mailing list