ntdll: Ignore invalid exit_frame when exiting thread.

Alexandre Julliard julliard at winehq.org
Tue Apr 19 00:11:53 CDT 2016

Sebastian Lackner <sebastian at fds-team.de> writes:

> Some versions of pthread indeed put internal structures at the top of the stack.
> To solve that, the current Staging patchset allocates threads with a dummy pthread,
> and then switches to the real stack, see:
> https://github.com/wine-compholio/wine-staging/blob/master/patches/ntdll-Thread_Stack/0001-ntdll-Use-a-separate-stack-when-starting-new-threads.patch
> Unless there is something weird going on, thanks to the CFI annotations in
> wine_switch_to_stack() pthread should be able to unwind the stack correctly despite
> the stack switch inbetween. At least I have not found any problems so far ;)

For this specific stack switch, sure, but it can't unwind across Win32
code, which was the reason for the exit frame in the first place.

> You are right that ignoring exit_frame might (under specific circumstances)
> run language handlers, but I'm not yet aware of a better way to deal with this.
> The only alternative would be to calculate it based on StackBase, but its also
> far from perfect.

I'd suggest to instead try to keep the initial stack around.

Alexandre Julliard
julliard at winehq.org

More information about the wine-devel mailing list