]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Avoid checking for bitset initialization if futex_wait_bitset is meant to fail.
authorPetar Jovanovic <mips32r2@gmail.com>
Mon, 23 Jul 2012 00:11:10 +0000 (00:11 +0000)
committerPetar Jovanovic <mips32r2@gmail.com>
Mon, 23 Jul 2012 00:11:10 +0000 (00:11 +0000)
Glibc deliberately passes random value for the sixth parameter when calling
FUTEX_WAIT_BITSET | FUTEX_CLOCK_REALTIME. This is a regular case of using the
Futex API, so V should not complain that "Syscall param futex(val3) contains
uninitialised byte(s)", if the futex does not have a specified value initially.
For more info, see function pthread_initialize_minimal_internal at:
glibc/nptl/nptl-init.c.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12773

coregrind/m_syswrap/syswrap-linux.c

index 5b3a34d59b5e3a1400f754fb21b91e54e4c6a6c6..64cacbe17eb102ccb32a99f63be88cb171365c11 100644 (file)
@@ -1008,9 +1008,20 @@ PRE(sys_futex)
                     struct timespec *, utime, vki_u32 *, uaddr2);
       break;
    case VKI_FUTEX_WAIT_BITSET:
-      PRE_REG_READ6(long, "futex", 
-                    vki_u32 *, futex, int, op, int, val,
-                    struct timespec *, utime, int, dummy, int, val3);
+      /* Check that the address at least begins in client-accessible area. */
+      if (!VG_(am_is_valid_for_client)( ARG1, 1, VKI_PROT_READ )) {
+            SET_STATUS_Failure( VKI_EFAULT );
+            return;
+      }
+      if (*(vki_u32 *)ARG1 != ARG3) {
+         PRE_REG_READ5(long, "futex",
+                       vki_u32 *, futex, int, op, int, val,
+                       struct timespec *, utime, int, dummy);
+      } else {
+         PRE_REG_READ6(long, "futex",
+                       vki_u32 *, futex, int, op, int, val,
+                       struct timespec *, utime, int, dummy, int, val3);
+      }
       break;
    case VKI_FUTEX_WAKE_BITSET:
       PRE_REG_READ6(long, "futex",