]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
drd: Fix fork() handling
authorBart Van Assche <bvanassche@acm.org>
Sat, 1 Dec 2018 18:43:06 +0000 (10:43 -0800)
committerBart Van Assche <bvanassche@acm.org>
Sat, 1 Dec 2018 18:45:51 +0000 (10:45 -0800)
The thread ID passed to DRD_(drd_thread_atfork_child)() is a Valgrind
thread ID instead of a DRD thread ID. This patch fixes bug 401578.

NEWS
drd/drd_thread.c

diff --git a/NEWS b/NEWS
index ffaabd7d76c9f10ec9ad57bf40b145997c3f163b..7b784a80b240709c20f1ad5322160cbc121da629 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -59,6 +59,7 @@ where XXXXXX is the bug number as listed below.
 401277  More bugs in z13 support
 401112  LLVM 5.0 generates comparison against partially initialized data
 385411  s390x: z13 vector floating-point instructions not implemented
+401578  drd: crashes sometimes on fork()
 
 Release 3.14.0 (9 October 2018)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
index 9ada77dfe3778618a25562d8462902976e268236..7641a355f17f57742699c4c3408b26b2743e7429 100644 (file)
@@ -570,13 +570,13 @@ void DRD_(thread_finished)(const DrdThreadId tid)
 }
 
 /** Called just after fork() in the child process. */
-void DRD_(drd_thread_atfork_child)(const DrdThreadId tid)
+void DRD_(drd_thread_atfork_child)(const ThreadId tid)
 {
    unsigned i;
 
    for (i = 1; i < DRD_N_THREADS; i++)
    {
-      if (i == tid)
+      if (DRD_(g_threadinfo)[i].vg_threadid == tid)
         continue;
       if (DRD_(IsValidDrdThreadId(i)))
         DRD_(thread_delete)(i, True);