|
From: <sv...@va...> - 2012-07-23 00:11:18
|
petarj 2012-07-23 01:11:10 +0100 (Mon, 23 Jul 2012)
New Revision: 12773
Log:
Avoid checking for bitset initialization if futex_wait_bitset is meant to fail.
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.
Modified files:
trunk/coregrind/m_syswrap/syswrap-linux.c
Modified: trunk/coregrind/m_syswrap/syswrap-linux.c (+14 -3)
===================================================================
--- trunk/coregrind/m_syswrap/syswrap-linux.c 2012-07-22 12:10:08 +01:00 (rev 12772)
+++ trunk/coregrind/m_syswrap/syswrap-linux.c 2012-07-23 01:11:10 +01:00 (rev 12773)
@@ -1008,9 +1008,20 @@
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",
|