Skip to contentSkip to conversation

why no stack protector for vdso

DISCUSSION linfeilong 2 participants 2 messages Nov 13, 2019

lore
Share & tools
lore
#1 lore raw
Quoted 1 line · linfeilong

Dear Frascino,

[ Cultural note: full names are written in a different order in the "West" and in the "East". FWIW, his first name is Vincenzo ;-)
cf. https://en.wikipedia.org/wiki/Personal_name#Name_order ]

Quoted 2 lines

Can you help me to know why there is -fno-stack-protector in the Makefile of vdso? I wonder if we can delete it, as for safety requirements.

There appear to be 3 files you might be referring to:

arch/arm/vdso/Makefile:ccflags-y := -fPIC -fno-common -fno-builtin -fno-stack-protector arch/arm64/kernel/vdso/Makefile:ccflags-y := -fno-common -fno-builtin -fno-stack-protector -ffixed-x18 arch/arm64/kernel/vdso32/Makefile:VDSO_CAFLAGS += -fPIC -fno-builtin -fno-stack-protector

arch/arm/vdso/Makefile : 8512287a8165592466cb9cb347ba94892e9c56a5

Maybe related:
https://lore.kernel.org/patchwork/patch/143610/
https://lwn.net/Articles/318565/

Quoted 6 lines

With -fstack-protector, gcc copies pt_regs into the callee's stack frame to put it after the stack canary. Of course it doesn't copy back (as the callee owns the argument) and any change made to pt_regs is lost on return. This is currently worked around by adding -fno-stack-protector to any file containing such functions. We really need to teach gcc about the calling convention.

Maybe this is still true? (Although this was on x86_32)

AFAICT, the option was added at this point:

https://lore.kernel.org/linux-arm-kernel/CAASgrz0QfSfnggAf2C0bS7wXbdoPYtVHRhK0UfvT8pykjCowMA@mail.gmail.com/

Regards.

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel