mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-29 13:53:33 +00:00
tools/nolibc: i386: add stackprotector support
Enable the new stackprotector support for i386. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
This commit is contained in:
parent
9735716830
commit
ff221a6d9a
2 changed files with 7 additions and 1 deletions
|
@ -181,6 +181,8 @@ struct sys_stat_struct {
|
||||||
char **environ __attribute__((weak));
|
char **environ __attribute__((weak));
|
||||||
const unsigned long *_auxv __attribute__((weak));
|
const unsigned long *_auxv __attribute__((weak));
|
||||||
|
|
||||||
|
#define __ARCH_SUPPORTS_STACK_PROTECTOR
|
||||||
|
|
||||||
/* startup code */
|
/* startup code */
|
||||||
/*
|
/*
|
||||||
* i386 System V ABI mandates:
|
* i386 System V ABI mandates:
|
||||||
|
@ -188,9 +190,12 @@ const unsigned long *_auxv __attribute__((weak));
|
||||||
* 2) The deepest stack frame should be set to zero
|
* 2) The deepest stack frame should be set to zero
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void __attribute__((weak,noreturn,optimize("omit-frame-pointer"))) _start(void)
|
void __attribute__((weak,noreturn,optimize("omit-frame-pointer"),no_stack_protector)) _start(void)
|
||||||
{
|
{
|
||||||
__asm__ volatile (
|
__asm__ volatile (
|
||||||
|
#ifdef NOLIBC_STACKPROTECTOR
|
||||||
|
"call __stack_chk_init\n" // initialize stack protector
|
||||||
|
#endif
|
||||||
"pop %eax\n" // argc (first arg, %eax)
|
"pop %eax\n" // argc (first arg, %eax)
|
||||||
"mov %esp, %ebx\n" // argv[] (second arg, %ebx)
|
"mov %esp, %ebx\n" // argv[] (second arg, %ebx)
|
||||||
"lea 4(%ebx,%eax,4),%ecx\n" // then a NULL then envp (third arg, %ecx)
|
"lea 4(%ebx,%eax,4),%ecx\n" // then a NULL then envp (third arg, %ecx)
|
||||||
|
|
|
@ -79,6 +79,7 @@ endif
|
||||||
CFLAGS_STACKPROTECTOR = -DNOLIBC_STACKPROTECTOR \
|
CFLAGS_STACKPROTECTOR = -DNOLIBC_STACKPROTECTOR \
|
||||||
$(call cc-option,-mstack-protector-guard=global) \
|
$(call cc-option,-mstack-protector-guard=global) \
|
||||||
$(call cc-option,-fstack-protector-all)
|
$(call cc-option,-fstack-protector-all)
|
||||||
|
CFLAGS_STKP_i386 = $(CFLAGS_STACKPROTECTOR)
|
||||||
CFLAGS_s390 = -m64
|
CFLAGS_s390 = -m64
|
||||||
CFLAGS ?= -Os -fno-ident -fno-asynchronous-unwind-tables \
|
CFLAGS ?= -Os -fno-ident -fno-asynchronous-unwind-tables \
|
||||||
$(call cc-option,-fno-stack-protector) \
|
$(call cc-option,-fno-stack-protector) \
|
||||||
|
|
Loading…
Reference in a new issue