Messages in this thread | | | Date | Sun, 26 Mar 2023 21:30:18 +0300 | From | Alexey Dobriyan <> | Subject | Re: [PATCH 6/8] tools/nolibc: tests: add test for -fstack-protector |
| |
Willy Tarreau wrote: > #if defined(__clang__) > __attribute__((optnone)) > #elif defined(__GNUC__) > __attribute__((optimize("O0"))) > #endif > static int smash_stack(void) > { > char buf[100]; > > for (size_t i = 0; i < 200; i++) > buf[i] = 'P'; > > return 1; > }
If you want to corrupt the stack, corrupt the stack!
asm( ".globl f\n" "f:\n" "movq $0, (%rsp)\n" "ret\n" ".type f,@function\n" ".size f,.-f" );
No problems with optimisation levels.
| |