epoll_pwait can have a NULL sigmask.
commit3ac87cf9277964802ddd9af9747a10ff0b838c29
authorMark Wielaard <mark@klomp.org>
Sat, 17 Jun 2017 13:49:22 +0000 (17 13:49 +0000)
committerMark Wielaard <mark@klomp.org>
Sat, 17 Jun 2017 13:49:22 +0000 (17 13:49 +0000)
tree4eafd766e348bbe461c98fd5e020995fb4cb16e1
parent9160ea1ad5d5c34004966141ee1db340065b44ec
epoll_pwait can have a NULL sigmask.

According to the epoll_pwait(2) man page:

       The  sigmask  argument  may  be  specified  as  NULL,  in  which  case
       epoll_pwait() is equivalent to epoll_wait().

But doing that under valgrind gives:

==13887== Syscall param epoll_pwait(sigmask) points to unaddressable byte(s)
==13887==    at 0x4F2B940: epoll_pwait (epoll_pwait.c:43)
==13887==    by 0x400ADE: main (syscalls-2007.c:89)
==13887==  Address 0x0 is not stack'd, malloc'd or (recently) free'd

This is because the sys_epoll_pwait wrapper has:

   if (ARG4)
      PRE_MEM_READ( "epoll_pwait(sigmask)", ARG5, sizeof(vki_sigset_t) );

Which looks like a typo (ARG4 is timeout and ARG5 is sigmask).

This shows up with newer glibc which translates an epoll_wait call into
an epoll_pwait call with NULL sigmask.

Fix typo and add a testcase.

https://bugs.kde.org/show_bug.cgi?id=381289

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16451
NEWS
coregrind/m_syswrap/syswrap-linux.c
memcheck/tests/linux/syscalls-2007.c