[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Two issues with stack overflow protection

From: Paul Eggert
Subject: Re: Two issues with stack overflow protection
Date: Wed, 29 Jul 2015 06:18:17 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0

Daniel Colascione wrote:
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?
>Unwinding can grow the stack.
Sure. That's why you open up more stack to do the unwinding. Having done
that, if you still overflow, just abort.

Yes, that was my point. Emacs already does the business about the guard page, and opening up more stack, and so forth. The tricky part is the "if you still overflow, just abort", something that's easy enough to describe at the high level but perhaps not so easy to actually write the code. Part of the issue is that the guard page business is done under the covers by the OS, not by Emacs directly -- in general Emacs doesn't know where the guard page(s) are.

I'm sure there are other issues that won't get discovered until someone actually writes and tests something. For example, here's something I just thought of: the conservative marking phase of the Emacs garbage collector may need to be taught about the split stack (currently it assumes the C stack is contiguous).

reply via email to

[Prev in Thread] Current Thread [Next in Thread]