90dfed
commit e08a82991a9b9dc87c13f2b89273f25f97d14baf
90dfed
Author: Tom Hughes <tom@compton.nu>
90dfed
Date:   Tue Apr 6 22:44:36 2021 +0100
90dfed
90dfed
    Only process clone results in the parent thread
90dfed
    
90dfed
    Fixes BZ#423963
90dfed
90dfed
diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c
90dfed
index 5ae4e6613..c59d8ee26 100644
90dfed
--- a/coregrind/m_syswrap/syswrap-linux.c
90dfed
+++ b/coregrind/m_syswrap/syswrap-linux.c
90dfed
@@ -940,7 +940,7 @@ PRE(sys_clone)
90dfed
          ("Valgrind does not support general clone().");
90dfed
    }
90dfed
 
90dfed
-   if (SUCCESS) {
90dfed
+   if (SUCCESS && RES != 0) {
90dfed
       if (ARG_FLAGS & (VKI_CLONE_PARENT_SETTID | VKI_CLONE_PIDFD))
90dfed
          POST_MEM_WRITE(ARG3, sizeof(Int));
90dfed
       if (ARG_FLAGS & (VKI_CLONE_CHILD_SETTID | VKI_CLONE_CHILD_CLEARTID))