lkml.org 
[lkml]   [2023]   [Mar]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 6/8] tools/nolibc: tests: add test for -fstack-protector

Mar 26, 2023 13:30:21 Alexey Dobriyan <adobriyan@gmail.com>:

> 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!

I do!

> asm(
> ".globl f\n"
> "f:\n"
> "movq $0, (%rsp)\n"
> "ret\n"
> ".type f,@function\n"
> ".size f,.-f"
> );
> > No problems with optimisation levels.

Wouldn't this be architecture-specific?

\
 
 \ /
  Last update: 2023-03-27 01:18    [W:0.046 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site