lkml.org 
[lkml]   [2021]   [May]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v8 5/6] x86/signal: Detect and prevent an alternate signal stack overflow
Date
On Wed, May 12 2021 at 18:48, Chang Seok Bae wrote:
> On May 11, 2021, at 11:36, Borislav Petkov <bp@alien8.de> wrote:
>>
>> I clumsily tried to register a SIGSEGV handler with
>>
>> act.sa_sigaction = my_sigsegv;
>> sigaction(SIGSEGV, &act, NULL);
>>
>> but that doesn't fire - task gets killed. Maybe I'm doing it wrong.
>
> Since the altstack is already overflowed, perhaps set the flag like this -- not
> using it to get the handler:
>
> act.sa_sigaction = my_sigsegv;
> + act.sa_flags = SA_SIGINFO;
> sigaction(SIGSEGV, &act, NULL);
>
> FWIW, I think this is just a workaround for this case; in practice, altstack is
> rather a backup for normal stack corruption.

That's the intended usage, but it's not limited to that and there exists
creative (ab)use of sigaltstack beyond catching the overflow of the
regular stack.

Thanks,

tglx

\
 
 \ /
  Last update: 2021-05-13 00:39    [W:0.142 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site