loader: Mark the stack as executable if possible.

Peter Beutner p.beutner at gmx.net
Wed Nov 15 11:48:18 CST 2006

Marcus Meissner schrieb:
> On Wed, Nov 15, 2006 at 05:58:44PM +0100, Peter Beutner wrote:
>> Mike McCormack schrieb:
>>> ---
>>> This should fix bug #6622.
>> The application in question doesn't crash because it needs an executable stack, but because the
>> PE image header of the exe is totally broken, no section is marked as executable there at all.
>> Wine does exactly what it should do here(same goes for Irfanview in #6129, seems both apps use
>> the same exe packer(ASPack) so probably it's the packer which is broken).
>> I bet the applications would also crash under windows if the noexecute protection is activated.
> Actually check out dlls/kernel32/except.c:check_no_exec().
> It marks pages as executable where code wants to be executed and actually should help in this
> case. It does help for 2 cases (the 2 lines printed), but fails on the 3rd.
> (It goes into an endless exception loop exhausting stack space.)

I think the problem is that it is called from UnhandledExceptionFilter.It is the the last
exception handler that gets invoked.
If there is any other exception handler registered, chances are good that this one will try to handle
the error, but actually doing something totally wrong because it doesn't understand whats going on.

Besides i think it's a bad idea to blindly mark pages executable like this:

"hey, we successfully catched an attempted buffer overflow attack, thanks for NX. But lets
ignore it and let the code run anyway ..." :p

More information about the wine-devel mailing list