Blame SOURCES/valgrind-3.11.0-futex.patch

0ab3a1
commit 9a447c6472947bce97e8b90b7f3f97bd7cd9f3ed
0ab3a1
Author: mjw <mjw@a5019735-40e9-0310-863c-91ae7b9d1cf9>
0ab3a1
Date:   Wed Feb 17 20:53:34 2016 +0000
0ab3a1
0ab3a1
    Bug 359201 futex syscall skips argument 5 if op is FUTEX_WAIT_BITSET
0ab3a1
    
0ab3a1
    git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15793 a5019735-40e9-0310-863c-91ae7b9d1cf9
0ab3a1
0ab3a1
commit f71fd226f26ab49a615d7886ff2aeadc9915c7c1
0ab3a1
Author: mjw <mjw@a5019735-40e9-0310-863c-91ae7b9d1cf9>
0ab3a1
Date:   Thu Feb 18 11:14:47 2016 +0000
0ab3a1
0ab3a1
    Bug 359201 followup. futex skips argument 5 if op is FUTEX_WAIT_BITSET.
0ab3a1
    
0ab3a1
    The original fix in svn r15793 read argument 6 separately by using PRA6
0ab3a1
    unconditionally. This is wrong. We need to first check whether a
0ab3a1
    track_pre_reg_read callback is registered (only memcheck does).
0ab3a1
    The PRE_REG_READX macro already had this check. Just add the same
0ab3a1
    before calling PRA6. Thanks to Tom Hughes for noticing. Without this
0ab3a1
    helgrind/tests/cond_timedwait_test and drd/tests/pth_inconsistent_cond_wait
0ab3a1
    regtests would fail.
0ab3a1
    
0ab3a1
    git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15795 a5019735-40e9-0310-8
0ab3a1
0ab3a1
diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c
0ab3a1
index f796969..f2d1076 100644
0ab3a1
--- a/coregrind/m_syswrap/syswrap-linux.c
0ab3a1
+++ b/coregrind/m_syswrap/syswrap-linux.c
0ab3a1
@@ -1154,13 +1154,17 @@ PRE(sys_futex)
0ab3a1
             return;
0ab3a1
       }
0ab3a1
       if (*(vki_u32 *)ARG1 != ARG3) {
0ab3a1
-         PRE_REG_READ5(long, "futex",
0ab3a1
+         PRE_REG_READ4(long, "futex",
0ab3a1
                        vki_u32 *, futex, int, op, int, val,
0ab3a1
-                       struct timespec *, utime, int, dummy);
0ab3a1
+                       struct timespec *, utime);
0ab3a1
       } else {
0ab3a1
-         PRE_REG_READ6(long, "futex",
0ab3a1
+        /* Note argument 5 is unused, but argument 6 is used.
0ab3a1
+           So we cannot just PRE_REG_READ6. Read argument 6 separately.  */
0ab3a1
+         PRE_REG_READ4(long, "futex",
0ab3a1
                        vki_u32 *, futex, int, op, int, val,
0ab3a1
-                       struct timespec *, utime, int, dummy, int, val3);
0ab3a1
+                       struct timespec *, utime);
0ab3a1
+         if (VG_(tdict).track_pre_reg_read)
0ab3a1
+            PRA6("futex",int,val3);
0ab3a1
       }
0ab3a1
       break;
0ab3a1
    case VKI_FUTEX_WAKE_BITSET: