This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [OT] Wine + Cygwin: `script -e` exit status forwarding randomly return zero for non zero child process

On Sep  8 01:13, Qian Hong wrote:
> Hi Corinna,
> Thanks again for the quick reply.
> On Mon, Sep 7, 2015 at 8:28 PM, Corinna Vinschen wrote:
> > The terminate_thread_frees_stack flag is set to false for XP/2003 and to
> > true for any newer OS.  I guess this is a double-free because Wine's
> > TerminateThread already freed the stack and Cygwin got the info it's
> > supposedly running under XP/2003, so it tries to workaround the fact
> > that TerminateThread on these systems didn't free the stack by themselves.
> >
> Wine emulates Windows XP here, I double checked Wine source code and I
> can confirm Wine doesn't free the stack:
> NtTerminateThread() -> abort_thread() -> terminate_thread()
> Cygwin reports wincap as wincap_xpsp2 which is also correct here.


> > we need to know what address ret=61005767 is refering to.  addr2line would help.
> As you point out, ret=61005767 is the call to VirtualFree() inside
> cygthread::terminate_thread ()
> After combine the information we have so far, I think the problem is
> clear now. It's not Cygwin's fault, it's Wine's fault. Wine's
> WaitForSingleObject() needs to wait long enough after the
> TerminateThread() call, so the target thread has enough time to finish
> the system cleanup and return correct exit_code before Cygwin call
> VirtualFree to free the stack. But in our current implementation
> Wine's WaitForSingleObject returns too early, it shouldn't return
> before the system thread cleanup done, as a result there is a race
> here. We are thinking of a solution in Wine. Thanks again for the
> great help!

No worries.  I'm glad if we can help each other.


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

Attachment: pgpfhJSvf3lhv.pgp
Description: PGP signature

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]