[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Two issues with stack overflow protection
From: |
Daniel Colascione |
Subject: |
Re: Two issues with stack overflow protection |
Date: |
Tue, 28 Jul 2015 23:10:45 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 |
On 07/28/2015 10:01 PM, Paul Eggert wrote:
> Eli Zaretskii wrote:
>> The implementation of stack_overflow on sysdep.c was recently changed
>> so as not to use sys/resource.h and getrlimit, but configure.ac still
>> insists on these two features in order to include the recovery code,
>> which I think should be fixed.
>
> Thanks, fixed with the attached patch.
>
>> More importantly, the recovery simply longjmps to command_loop,
>> whereas similar features like Fthrow and Fsignal do much more in
>> unwind_to_catch. Shouldn't stack overflow recovery do that as well?
>> Otherwise, the specpdl stack, byte_stack_list, lisp_eval_depth
>> etc. all stay at their values they had at stack overflow time, no?
>
> No, they are cleared back to top-level values, because when
> command_loop's call to sigsetjmp returns nonzero, it then calls
> init_eval and this resets them.
>
> There is a problem that the speclpdl stack's unwind-protect and
> dynamic-let-bindings are unceremoniously discarded on stack overflow. I
> suppose that should get fixed, though it may be a bit tricky to avoid
> looping.
What's wrong with just mprotecting a guard page at the end of the stack,
and on overflow, giving that region normal protection, unwinding as
normal, then, at top level, restoring the guard page?
signature.asc
Description: OpenPGP digital signature
- Two issues with stack overflow protection, Eli Zaretskii, 2015/07/28
- Re: Two issues with stack overflow protection, Paul Eggert, 2015/07/29
- Re: Two issues with stack overflow protection,
Daniel Colascione <=
- Re: Two issues with stack overflow protection, Paul Eggert, 2015/07/29
- Re: Two issues with stack overflow protection, Daniel Colascione, 2015/07/29
- Re: Two issues with stack overflow protection, Paul Eggert, 2015/07/29
- Re: Two issues with stack overflow protection, Eli Zaretskii, 2015/07/29
- Re: Two issues with stack overflow protection, Paul Eggert, 2015/07/29