[Bug 44820] New: Processes might terminate with incorrect exit code due to race-condition when threads are killed during shutdown

wine-bugs at winehq.org wine-bugs at winehq.org
Sun Mar 25 12:45:41 CDT 2018


https://bugs.winehq.org/show_bug.cgi?id=44820

            Bug ID: 44820
           Summary: Processes might terminate with incorrect exit code due
                    to race-condition when threads are killed during
                    shutdown
           Product: Wine
           Version: 3.4
          Hardware: x86-64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ntdll
          Assignee: wine-bugs at winehq.org
          Reporter: focht at gmx.net
      Distribution: ---

Hello folks,

to track
https://github.com/wine-staging/wine-staging/tree/master/patches/ntdll-Threading

Unfortunately there is no further information/details, I just found this:

https://wine-staging.com/news/2015-03-07-release-1.7.38.html

-> https://github.com/wine-staging/wine-staging/blob/v1.7.38/debian/changelog

--- quote ---
 * Added patch to fix race-condition when threads are killed during shutdown.
--- quote ---

https://github.com/wine-staging/wine-staging/blob/master/patches/ntdll-Threading/0001-ntdll-Fix-race-condition-when-threads-are-killed-dur.patch

--- quote ---
When exit_thread is executed, nb_threads is decremented before the thread is
fully shutdown. When another thread runs ExitProcess() this will cause a
SIGQUIT
signal to all threads, effectively decrementing nb_threads twice. The process
will terminate with a wrong exitcode then because the refcount reaches zero too
early.

Currently Wine has no locking protection of LdrShutdownProcess(), so it can
only be executed safely when all other threads have terminated before. Most
likely there are more Wine bugs in this area, but the attached patch should
fix the most critical one (messed up refcounting of threads) for now. 
--- quote ---

Sadly no applications are mentioned that could be used to validate the problem.

$ wine --version
wine-3.4

Regards

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.



More information about the wine-bugs mailing list