From: Ivo Raisr Date: Wed, 30 Mar 2016 17:36:03 +0000 (+0000) Subject: Fix bug 324227 also on Solaris. X-Git-Tag: svn/VALGRIND_3_12_0~184 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=beb198ca3a9233c8b99b9f7e24d7b84147cf03af;p=thirdparty%2Fvalgrind.git Fix bug 324227 also on Solaris. We somehow overlooked this commit during development work on Solaris port before it landed in the official repository. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15839 --- diff --git a/coregrind/m_syswrap/syswrap-solaris.c b/coregrind/m_syswrap/syswrap-solaris.c index ca9db129df..b98b17ddb0 100644 --- a/coregrind/m_syswrap/syswrap-solaris.c +++ b/coregrind/m_syswrap/syswrap-solaris.c @@ -1092,14 +1092,22 @@ PRE(sys_exit) if (VG_(threads)[t].status == VgTs_Empty) continue; - VG_(threads)[t].exitreason = VgSrc_ExitProcess; + /* Assign the exit code, VG_(nuke_all_threads_except) will assign + the exitreason. */ VG_(threads)[t].os_state.exitcode = ARG1; - - /* Unblock it, if blocked. */ - if (t != tid) - VG_(get_thread_out_of_syscall)(t); } + /* Indicate in all other threads that the process is exiting. + Then wait using VG_(reap_threads) for these threads to disappear. + See comments in syswrap-linux.c, PRE(sys_exit_group) wrapper, + for reasoning why this cannot give a deadlock. */ + VG_(nuke_all_threads_except)(tid, VgSrc_ExitProcess); + VG_(reap_threads)(tid); + VG_(threads)[tid].exitreason = VgSrc_ExitThread; + /* We do assign VgSrc_ExitThread and not VgSrc_ExitProcess, as this thread + is the thread calling exit_group and so its registers must be considered + as not reachable. See pub_tool_machine.h VG_(apply_to_GP_regs). */ + /* We have to claim the syscall already succeeded. */ SET_STATUS_Success(0); }