From: Petar Jovanovic Date: Mon, 23 Jul 2012 00:11:10 +0000 (+0000) Subject: Avoid checking for bitset initialization if futex_wait_bitset is meant to fail. X-Git-Tag: svn/VALGRIND_3_8_0~95 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=89c5f88c45ef07708eaed7c7048a97ceb2af273e;p=thirdparty%2Fvalgrind.git 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. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12773 --- diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index 5b3a34d59b..64cacbe17e 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -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",