Mark Wielaard 71c761
commit 515c3b6de3eff6ddf88fd14a0084b8ad0c692553
Mark Wielaard 71c761
Author: iraisr <iraisr@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Mark Wielaard 71c761
Date:   Tue Mar 8 09:04:48 2016 +0000
Mark Wielaard 71c761
Mark Wielaard 71c761
    Sanitize signal mask in ppoll and pselect syscalls
Mark Wielaard 71c761
    Reported and Linux patch contributed by Steven Smith <sos22@archy.org.uk>
Mark Wielaard 71c761
    Fixes BZ#359871
Mark Wielaard 71c761
    
Mark Wielaard 71c761
    
Mark Wielaard 71c761
    
Mark Wielaard 71c761
    git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15823 a5019735-40e9-0310-863c-91ae7b9d1cf9
Mark Wielaard 71c761
Mark Wielaard 71c761
diff --git a/coregrind/m_syswrap/priv_syswrap-main.h b/coregrind/m_syswrap/priv_syswrap-main.h
Mark Wielaard 71c761
index cabad7c..3164c81 100644
Mark Wielaard 71c761
--- a/coregrind/m_syswrap/priv_syswrap-main.h
Mark Wielaard 71c761
+++ b/coregrind/m_syswrap/priv_syswrap-main.h
Mark Wielaard 71c761
@@ -38,6 +38,9 @@
Mark Wielaard 71c761
 extern
Mark Wielaard 71c761
 void ML_(fixup_guest_state_to_restart_syscall) ( ThreadArchState* arch );
Mark Wielaard 71c761
 
Mark Wielaard 71c761
+extern
Mark Wielaard 71c761
+void VG_(sanitize_client_sigmask)(vki_sigset_t *mask);
Mark Wielaard 71c761
+
Mark Wielaard 71c761
 #if defined(VGO_darwin)
Mark Wielaard 71c761
 /* Longjmp to scheduler after client calls workq_ops(WQOPS_THREAD_RETURN)*/
Mark Wielaard 71c761
 extern
Mark Wielaard 71c761
diff --git a/coregrind/m_syswrap/syswrap-amd64-linux.c b/coregrind/m_syswrap/syswrap-amd64-linux.c
Mark Wielaard 71c761
index 7c88bc2..4a8344b 100644
Mark Wielaard 71c761
--- a/coregrind/m_syswrap/syswrap-amd64-linux.c
Mark Wielaard 71c761
+++ b/coregrind/m_syswrap/syswrap-amd64-linux.c
Mark Wielaard 71c761
@@ -1018,7 +1018,7 @@ static SyscallTableEntry syscall_table[] = {
Mark Wielaard 71c761
    LINX_(__NR_fchmodat,		 sys_fchmodat),         // 268
Mark Wielaard 71c761
    LINX_(__NR_faccessat,	 sys_faccessat),        // 269
Mark Wielaard 71c761
 
Mark Wielaard 71c761
-   LINX_(__NR_pselect6,		 sys_pselect6),         // 270
Mark Wielaard 71c761
+   LINXY(__NR_pselect6,		 sys_pselect6),         // 270
Mark Wielaard 71c761
    LINXY(__NR_ppoll,		 sys_ppoll),            // 271
Mark Wielaard 71c761
    LINX_(__NR_unshare,		 sys_unshare),          // 272
Mark Wielaard 71c761
    LINX_(__NR_set_robust_list,	 sys_set_robust_list),  // 273
Mark Wielaard 71c761
diff --git a/coregrind/m_syswrap/syswrap-arm-linux.c b/coregrind/m_syswrap/syswrap-arm-linux.c
Mark Wielaard 71c761
index 3ccad12..224070c 100644
Mark Wielaard 71c761
--- a/coregrind/m_syswrap/syswrap-arm-linux.c
Mark Wielaard 71c761
+++ b/coregrind/m_syswrap/syswrap-arm-linux.c
Mark Wielaard 71c761
@@ -1188,7 +1188,7 @@ static SyscallTableEntry syscall_main_table[] = {
Mark Wielaard 71c761
 
Mark Wielaard 71c761
    LINX_(__NR_arm_fadvise64_64,  sys_fadvise64_64),     // 270 */(Linux?)
Mark Wielaard 71c761
 
Mark Wielaard 71c761
-   LINX_(__NR_pselect6,          sys_pselect6),         // 335
Mark Wielaard 71c761
+   LINXY(__NR_pselect6,          sys_pselect6),         // 335
Mark Wielaard 71c761
    LINXY(__NR_ppoll,             sys_ppoll),            // 336
Mark Wielaard 71c761
 
Mark Wielaard 71c761
    LINXY(__NR_epoll_pwait,       sys_epoll_pwait),      // 346
Mark Wielaard 71c761
diff --git a/coregrind/m_syswrap/syswrap-arm64-linux.c b/coregrind/m_syswrap/syswrap-arm64-linux.c
Mark Wielaard 71c761
index 8d3027d..abddff1 100644
Mark Wielaard 71c761
--- a/coregrind/m_syswrap/syswrap-arm64-linux.c
Mark Wielaard 71c761
+++ b/coregrind/m_syswrap/syswrap-arm64-linux.c
Mark Wielaard 71c761
@@ -924,7 +924,7 @@ static SyscallTableEntry syscall_main_table[] = {
Mark Wielaard 71c761
    GENX_(__NR_writev,            sys_writev),            // 66
Mark Wielaard 71c761
    GENXY(__NR_pread64,           sys_pread64),           // 67
Mark Wielaard 71c761
    GENX_(__NR_pwrite64,          sys_pwrite64),          // 68
Mark Wielaard 71c761
-   LINX_(__NR_pselect6,          sys_pselect6),          // 72
Mark Wielaard 71c761
+   LINXY(__NR_pselect6,          sys_pselect6),          // 72
Mark Wielaard 71c761
    LINXY(__NR_ppoll,             sys_ppoll),             // 73
Mark Wielaard 71c761
    LINXY(__NR_signalfd4,         sys_signalfd4),         // 74
Mark Wielaard 71c761
    LINX_(__NR_readlinkat,        sys_readlinkat),        // 78
Mark Wielaard 71c761
diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c
Mark Wielaard 71c761
index f2d1076..6fdacda 100644
Mark Wielaard 71c761
--- a/coregrind/m_syswrap/syswrap-linux.c
Mark Wielaard 71c761
+++ b/coregrind/m_syswrap/syswrap-linux.c
Mark Wielaard 71c761
@@ -62,6 +62,7 @@
Mark Wielaard 71c761
 #include "priv_types_n_macros.h"
Mark Wielaard 71c761
 #include "priv_syswrap-generic.h"
Mark Wielaard 71c761
 #include "priv_syswrap-linux.h"
Mark Wielaard 71c761
+#include "priv_syswrap-main.h"
Mark Wielaard 71c761
 #include "priv_syswrap-xen.h"
Mark Wielaard 71c761
 
Mark Wielaard 71c761
 // Run a thread from beginning to end and return the thread's
Mark Wielaard 71c761
@@ -1272,9 +1273,18 @@ POST(sys_get_robust_list)
Mark Wielaard 71c761
    POST_MEM_WRITE(ARG3, sizeof(struct vki_size_t *));
Mark Wielaard 71c761
 }
Mark Wielaard 71c761
 
Mark Wielaard 71c761
+struct pselect_sized_sigset {
Mark Wielaard 71c761
+    const vki_sigset_t *ss;
Mark Wielaard 71c761
+    vki_size_t ss_len;
Mark Wielaard 71c761
+};
Mark Wielaard 71c761
+struct pselect_adjusted_sigset {
Mark Wielaard 71c761
+    struct pselect_sized_sigset ss; /* The actual syscall arg */
Mark Wielaard 71c761
+    vki_sigset_t adjusted_ss;
Mark Wielaard 71c761
+};
Mark Wielaard 71c761
+
Mark Wielaard 71c761
 PRE(sys_pselect6)
Mark Wielaard 71c761
 {
Mark Wielaard 71c761
-   *flags |= SfMayBlock;
Mark Wielaard 71c761
+   *flags |= SfMayBlock | SfPostOnFail;
Mark Wielaard 71c761
    PRINT("sys_pselect6 ( %ld, %#lx, %#lx, %#lx, %#lx, %#lx )",
Mark Wielaard 71c761
          SARG1, ARG2, ARG3, ARG4, ARG5, ARG6);
Mark Wielaard 71c761
    PRE_REG_READ6(long, "pselect6",
Mark Wielaard 71c761
@@ -1293,15 +1303,41 @@ PRE(sys_pselect6)
Mark Wielaard 71c761
 		     ARG4, ARG1/8 /* __FD_SETSIZE/8 */ );
Mark Wielaard 71c761
    if (ARG5 != 0)
Mark Wielaard 71c761
       PRE_MEM_READ( "pselect6(timeout)", ARG5, sizeof(struct vki_timeval) );
Mark Wielaard 71c761
-   if (ARG6 != 0)
Mark Wielaard 71c761
-      PRE_MEM_READ( "pselect6(sig)", ARG6, sizeof(void *)+sizeof(vki_size_t) );
Mark Wielaard 71c761
+   if (ARG6 != 0) {
Mark Wielaard 71c761
+      const struct pselect_sized_sigset *pss =
Mark Wielaard 71c761
+          (struct pselect_sized_sigset *)ARG6;
Mark Wielaard 71c761
+      PRE_MEM_READ( "pselect6(sig)", ARG6, sizeof(*pss) );
Mark Wielaard 71c761
+      if (!ML_(safe_to_deref)(pss, sizeof(*pss))) {
Mark Wielaard 71c761
+         ARG6 = 1; /* Something recognisable to POST() hook. */
Mark Wielaard 71c761
+      } else {
Mark Wielaard 71c761
+         struct pselect_adjusted_sigset *pas;
Mark Wielaard 71c761
+         pas = VG_(malloc)("syswrap.pselect6.1", sizeof(*pas));
Mark Wielaard 71c761
+         ARG6 = (Addr)pas;
Mark Wielaard 71c761
+         pas->ss.ss = (void *)1;
Mark Wielaard 71c761
+         pas->ss.ss_len = pss->ss_len;
Mark Wielaard 71c761
+         if (pss->ss_len == sizeof(*pss->ss)) {
Mark Wielaard 71c761
+            PRE_MEM_READ("pselect6(sig->ss)", (Addr)pss->ss, pss->ss_len);
Mark Wielaard 71c761
+            if (ML_(safe_to_deref)(pss->ss, sizeof(*pss->ss))) {
Mark Wielaard 71c761
+               pas->adjusted_ss = *pss->ss;
Mark Wielaard 71c761
+               pas->ss.ss = &pas->adjusted_ss;
Mark Wielaard 71c761
+               VG_(sanitize_client_sigmask)(&pas->adjusted_ss);
Mark Wielaard 71c761
+            }
Mark Wielaard 71c761
+         }
Mark Wielaard 71c761
+      }
Mark Wielaard 71c761
+   }
Mark Wielaard 71c761
+}
Mark Wielaard 71c761
+POST(sys_pselect6)
Mark Wielaard 71c761
+{
Mark Wielaard 71c761
+   if (ARG6 != 0 && ARG6 != 1) {
Mark Wielaard 71c761
+       VG_(free)((struct pselect_adjusted_sigset *)ARG6);
Mark Wielaard 71c761
+   }
Mark Wielaard 71c761
 }
Mark Wielaard 71c761
 
Mark Wielaard 71c761
 PRE(sys_ppoll)
Mark Wielaard 71c761
 {
Mark Wielaard 71c761
    UInt i;
Mark Wielaard 71c761
    struct vki_pollfd* ufds = (struct vki_pollfd *)ARG1;
Mark Wielaard 71c761
-   *flags |= SfMayBlock;
Mark Wielaard 71c761
+   *flags |= SfMayBlock | SfPostOnFail;
Mark Wielaard 71c761
    PRINT("sys_ppoll ( %#lx, %lu, %#lx, %#lx, %lu )\n", ARG1,ARG2,ARG3,ARG4,ARG5);
Mark Wielaard 71c761
    PRE_REG_READ5(long, "ppoll",
Mark Wielaard 71c761
                  struct vki_pollfd *, ufds, unsigned int, nfds,
Mark Wielaard 71c761
@@ -1319,18 +1355,33 @@ PRE(sys_ppoll)
Mark Wielaard 71c761
 
Mark Wielaard 71c761
    if (ARG3)
Mark Wielaard 71c761
       PRE_MEM_READ( "ppoll(tsp)", ARG3, sizeof(struct vki_timespec) );
Mark Wielaard 71c761
-   if (ARG4)
Mark Wielaard 71c761
-      PRE_MEM_READ( "ppoll(sigmask)", ARG4, sizeof(vki_sigset_t) );
Mark Wielaard 71c761
+   if (ARG4 != 0 && sizeof(vki_sigset_t) == ARG5) {
Mark Wielaard 71c761
+      const vki_sigset_t *guest_sigmask = (vki_sigset_t *)ARG4;
Mark Wielaard 71c761
+      PRE_MEM_READ( "ppoll(sigmask)", ARG4, ARG5);
Mark Wielaard 71c761
+      if (!ML_(safe_to_deref)(guest_sigmask, sizeof(*guest_sigmask))) {
Mark Wielaard 71c761
+         ARG4 = 1; /* Something recognisable to POST() hook. */
Mark Wielaard 71c761
+      } else {
Mark Wielaard 71c761
+         vki_sigset_t *vg_sigmask =
Mark Wielaard 71c761
+             VG_(malloc)("syswrap.ppoll.1", sizeof(*vg_sigmask));
Mark Wielaard 71c761
+         ARG4 = (Addr)vg_sigmask;
Mark Wielaard 71c761
+         *vg_sigmask = *guest_sigmask;
Mark Wielaard 71c761
+         VG_(sanitize_client_sigmask)(vg_sigmask);
Mark Wielaard 71c761
+      }
Mark Wielaard 71c761
+   }
Mark Wielaard 71c761
 }
Mark Wielaard 71c761
 
Mark Wielaard 71c761
 POST(sys_ppoll)
Mark Wielaard 71c761
 {
Mark Wielaard 71c761
-   if (RES > 0) {
Mark Wielaard 71c761
+   vg_assert(SUCCESS || FAILURE);
Mark Wielaard 71c761
+   if (SUCCESS && (RES >= 0)) {
Mark Wielaard 71c761
       UInt i;
Mark Wielaard 71c761
       struct vki_pollfd* ufds = (struct vki_pollfd *)ARG1;
Mark Wielaard 71c761
       for (i = 0; i < ARG2; i++)
Mark Wielaard 71c761
 	 POST_MEM_WRITE( (Addr)(&ufds[i].revents), sizeof(ufds[i].revents) );
Mark Wielaard 71c761
    }
Mark Wielaard 71c761
+   if (ARG4 != 0 && ARG5 == sizeof(vki_sigset_t) && ARG4 != 1) {
Mark Wielaard 71c761
+      VG_(free)((vki_sigset_t *) ARG4);
Mark Wielaard 71c761
+   }
Mark Wielaard 71c761
 }
Mark Wielaard 71c761
 
Mark Wielaard 71c761
 
Mark Wielaard 71c761
diff --git a/coregrind/m_syswrap/syswrap-main.c b/coregrind/m_syswrap/syswrap-main.c
Mark Wielaard 71c761
index 054891f..d854194 100644
Mark Wielaard 71c761
--- a/coregrind/m_syswrap/syswrap-main.c
Mark Wielaard 71c761
+++ b/coregrind/m_syswrap/syswrap-main.c
Mark Wielaard 71c761
@@ -1657,7 +1657,7 @@ static const SyscallTableEntry* get_syscall_entry ( Int syscallno )
Mark Wielaard 71c761
 /* Add and remove signals from mask so that we end up telling the
Mark Wielaard 71c761
    kernel the state we actually want rather than what the client
Mark Wielaard 71c761
    wants. */
Mark Wielaard 71c761
-static void sanitize_client_sigmask(vki_sigset_t *mask)
Mark Wielaard 71c761
+void VG_(sanitize_client_sigmask)(vki_sigset_t *mask)
Mark Wielaard 71c761
 {
Mark Wielaard 71c761
    VG_(sigdelset)(mask, VKI_SIGKILL);
Mark Wielaard 71c761
    VG_(sigdelset)(mask, VKI_SIGSTOP);
Mark Wielaard 71c761
@@ -1979,7 +1979,7 @@ void VG_(client_syscall) ( ThreadId tid, UInt trc )
Mark Wielaard 71c761
          PRINT(" --> [async] ... \n");
Mark Wielaard 71c761
 
Mark Wielaard 71c761
          mask = tst->sig_mask;
Mark Wielaard 71c761
-         sanitize_client_sigmask(&mask);
Mark Wielaard 71c761
+         VG_(sanitize_client_sigmask)(&mask);
Mark Wielaard 71c761
 
Mark Wielaard 71c761
          /* Gack.  More impedance matching.  Copy the possibly
Mark Wielaard 71c761
             modified syscall args back into the guest state. */
Mark Wielaard 71c761
diff --git a/coregrind/m_syswrap/syswrap-mips64-linux.c b/coregrind/m_syswrap/syswrap-mips64-linux.c
Mark Wielaard 71c761
index 12d147d..7c5fbdb 100644
Mark Wielaard 71c761
--- a/coregrind/m_syswrap/syswrap-mips64-linux.c
Mark Wielaard 71c761
+++ b/coregrind/m_syswrap/syswrap-mips64-linux.c
Mark Wielaard 71c761
@@ -889,7 +889,7 @@ static SyscallTableEntry syscall_main_table[] = {
Mark Wielaard 71c761
    LINX_ (__NR_readlinkat, sys_readlinkat),
Mark Wielaard 71c761
    LINX_ (__NR_fchmodat, sys_fchmodat),
Mark Wielaard 71c761
    LINX_ (__NR_faccessat, sys_faccessat),
Mark Wielaard 71c761
-   LINX_ (__NR_pselect6, sys_pselect6),
Mark Wielaard 71c761
+   LINXY (__NR_pselect6, sys_pselect6),
Mark Wielaard 71c761
    LINXY (__NR_ppoll, sys_ppoll),
Mark Wielaard 71c761
    PLAX_ (__NR_unshare, sys_unshare),
Mark Wielaard 71c761
    PLAX_ (__NR_splice, sys_splice),
Mark Wielaard 71c761
diff --git a/coregrind/m_syswrap/syswrap-ppc32-linux.c b/coregrind/m_syswrap/syswrap-ppc32-linux.c
Mark Wielaard 71c761
index 9ceaa15..379fcb3 100644
Mark Wielaard 71c761
--- a/coregrind/m_syswrap/syswrap-ppc32-linux.c
Mark Wielaard 71c761
+++ b/coregrind/m_syswrap/syswrap-ppc32-linux.c
Mark Wielaard 71c761
@@ -1194,7 +1194,7 @@ static SyscallTableEntry syscall_table[] = {
Mark Wielaard 71c761
    PLAXY(__NR_spu_run,            sys_spu_run),               // 278
Mark Wielaard 71c761
    PLAX_(__NR_spu_create,         sys_spu_create),            // 279
Mark Wielaard 71c761
 
Mark Wielaard 71c761
-   LINX_(__NR_pselect6,          sys_pselect6),          // 280
Mark Wielaard 71c761
+   LINXY(__NR_pselect6,          sys_pselect6),          // 280
Mark Wielaard 71c761
    LINXY(__NR_ppoll,             sys_ppoll),             // 281
Mark Wielaard 71c761
 
Mark Wielaard 71c761
    LINXY(__NR_openat,            sys_openat),            // 286
Mark Wielaard 71c761
diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c
Mark Wielaard 71c761
index 15b8979..77668c7 100644
Mark Wielaard 71c761
--- a/coregrind/m_syswrap/syswrap-ppc64-linux.c
Mark Wielaard 71c761
+++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c
Mark Wielaard 71c761
@@ -1110,7 +1110,7 @@ static SyscallTableEntry syscall_table[] = {
Mark Wielaard 71c761
    LINX_(__NR_inotify_add_watch,  sys_inotify_add_watch), // 276
Mark Wielaard 71c761
    LINX_(__NR_inotify_rm_watch,   sys_inotify_rm_watch),  // 277
Mark Wielaard 71c761
 
Mark Wielaard 71c761
-   LINX_(__NR_pselect6,          sys_pselect6),           // 280
Mark Wielaard 71c761
+   LINXY(__NR_pselect6,          sys_pselect6),           // 280
Mark Wielaard 71c761
    LINXY(__NR_ppoll,             sys_ppoll),              // 281
Mark Wielaard 71c761
 
Mark Wielaard 71c761
    LINXY(__NR_openat,            sys_openat),             // 286
Mark Wielaard 71c761
diff --git a/coregrind/m_syswrap/syswrap-s390x-linux.c b/coregrind/m_syswrap/syswrap-s390x-linux.c
Mark Wielaard 71c761
index 0513789..107a569 100644
Mark Wielaard 71c761
--- a/coregrind/m_syswrap/syswrap-s390x-linux.c
Mark Wielaard 71c761
+++ b/coregrind/m_syswrap/syswrap-s390x-linux.c
Mark Wielaard 71c761
@@ -992,7 +992,7 @@ static SyscallTableEntry syscall_table[] = {
Mark Wielaard 71c761
    LINX_(__NR_fchmodat,  sys_fchmodat),                               // 299
Mark Wielaard 71c761
 
Mark Wielaard 71c761
    LINX_(__NR_faccessat,  sys_faccessat),                             // 300
Mark Wielaard 71c761
-   LINX_(__NR_pselect6, sys_pselect6),                                // 301
Mark Wielaard 71c761
+   LINXY(__NR_pselect6, sys_pselect6),                                // 301
Mark Wielaard 71c761
    LINXY(__NR_ppoll, sys_ppoll),                                      // 302
Mark Wielaard 71c761
    LINX_(__NR_unshare, sys_unshare),                                  // 303
Mark Wielaard 71c761
    LINX_(__NR_set_robust_list,  sys_set_robust_list),                 // 304
Mark Wielaard 71c761
diff --git a/coregrind/m_syswrap/syswrap-solaris.c b/coregrind/m_syswrap/syswrap-solaris.c
Mark Wielaard 71c761
index 7ac876f..a307f6c 100644
Mark Wielaard 71c761
--- a/coregrind/m_syswrap/syswrap-solaris.c
Mark Wielaard 71c761
+++ b/coregrind/m_syswrap/syswrap-solaris.c
Mark Wielaard 71c761
@@ -71,6 +71,7 @@
Mark Wielaard 71c761
 
Mark Wielaard 71c761
 #include "priv_types_n_macros.h"
Mark Wielaard 71c761
 #include "priv_syswrap-generic.h"
Mark Wielaard 71c761
+#include "priv_syswrap-main.h"
Mark Wielaard 71c761
 #include "priv_syswrap-solaris.h"
Mark Wielaard 71c761
 
Mark Wielaard 71c761
 /* Return the number of non-dead and daemon threads.
Mark Wielaard 71c761
@@ -7327,7 +7328,7 @@ PRE(sys_pollsys)
Mark Wielaard 71c761
    UWord i;
Mark Wielaard 71c761
    struct vki_pollfd *ufds = (struct vki_pollfd *)ARG1;
Mark Wielaard 71c761
 
Mark Wielaard 71c761
-   *flags |= SfMayBlock;
Mark Wielaard 71c761
+   *flags |= SfMayBlock | SfPostOnFail;
Mark Wielaard 71c761
 
Mark Wielaard 71c761
    PRINT("sys_pollsys ( %#lx, %lu, %#lx, %#lx )", ARG1, ARG2, ARG3, ARG4);
Mark Wielaard 71c761
    PRE_REG_READ4(long, "poll", pollfd_t *, fds, vki_nfds_t, nfds,
Mark Wielaard 71c761
@@ -7343,18 +7344,37 @@ PRE(sys_pollsys)
Mark Wielaard 71c761
 
Mark Wielaard 71c761
    if (ARG3)
Mark Wielaard 71c761
       PRE_MEM_READ("poll(timeout)", ARG3, sizeof(vki_timespec_t));
Mark Wielaard 71c761
-   if (ARG4)
Mark Wielaard 71c761
+
Mark Wielaard 71c761
+   if (ARG4) {
Mark Wielaard 71c761
       PRE_MEM_READ("poll(set)", ARG4, sizeof(vki_sigset_t));
Mark Wielaard 71c761
+
Mark Wielaard 71c761
+      const vki_sigset_t *guest_sigmask = (vki_sigset_t *) ARG4;
Mark Wielaard 71c761
+      if (!ML_(safe_to_deref)(guest_sigmask, sizeof(vki_sigset_t))) {
Mark Wielaard 71c761
+         ARG4 = 1; /* Something recognisable to POST() hook. */
Mark Wielaard 71c761
+      } else {
Mark Wielaard 71c761
+         vki_sigset_t *vg_sigmask =
Mark Wielaard 71c761
+            VG_(malloc)("syswrap.pollsys.1", sizeof(vki_sigset_t));
Mark Wielaard 71c761
+         ARG4 = (Addr) vg_sigmask;
Mark Wielaard 71c761
+         *vg_sigmask = *guest_sigmask;
Mark Wielaard 71c761
+         VG_(sanitize_client_sigmask)(vg_sigmask);
Mark Wielaard 71c761
+      }
Mark Wielaard 71c761
+   }
Mark Wielaard 71c761
 }
Mark Wielaard 71c761
 
Mark Wielaard 71c761
 POST(sys_pollsys)
Mark Wielaard 71c761
 {
Mark Wielaard 71c761
-   if (RES >= 0) {
Mark Wielaard 71c761
+   vg_assert(SUCCESS || FAILURE);
Mark Wielaard 71c761
+
Mark Wielaard 71c761
+   if (SUCCESS && (RES >= 0)) {
Mark Wielaard 71c761
       UWord i;
Mark Wielaard 71c761
       vki_pollfd_t *ufds = (vki_pollfd_t*)ARG1;
Mark Wielaard 71c761
       for (i = 0; i < ARG2; i++)
Mark Wielaard 71c761
          POST_FIELD_WRITE(ufds[i].revents);
Mark Wielaard 71c761
    }
Mark Wielaard 71c761
+
Mark Wielaard 71c761
+   if ((ARG4 != 0) && (ARG4 != 1)) {
Mark Wielaard 71c761
+      VG_(free)((vki_sigset_t *) ARG4);
Mark Wielaard 71c761
+   }
Mark Wielaard 71c761
 }
Mark Wielaard 71c761
 
Mark Wielaard 71c761
 PRE(sys_labelsys)
Mark Wielaard 71c761
diff --git a/coregrind/m_syswrap/syswrap-tilegx-linux.c b/coregrind/m_syswrap/syswrap-tilegx-linux.c
Mark Wielaard 71c761
index aceceb4..4845f79 100644
Mark Wielaard 71c761
--- a/coregrind/m_syswrap/syswrap-tilegx-linux.c
Mark Wielaard 71c761
+++ b/coregrind/m_syswrap/syswrap-tilegx-linux.c
Mark Wielaard 71c761
@@ -1202,7 +1202,7 @@ static SyscallTableEntry syscall_table[] = {
Mark Wielaard 71c761
   LINXY(__NR_preadv,            sys_preadv),               // 69
Mark Wielaard 71c761
   LINX_(__NR_pwritev,           sys_pwritev),              // 70
Mark Wielaard 71c761
   LINXY(__NR_sendfile,          sys_sendfile),             // 71
Mark Wielaard 71c761
-  LINX_(__NR_pselect6,          sys_pselect6),             // 72
Mark Wielaard 71c761
+  LINXY(__NR_pselect6,          sys_pselect6),             // 72
Mark Wielaard 71c761
   LINXY(__NR_ppoll,             sys_ppoll),                // 73
Mark Wielaard 71c761
   LINXY(__NR_signalfd4,         sys_signalfd4),            // 74
Mark Wielaard 71c761
   LINX_(__NR_splice,            sys_splice),               // 75
Mark Wielaard 71c761
diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c
Mark Wielaard 71c761
index 3c80e6a..f1f97d7 100644
Mark Wielaard 71c761
--- a/coregrind/m_syswrap/syswrap-x86-linux.c
Mark Wielaard 71c761
+++ b/coregrind/m_syswrap/syswrap-x86-linux.c
Mark Wielaard 71c761
@@ -1766,7 +1766,7 @@ static SyscallTableEntry syscall_table[] = {
Mark Wielaard 71c761
    LINX_(__NR_readlinkat,	 sys_readlinkat),       // 305
Mark Wielaard 71c761
    LINX_(__NR_fchmodat,		 sys_fchmodat),         // 306
Mark Wielaard 71c761
    LINX_(__NR_faccessat,	 sys_faccessat),        // 307
Mark Wielaard 71c761
-   LINX_(__NR_pselect6,		 sys_pselect6),         // 308
Mark Wielaard 71c761
+   LINXY(__NR_pselect6,		 sys_pselect6),         // 308
Mark Wielaard 71c761
    LINXY(__NR_ppoll,		 sys_ppoll),            // 309
Mark Wielaard 71c761
 
Mark Wielaard 71c761
    LINX_(__NR_unshare,		 sys_unshare),          // 310
Mark Wielaard 71c761
diff --git a/none/tests/Makefile.am b/none/tests/Makefile.am
Mark Wielaard 71c761
index 7eb2bf8..5d8e942 100644
Mark Wielaard 71c761
--- a/none/tests/Makefile.am
Mark Wielaard 71c761
+++ b/none/tests/Makefile.am
Mark Wielaard 71c761
@@ -142,12 +142,14 @@ EXTRA_DIST = \
Mark Wielaard 71c761
 	nestedfns.stderr.exp nestedfns.stdout.exp nestedfns.vgtest \
Mark Wielaard 71c761
 	nodir.stderr.exp nodir.vgtest \
Mark Wielaard 71c761
 	pending.stdout.exp pending.stderr.exp pending.vgtest \
Mark Wielaard 71c761
+	ppoll_alarm.stdout.exp ppoll_alarm.stderr.exp ppoll_alarm.vgtest \
Mark Wielaard 71c761
 	procfs-linux.stderr.exp-with-readlinkat \
Mark Wielaard 71c761
 	procfs-linux.stderr.exp-without-readlinkat \
Mark Wielaard 71c761
 	procfs-linux.vgtest \
Mark Wielaard 71c761
 	procfs-non-linux.vgtest \
Mark Wielaard 71c761
 	procfs-non-linux.stderr.exp-with-readlinkat \
Mark Wielaard 71c761
 	procfs-non-linux.stderr.exp-without-readlinkat \
Mark Wielaard 71c761
+	pselect_alarm.stdout.exp pselect_alarm.stderr.exp pselect_alarm.vgtest \
Mark Wielaard 71c761
 	pth_atfork1.stderr.exp pth_atfork1.stdout.exp pth_atfork1.vgtest \
Mark Wielaard 71c761
 	pth_blockedsig.stderr.exp \
Mark Wielaard 71c761
 	pth_blockedsig.stdout.exp pth_blockedsig.vgtest \
Mark Wielaard 71c761
@@ -215,7 +217,9 @@ check_PROGRAMS = \
Mark Wielaard 71c761
 	mmap_fcntl_bug \
Mark Wielaard 71c761
 	munmap_exe map_unaligned map_unmap mq \
Mark Wielaard 71c761
 	pending \
Mark Wielaard 71c761
+	ppoll_alarm \
Mark Wielaard 71c761
 	procfs-cmdline-exe \
Mark Wielaard 71c761
+	pselect_alarm \
Mark Wielaard 71c761
 	pth_atfork1 pth_blockedsig pth_cancel1 pth_cancel2 pth_cvsimple \
Mark Wielaard 71c761
 	pth_empty pth_exit pth_exit2 pth_mutexspeed pth_once pth_rwlock \
Mark Wielaard 71c761
 	pth_stackalign \
Mark Wielaard 71c761
@@ -289,6 +293,8 @@ libvexmultiarch_test_LDADD = \
Mark Wielaard 71c761
 	../../VEX/libvexmultiarch-@VGCONF_ARCH_PRI@-@VGCONF_OS@.a \
Mark Wielaard 71c761
 	../../VEX/libvex-@VGCONF_ARCH_PRI@-@VGCONF_OS@.a @LIB_UBSAN@
Mark Wielaard 71c761
 libvexmultiarch_test_SOURCES = libvex_test.c
Mark Wielaard 71c761
+ppoll_alarm_LDADD	= -lpthread
Mark Wielaard 71c761
+pselect_alarm_LDADD	= -lpthread
Mark Wielaard 71c761
 pth_atfork1_LDADD	= -lpthread
Mark Wielaard 71c761
 pth_blockedsig_LDADD	= -lpthread
Mark Wielaard 71c761
 pth_cancel1_CFLAGS	= $(AM_CFLAGS) -Wno-shadow
Mark Wielaard 71c761
diff --git a/none/tests/ppoll_alarm.c b/none/tests/ppoll_alarm.c
Mark Wielaard 71c761
new file mode 100644
Mark Wielaard 71c761
index 0000000..1b1794b
Mark Wielaard 71c761
--- /dev/null
Mark Wielaard 71c761
+++ b/none/tests/ppoll_alarm.c
Mark Wielaard 71c761
@@ -0,0 +1,55 @@
Mark Wielaard 71c761
+/* Tries to exploit bug in ppoll mask handling:
Mark Wielaard 71c761
+   https://bugs.kde.org/show_bug.cgi?id=359871
Mark Wielaard 71c761
+   where client program was able to successfully block VG_SIGVGKILL. */
Mark Wielaard 71c761
+
Mark Wielaard 71c761
+#define _GNU_SOURCE /* for ppoll */
Mark Wielaard 71c761
+#include <poll.h>
Mark Wielaard 71c761
+#include <pthread.h>
Mark Wielaard 71c761
+#include <signal.h>
Mark Wielaard 71c761
+#include <stdio.h>
Mark Wielaard 71c761
+#include <unistd.h>
Mark Wielaard 71c761
+
Mark Wielaard 71c761
+static int ready = 0;
Mark Wielaard 71c761
+static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
Mark Wielaard 71c761
+static pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
Mark Wielaard 71c761
+
Mark Wielaard 71c761
+static void *
Mark Wielaard 71c761
+mythr(void *ignore)
Mark Wielaard 71c761
+{
Mark Wielaard 71c761
+    pthread_mutex_lock(&mutex);
Mark Wielaard 71c761
+    ready = 1;
Mark Wielaard 71c761
+    pthread_cond_signal(&cond;;
Mark Wielaard 71c761
+    pthread_mutex_unlock(&mutex);
Mark Wielaard 71c761
+
Mark Wielaard 71c761
+    sigset_t ss;
Mark Wielaard 71c761
+    sigfillset(&ss);
Mark Wielaard 71c761
+    while (1) {
Mark Wielaard 71c761
+        struct timespec ts = {10000, 0};
Mark Wielaard 71c761
+        ppoll(NULL, 0, &ts, &ss);
Mark Wielaard 71c761
+    }
Mark Wielaard 71c761
+
Mark Wielaard 71c761
+    return NULL;
Mark Wielaard 71c761
+}
Mark Wielaard 71c761
+
Mark Wielaard 71c761
+int
Mark Wielaard 71c761
+main()
Mark Wielaard 71c761
+{
Mark Wielaard 71c761
+    pthread_t thr;
Mark Wielaard 71c761
+    int ret = pthread_create(&thr, NULL, mythr, NULL);
Mark Wielaard 71c761
+    if (ret != 0) {
Mark Wielaard 71c761
+        fprintf(stderr, "pthread_create failed\n");
Mark Wielaard 71c761
+        return 1;
Mark Wielaard 71c761
+    }
Mark Wielaard 71c761
+
Mark Wielaard 71c761
+    pthread_mutex_lock(&mutex);
Mark Wielaard 71c761
+    while (ready == 0) {
Mark Wielaard 71c761
+        pthread_cond_wait(&cond, &mutex);
Mark Wielaard 71c761
+    }
Mark Wielaard 71c761
+    pthread_mutex_unlock(&mutex);
Mark Wielaard 71c761
+
Mark Wielaard 71c761
+    alarm(1); /* Unhandled SIGALRM should cause exit. */
Mark Wielaard 71c761
+    while (1)
Mark Wielaard 71c761
+        sleep(1);
Mark Wielaard 71c761
+
Mark Wielaard 71c761
+    return 0;
Mark Wielaard 71c761
+}
Mark Wielaard 71c761
diff --git a/none/tests/ppoll_alarm.stderr.exp b/none/tests/ppoll_alarm.stderr.exp
Mark Wielaard 71c761
new file mode 100644
Mark Wielaard 71c761
index 0000000..e69de29
Mark Wielaard 71c761
diff --git a/none/tests/ppoll_alarm.stdout.exp b/none/tests/ppoll_alarm.stdout.exp
Mark Wielaard 71c761
new file mode 100644
Mark Wielaard 71c761
index 0000000..e69de29
Mark Wielaard 71c761
diff --git a/none/tests/ppoll_alarm.vgtest b/none/tests/ppoll_alarm.vgtest
Mark Wielaard 71c761
new file mode 100644
Mark Wielaard 71c761
index 0000000..b1309d3
Mark Wielaard 71c761
--- /dev/null
Mark Wielaard 71c761
+++ b/none/tests/ppoll_alarm.vgtest
Mark Wielaard 71c761
@@ -0,0 +1,3 @@
Mark Wielaard 71c761
+prog: ppoll_alarm
Mark Wielaard 71c761
+vgopts: -q
Mark Wielaard 71c761
+stderr_filter: filter_stderr
Mark Wielaard 71c761
diff --git a/none/tests/pselect_alarm.c b/none/tests/pselect_alarm.c
Mark Wielaard 71c761
new file mode 100644
Mark Wielaard 71c761
index 0000000..7a68ec0
Mark Wielaard 71c761
--- /dev/null
Mark Wielaard 71c761
+++ b/none/tests/pselect_alarm.c
Mark Wielaard 71c761
@@ -0,0 +1,61 @@
Mark Wielaard 71c761
+/* Tries to exploit bug in pselect mask handling:
Mark Wielaard 71c761
+   https://bugs.kde.org/show_bug.cgi?id=359871
Mark Wielaard 71c761
+   where client program was able to successfully block VG_SIGVGKILL. */
Mark Wielaard 71c761
+
Mark Wielaard 71c761
+#include <sys/select.h>
Mark Wielaard 71c761
+#include <assert.h>
Mark Wielaard 71c761
+#include <errno.h>
Mark Wielaard 71c761
+#include <pthread.h>
Mark Wielaard 71c761
+#include <signal.h>
Mark Wielaard 71c761
+#include <stdio.h>
Mark Wielaard 71c761
+#include <unistd.h>
Mark Wielaard 71c761
+
Mark Wielaard 71c761
+static int ready = 0;
Mark Wielaard 71c761
+static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
Mark Wielaard 71c761
+static pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
Mark Wielaard 71c761
+
Mark Wielaard 71c761
+static void *
Mark Wielaard 71c761
+mythr(void *ignore)
Mark Wielaard 71c761
+{
Mark Wielaard 71c761
+    pthread_mutex_lock(&mutex);
Mark Wielaard 71c761
+    ready = 1;
Mark Wielaard 71c761
+    pthread_cond_signal(&cond;;
Mark Wielaard 71c761
+    pthread_mutex_unlock(&mutex);
Mark Wielaard 71c761
+
Mark Wielaard 71c761
+    sigset_t ss;
Mark Wielaard 71c761
+    sigfillset(&ss);
Mark Wielaard 71c761
+    while (1) {
Mark Wielaard 71c761
+        struct timespec ts = {10000, 0};
Mark Wielaard 71c761
+        pselect(0, NULL, NULL, NULL, &ts, &ss);
Mark Wielaard 71c761
+    }
Mark Wielaard 71c761
+
Mark Wielaard 71c761
+    return NULL;
Mark Wielaard 71c761
+}
Mark Wielaard 71c761
+
Mark Wielaard 71c761
+int
Mark Wielaard 71c761
+main()
Mark Wielaard 71c761
+{
Mark Wielaard 71c761
+    pthread_t thr;
Mark Wielaard 71c761
+    int ret = pthread_create(&thr, NULL, mythr, NULL);
Mark Wielaard 71c761
+    if (ret != 0) {
Mark Wielaard 71c761
+        fprintf(stderr, "pthread_create failed\n");
Mark Wielaard 71c761
+        return 1;
Mark Wielaard 71c761
+    }
Mark Wielaard 71c761
+
Mark Wielaard 71c761
+    pthread_mutex_lock(&mutex);
Mark Wielaard 71c761
+    while (ready == 0) {
Mark Wielaard 71c761
+        pthread_cond_wait(&cond, &mutex);
Mark Wielaard 71c761
+    }
Mark Wielaard 71c761
+    pthread_mutex_unlock(&mutex);
Mark Wielaard 71c761
+
Mark Wielaard 71c761
+#if defined(VGO_linux)
Mark Wielaard 71c761
+    assert(pselect(0, NULL, NULL, NULL, NULL, (sigset_t *)12) == -1);
Mark Wielaard 71c761
+    assert(errno == EFAULT);
Mark Wielaard 71c761
+#endif
Mark Wielaard 71c761
+
Mark Wielaard 71c761
+    alarm(1); /* Unhandled SIGALRM should cause exit. */
Mark Wielaard 71c761
+    while (1)
Mark Wielaard 71c761
+        sleep(1);
Mark Wielaard 71c761
+
Mark Wielaard 71c761
+    return 0;
Mark Wielaard 71c761
+}
Mark Wielaard 71c761
diff --git a/none/tests/pselect_alarm.stderr.exp b/none/tests/pselect_alarm.stderr.exp
Mark Wielaard 71c761
new file mode 100644
Mark Wielaard 71c761
index 0000000..e69de29
Mark Wielaard 71c761
diff --git a/none/tests/pselect_alarm.stdout.exp b/none/tests/pselect_alarm.stdout.exp
Mark Wielaard 71c761
new file mode 100644
Mark Wielaard 71c761
index 0000000..e69de29
Mark Wielaard 71c761
diff --git a/none/tests/pselect_alarm.vgtest b/none/tests/pselect_alarm.vgtest
Mark Wielaard 71c761
new file mode 100644
Mark Wielaard 71c761
index 0000000..84cc674
Mark Wielaard 71c761
--- /dev/null
Mark Wielaard 71c761
+++ b/none/tests/pselect_alarm.vgtest
Mark Wielaard 71c761
@@ -0,0 +1,3 @@
Mark Wielaard 71c761
+prog: pselect_alarm
Mark Wielaard 71c761
+vgopts: -q
Mark Wielaard 71c761
+stderr_filter: filter_stderr
Mark Wielaard 71c761
diff --git a/tests/filter_stderr_basic b/tests/filter_stderr_basic
Mark Wielaard 71c761
index 472cd8f..4b6e480 100755
Mark Wielaard 71c761
--- a/tests/filter_stderr_basic
Mark Wielaard 71c761
+++ b/tests/filter_stderr_basic
Mark Wielaard 71c761
@@ -46,7 +46,7 @@ sed "/warning: line info addresses out of order/d" |
Mark Wielaard 71c761
 # of the bash process. Newer bash versions redirect such messages properly.
Mark Wielaard 71c761
 # Suppress any redirected abnormal termination messages. You can find the
Mark Wielaard 71c761
 # complete list of messages in the bash source file siglist.c.
Mark Wielaard 71c761
-perl -n -e 'print if !/^(Segmentation fault|Alarm clock|Aborted|Bus error)( \(core dumped\))?$/' |
Mark Wielaard 71c761
+perl -n -e 'print if !/^(Segmentation fault|Alarm clock|Aborted|Bus error|Killed)( \(core dumped\))?$/' |
Mark Wielaard 71c761
 
Mark Wielaard 71c761
 # Similar as above, but for ksh on Solaris/illumos.
Mark Wielaard 71c761
 perl -n -e 'print if !/^(Memory fault|Killed) $/' |
Mark Wielaard 71c761
Only in valgrind-3.11.0: autom4te.cache
Mark Wielaard 71c761
diff -ru valgrind-3.11.0.orig/none/tests/Makefile.in valgrind-3.11.0/none/tests/Makefile.in
Mark Wielaard 71c761
--- valgrind-3.11.0.orig/none/tests/Makefile.in	2016-03-09 20:07:53.451112914 +0100
Mark Wielaard 71c761
+++ valgrind-3.11.0/none/tests/Makefile.in	2016-03-09 20:09:44.281584703 +0100
Mark Wielaard 71c761
@@ -151,7 +151,8 @@
Mark Wielaard 71c761
 	libvexmultiarch_test$(EXEEXT) manythreads$(EXEEXT) \
Mark Wielaard 71c761
 	mmap_fcntl_bug$(EXEEXT) munmap_exe$(EXEEXT) \
Mark Wielaard 71c761
 	map_unaligned$(EXEEXT) map_unmap$(EXEEXT) mq$(EXEEXT) \
Mark Wielaard 71c761
-	pending$(EXEEXT) procfs-cmdline-exe$(EXEEXT) \
Mark Wielaard 71c761
+	pending$(EXEEXT) ppoll_alarm$(EXEEXT) \
Mark Wielaard 71c761
+	procfs-cmdline-exe$(EXEEXT) pselect_alarm$(EXEEXT) \
Mark Wielaard 71c761
 	pth_atfork1$(EXEEXT) pth_blockedsig$(EXEEXT) \
Mark Wielaard 71c761
 	pth_cancel1$(EXEEXT) pth_cancel2$(EXEEXT) \
Mark Wielaard 71c761
 	pth_cvsimple$(EXEEXT) pth_empty$(EXEEXT) pth_exit$(EXEEXT) \
Mark Wielaard 71c761
@@ -329,12 +330,18 @@
Mark Wielaard 71c761
 pending_SOURCES = pending.c
Mark Wielaard 71c761
 pending_OBJECTS = pending.$(OBJEXT)
Mark Wielaard 71c761
 pending_LDADD = $(LDADD)
Mark Wielaard 71c761
+ppoll_alarm_SOURCES = ppoll_alarm.c
Mark Wielaard 71c761
+ppoll_alarm_OBJECTS = ppoll_alarm.$(OBJEXT)
Mark Wielaard 71c761
+ppoll_alarm_DEPENDENCIES =
Mark Wielaard 71c761
 process_vm_readv_writev_SOURCES = process_vm_readv_writev.c
Mark Wielaard 71c761
 process_vm_readv_writev_OBJECTS = process_vm_readv_writev.$(OBJEXT)
Mark Wielaard 71c761
 process_vm_readv_writev_LDADD = $(LDADD)
Mark Wielaard 71c761
 procfs_cmdline_exe_SOURCES = procfs-cmdline-exe.c
Mark Wielaard 71c761
 procfs_cmdline_exe_OBJECTS = procfs-cmdline-exe.$(OBJEXT)
Mark Wielaard 71c761
 procfs_cmdline_exe_LDADD = $(LDADD)
Mark Wielaard 71c761
+pselect_alarm_SOURCES = pselect_alarm.c
Mark Wielaard 71c761
+pselect_alarm_OBJECTS = pselect_alarm.$(OBJEXT)
Mark Wielaard 71c761
+pselect_alarm_DEPENDENCIES =
Mark Wielaard 71c761
 pth_atfork1_SOURCES = pth_atfork1.c
Mark Wielaard 71c761
 pth_atfork1_OBJECTS = pth_atfork1.$(OBJEXT)
Mark Wielaard 71c761
 pth_atfork1_DEPENDENCIES =
Mark Wielaard 71c761
@@ -527,18 +534,18 @@
Mark Wielaard 71c761
 	$(gxx304_SOURCES) ifunc.c ioctl_moans.c libvex_test.c \
Mark Wielaard 71c761
 	$(libvexmultiarch_test_SOURCES) manythreads.c map_unaligned.c \
Mark Wielaard 71c761
 	map_unmap.c mmap_fcntl_bug.c mq.c munmap_exe.c nestedfns.c \
Mark Wielaard 71c761
-	pending.c process_vm_readv_writev.c procfs-cmdline-exe.c \
Mark Wielaard 71c761
-	pth_atfork1.c pth_blockedsig.c pth_cancel1.c pth_cancel2.c \
Mark Wielaard 71c761
-	pth_cvsimple.c pth_empty.c pth_exit.c pth_exit2.c \
Mark Wielaard 71c761
-	pth_mutexspeed.c pth_once.c pth_rwlock.c pth_stackalign.c \
Mark Wielaard 71c761
-	rcrl.c readline1.c require-text-symbol.c res_search.c resolv.c \
Mark Wielaard 71c761
-	rlimit64_nofile.c rlimit_nofile.c selfrun.c sem.c semlimit.c \
Mark Wielaard 71c761
-	sha1_test.c shortpush.c shorts.c sigstackgrowth.c \
Mark Wielaard 71c761
-	stackgrowth.c syscall-restart1.c syscall-restart2.c syslog.c \
Mark Wielaard 71c761
-	system.c thread-exits.c threaded-fork.c threadederrno.c \
Mark Wielaard 71c761
-	timestamp.c $(tls_SOURCES) $(tls_so_SOURCES) \
Mark Wielaard 71c761
-	$(tls2_so_SOURCES) unit_debuglog.c \
Mark Wielaard 71c761
-	$(valgrind_cpp_test_SOURCES) vgprintf.c
Mark Wielaard 71c761
+	pending.c ppoll_alarm.c process_vm_readv_writev.c \
Mark Wielaard 71c761
+	procfs-cmdline-exe.c pselect_alarm.c pth_atfork1.c \
Mark Wielaard 71c761
+	pth_blockedsig.c pth_cancel1.c pth_cancel2.c pth_cvsimple.c \
Mark Wielaard 71c761
+	pth_empty.c pth_exit.c pth_exit2.c pth_mutexspeed.c pth_once.c \
Mark Wielaard 71c761
+	pth_rwlock.c pth_stackalign.c rcrl.c readline1.c \
Mark Wielaard 71c761
+	require-text-symbol.c res_search.c resolv.c rlimit64_nofile.c \
Mark Wielaard 71c761
+	rlimit_nofile.c selfrun.c sem.c semlimit.c sha1_test.c \
Mark Wielaard 71c761
+	shortpush.c shorts.c sigstackgrowth.c stackgrowth.c \
Mark Wielaard 71c761
+	syscall-restart1.c syscall-restart2.c syslog.c system.c \
Mark Wielaard 71c761
+	thread-exits.c threaded-fork.c threadederrno.c timestamp.c \
Mark Wielaard 71c761
+	$(tls_SOURCES) $(tls_so_SOURCES) $(tls2_so_SOURCES) \
Mark Wielaard 71c761
+	unit_debuglog.c $(valgrind_cpp_test_SOURCES) vgprintf.c
Mark Wielaard 71c761
 DIST_SOURCES = ansi.c args.c async-sigs.c bitfield1.c bug129866.c \
Mark Wielaard 71c761
 	bug234814.c closeall.c $(coolo_sigaction_SOURCES) \
Mark Wielaard 71c761
 	coolo_strlen.c discard.c exec-sigmask.c execve.c faultstatus.c \
Mark Wielaard 71c761
@@ -548,18 +555,18 @@
Mark Wielaard 71c761
 	$(gxx304_SOURCES) ifunc.c ioctl_moans.c libvex_test.c \
Mark Wielaard 71c761
 	$(libvexmultiarch_test_SOURCES) manythreads.c map_unaligned.c \
Mark Wielaard 71c761
 	map_unmap.c mmap_fcntl_bug.c mq.c munmap_exe.c nestedfns.c \
Mark Wielaard 71c761
-	pending.c process_vm_readv_writev.c procfs-cmdline-exe.c \
Mark Wielaard 71c761
-	pth_atfork1.c pth_blockedsig.c pth_cancel1.c pth_cancel2.c \
Mark Wielaard 71c761
-	pth_cvsimple.c pth_empty.c pth_exit.c pth_exit2.c \
Mark Wielaard 71c761
-	pth_mutexspeed.c pth_once.c pth_rwlock.c pth_stackalign.c \
Mark Wielaard 71c761
-	rcrl.c readline1.c require-text-symbol.c res_search.c resolv.c \
Mark Wielaard 71c761
-	rlimit64_nofile.c rlimit_nofile.c selfrun.c sem.c semlimit.c \
Mark Wielaard 71c761
-	sha1_test.c shortpush.c shorts.c sigstackgrowth.c \
Mark Wielaard 71c761
-	stackgrowth.c syscall-restart1.c syscall-restart2.c syslog.c \
Mark Wielaard 71c761
-	system.c thread-exits.c threaded-fork.c threadederrno.c \
Mark Wielaard 71c761
-	timestamp.c $(tls_SOURCES) $(tls_so_SOURCES) \
Mark Wielaard 71c761
-	$(tls2_so_SOURCES) unit_debuglog.c \
Mark Wielaard 71c761
-	$(valgrind_cpp_test_SOURCES) vgprintf.c
Mark Wielaard 71c761
+	pending.c ppoll_alarm.c process_vm_readv_writev.c \
Mark Wielaard 71c761
+	procfs-cmdline-exe.c pselect_alarm.c pth_atfork1.c \
Mark Wielaard 71c761
+	pth_blockedsig.c pth_cancel1.c pth_cancel2.c pth_cvsimple.c \
Mark Wielaard 71c761
+	pth_empty.c pth_exit.c pth_exit2.c pth_mutexspeed.c pth_once.c \
Mark Wielaard 71c761
+	pth_rwlock.c pth_stackalign.c rcrl.c readline1.c \
Mark Wielaard 71c761
+	require-text-symbol.c res_search.c resolv.c rlimit64_nofile.c \
Mark Wielaard 71c761
+	rlimit_nofile.c selfrun.c sem.c semlimit.c sha1_test.c \
Mark Wielaard 71c761
+	shortpush.c shorts.c sigstackgrowth.c stackgrowth.c \
Mark Wielaard 71c761
+	syscall-restart1.c syscall-restart2.c syslog.c system.c \
Mark Wielaard 71c761
+	thread-exits.c threaded-fork.c threadederrno.c timestamp.c \
Mark Wielaard 71c761
+	$(tls_SOURCES) $(tls_so_SOURCES) $(tls2_so_SOURCES) \
Mark Wielaard 71c761
+	unit_debuglog.c $(valgrind_cpp_test_SOURCES) vgprintf.c
Mark Wielaard 71c761
 RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
Mark Wielaard 71c761
 	ctags-recursive dvi-recursive html-recursive info-recursive \
Mark Wielaard 71c761
 	install-data-recursive install-dvi-recursive \
Mark Wielaard 71c761
@@ -1072,12 +1079,14 @@
Mark Wielaard 71c761
 	nestedfns.stderr.exp nestedfns.stdout.exp nestedfns.vgtest \
Mark Wielaard 71c761
 	nodir.stderr.exp nodir.vgtest \
Mark Wielaard 71c761
 	pending.stdout.exp pending.stderr.exp pending.vgtest \
Mark Wielaard 71c761
+	ppoll_alarm.stdout.exp ppoll_alarm.stderr.exp ppoll_alarm.vgtest \
Mark Wielaard 71c761
 	procfs-linux.stderr.exp-with-readlinkat \
Mark Wielaard 71c761
 	procfs-linux.stderr.exp-without-readlinkat \
Mark Wielaard 71c761
 	procfs-linux.vgtest \
Mark Wielaard 71c761
 	procfs-non-linux.vgtest \
Mark Wielaard 71c761
 	procfs-non-linux.stderr.exp-with-readlinkat \
Mark Wielaard 71c761
 	procfs-non-linux.stderr.exp-without-readlinkat \
Mark Wielaard 71c761
+	pselect_alarm.stdout.exp pselect_alarm.stderr.exp pselect_alarm.vgtest \
Mark Wielaard 71c761
 	pth_atfork1.stderr.exp pth_atfork1.stdout.exp pth_atfork1.vgtest \
Mark Wielaard 71c761
 	pth_blockedsig.stderr.exp \
Mark Wielaard 71c761
 	pth_blockedsig.stdout.exp pth_blockedsig.vgtest \
Mark Wielaard 71c761
@@ -1152,6 +1161,8 @@
Mark Wielaard 71c761
 	../../VEX/libvex-@VGCONF_ARCH_PRI@-@VGCONF_OS@.a @LIB_UBSAN@
Mark Wielaard 71c761
 
Mark Wielaard 71c761
 libvexmultiarch_test_SOURCES = libvex_test.c
Mark Wielaard 71c761
+ppoll_alarm_LDADD = -lpthread
Mark Wielaard 71c761
+pselect_alarm_LDADD = -lpthread
Mark Wielaard 71c761
 pth_atfork1_LDADD = -lpthread
Mark Wielaard 71c761
 pth_blockedsig_LDADD = -lpthread
Mark Wielaard 71c761
 pth_cancel1_CFLAGS = $(AM_CFLAGS) -Wno-shadow
Mark Wielaard 71c761
@@ -1390,6 +1401,10 @@
Mark Wielaard 71c761
 	@rm -f pending$(EXEEXT)
Mark Wielaard 71c761
 	$(AM_V_CCLD)$(LINK) $(pending_OBJECTS) $(pending_LDADD) $(LIBS)
Mark Wielaard 71c761
 
Mark Wielaard 71c761
+ppoll_alarm$(EXEEXT): $(ppoll_alarm_OBJECTS) $(ppoll_alarm_DEPENDENCIES) $(EXTRA_ppoll_alarm_DEPENDENCIES) 
Mark Wielaard 71c761
+	@rm -f ppoll_alarm$(EXEEXT)
Mark Wielaard 71c761
+	$(AM_V_CCLD)$(LINK) $(ppoll_alarm_OBJECTS) $(ppoll_alarm_LDADD) $(LIBS)
Mark Wielaard 71c761
+
Mark Wielaard 71c761
 process_vm_readv_writev$(EXEEXT): $(process_vm_readv_writev_OBJECTS) $(process_vm_readv_writev_DEPENDENCIES) $(EXTRA_process_vm_readv_writev_DEPENDENCIES) 
Mark Wielaard 71c761
 	@rm -f process_vm_readv_writev$(EXEEXT)
Mark Wielaard 71c761
 	$(AM_V_CCLD)$(LINK) $(process_vm_readv_writev_OBJECTS) $(process_vm_readv_writev_LDADD) $(LIBS)
Mark Wielaard 71c761
@@ -1398,6 +1413,10 @@
Mark Wielaard 71c761
 	@rm -f procfs-cmdline-exe$(EXEEXT)
Mark Wielaard 71c761
 	$(AM_V_CCLD)$(LINK) $(procfs_cmdline_exe_OBJECTS) $(procfs_cmdline_exe_LDADD) $(LIBS)
Mark Wielaard 71c761
 
Mark Wielaard 71c761
+pselect_alarm$(EXEEXT): $(pselect_alarm_OBJECTS) $(pselect_alarm_DEPENDENCIES) $(EXTRA_pselect_alarm_DEPENDENCIES) 
Mark Wielaard 71c761
+	@rm -f pselect_alarm$(EXEEXT)
Mark Wielaard 71c761
+	$(AM_V_CCLD)$(LINK) $(pselect_alarm_OBJECTS) $(pselect_alarm_LDADD) $(LIBS)
Mark Wielaard 71c761
+
Mark Wielaard 71c761
 pth_atfork1$(EXEEXT): $(pth_atfork1_OBJECTS) $(pth_atfork1_DEPENDENCIES) $(EXTRA_pth_atfork1_DEPENDENCIES) 
Mark Wielaard 71c761
 	@rm -f pth_atfork1$(EXEEXT)
Mark Wielaard 71c761
 	$(AM_V_CCLD)$(LINK) $(pth_atfork1_OBJECTS) $(pth_atfork1_LDADD) $(LIBS)
Mark Wielaard 71c761
@@ -1607,8 +1626,10 @@
Mark Wielaard 71c761
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/munmap_exe.Po@am__quote@
Mark Wielaard 71c761
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nestedfns-nestedfns.Po@am__quote@
Mark Wielaard 71c761
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pending.Po@am__quote@
Mark Wielaard 71c761
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppoll_alarm.Po@am__quote@
Mark Wielaard 71c761
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/process_vm_readv_writev.Po@am__quote@
Mark Wielaard 71c761
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/procfs-cmdline-exe.Po@am__quote@
Mark Wielaard 71c761
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pselect_alarm.Po@am__quote@
Mark Wielaard 71c761
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pth_atfork1.Po@am__quote@
Mark Wielaard 71c761
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pth_blockedsig.Po@am__quote@
Mark Wielaard 71c761
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pth_cancel1-pth_cancel1.Po@am__quote@
Mark Wielaard c7f8b4
commit 8c67aa7a7fb1a125e75937ad438d5f9a8fd20c5d
Mark Wielaard c7f8b4
Author: mjw <mjw@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Mark Wielaard c7f8b4
Date:   Tue Jun 21 19:58:21 2016 +0000
Mark Wielaard c7f8b4
Mark Wielaard c7f8b4
    Bug 364413 pselect sycallwrapper mishandles NULL sigmask.
Mark Wielaard c7f8b4
    
Mark Wielaard c7f8b4
    Don't check or try to copy sigmask if it is NULL. The sigmask might be
Mark Wielaard c7f8b4
    given in a struct, where the length is non-zero, but the signal set
Mark Wielaard c7f8b4
    pointer is NULL.
Mark Wielaard c7f8b4
    
Mark Wielaard c7f8b4
    Testcase provided by Paul Eggert <eggert@cs.ucla.edu>.
Mark Wielaard c7f8b4
    
Mark Wielaard c7f8b4
    git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15893 a5019735-40e9-0310-863c-91ae7b9d1cf9
Mark Wielaard c7f8b4
Mark Wielaard c7f8b4
diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c
Mark Wielaard c7f8b4
index 24a5ae9..9ace4fd 100644
Mark Wielaard c7f8b4
--- a/coregrind/m_syswrap/syswrap-linux.c
Mark Wielaard c7f8b4
+++ b/coregrind/m_syswrap/syswrap-linux.c
Mark Wielaard c7f8b4
@@ -1316,11 +1316,15 @@ PRE(sys_pselect6)
Mark Wielaard c7f8b4
          pas->ss.ss = (void *)1;
Mark Wielaard c7f8b4
          pas->ss.ss_len = pss->ss_len;
Mark Wielaard c7f8b4
          if (pss->ss_len == sizeof(*pss->ss)) {
Mark Wielaard c7f8b4
-            PRE_MEM_READ("pselect6(sig->ss)", (Addr)pss->ss, pss->ss_len);
Mark Wielaard c7f8b4
-            if (ML_(safe_to_deref)(pss->ss, sizeof(*pss->ss))) {
Mark Wielaard c7f8b4
-               pas->adjusted_ss = *pss->ss;
Mark Wielaard c7f8b4
-               pas->ss.ss = &pas->adjusted_ss;
Mark Wielaard c7f8b4
-               VG_(sanitize_client_sigmask)(&pas->adjusted_ss);
Mark Wielaard c7f8b4
+            if (pss->ss == NULL) {
Mark Wielaard c7f8b4
+               pas->ss.ss = NULL;
Mark Wielaard c7f8b4
+            } else {
Mark Wielaard c7f8b4
+               PRE_MEM_READ("pselect6(sig->ss)", (Addr)pss->ss, pss->ss_len);
Mark Wielaard c7f8b4
+               if (ML_(safe_to_deref)(pss->ss, sizeof(*pss->ss))) {
Mark Wielaard c7f8b4
+                  pas->adjusted_ss = *pss->ss;
Mark Wielaard c7f8b4
+                  pas->ss.ss = &pas->adjusted_ss;
Mark Wielaard c7f8b4
+                  VG_(sanitize_client_sigmask)(&pas->adjusted_ss);
Mark Wielaard c7f8b4
+               }
Mark Wielaard c7f8b4
             }
Mark Wielaard c7f8b4
          }
Mark Wielaard c7f8b4
       }
Mark Wielaard c7f8b4
diff --git a/none/tests/Makefile.am b/none/tests/Makefile.am
Mark Wielaard c7f8b4
index 0e11492..684c1af 100644
Mark Wielaard c7f8b4
--- a/none/tests/Makefile.am
Mark Wielaard c7f8b4
+++ b/none/tests/Makefile.am
Mark Wielaard c7f8b4
@@ -150,6 +150,8 @@ EXTRA_DIST = \
Mark Wielaard c7f8b4
 	procfs-non-linux.stderr.exp-with-readlinkat \
Mark Wielaard c7f8b4
 	procfs-non-linux.stderr.exp-without-readlinkat \
Mark Wielaard c7f8b4
 	pselect_alarm.stdout.exp pselect_alarm.stderr.exp pselect_alarm.vgtest \
Mark Wielaard c7f8b4
+	pselect_signask_null.vgtest \
Mark Wielaard c7f8b4
+	pselect_sigmask_null.stdout.exp pselect_sigmask_null.stderr.exp \
Mark Wielaard c7f8b4
 	pth_atfork1.stderr.exp pth_atfork1.stdout.exp pth_atfork1.vgtest \
Mark Wielaard c7f8b4
 	pth_blockedsig.stderr.exp \
Mark Wielaard c7f8b4
 	pth_blockedsig.stdout.exp pth_blockedsig.vgtest \
Mark Wielaard c7f8b4
@@ -222,6 +222,7 @@
Mark Wielaard c7f8b4
 	ppoll_alarm \
Mark Wielaard c7f8b4
 	procfs-cmdline-exe \
Mark Wielaard c7f8b4
 	pselect_alarm \
Mark Wielaard c7f8b4
+	pselect_sigmask_null \
Mark Wielaard c7f8b4
 	pth_atfork1 pth_blockedsig pth_cancel1 pth_cancel2 pth_cvsimple \
Mark Wielaard c7f8b4
 	pth_empty pth_exit pth_exit2 pth_mutexspeed pth_once pth_rwlock \
Mark Wielaard c7f8b4
 	pth_stackalign \
Mark Wielaard c7f8b4
diff --git a/none/tests/pselect_sigmask_null.c b/none/tests/pselect_sigmask_null.c
Mark Wielaard c7f8b4
new file mode 100644
Mark Wielaard c7f8b4
index 0000000..34bd584
Mark Wielaard c7f8b4
--- /dev/null
Mark Wielaard c7f8b4
+++ b/none/tests/pselect_sigmask_null.c
Mark Wielaard c7f8b4
@@ -0,0 +1,26 @@
Mark Wielaard c7f8b4
+/* Make sure handling of NULL sigmask is correct.
Mark Wielaard c7f8b4
+   https://bugs.kde.org/show_bug.cgi?id=XXX
Mark Wielaard c7f8b4
+   We might try to make a copy and adjust the mask.
Mark Wielaard c7f8b4
+   Testcase provided by Paul Eggert <eggert@cs.ucla.edu> */
Mark Wielaard c7f8b4
+
Mark Wielaard c7f8b4
+#include <stdio.h>
Mark Wielaard c7f8b4
+#include <stdlib.h>
Mark Wielaard c7f8b4
+#include <sys/select.h>
Mark Wielaard c7f8b4
+
Mark Wielaard c7f8b4
+int
Mark Wielaard c7f8b4
+main (void)
Mark Wielaard c7f8b4
+{
Mark Wielaard c7f8b4
+  struct timespec timeout;
Mark Wielaard c7f8b4
+  timeout.tv_sec = 1;
Mark Wielaard c7f8b4
+  timeout.tv_nsec = 0;
Mark Wielaard c7f8b4
+  switch (pselect (0, 0, 0, 0, &timeout, 0))
Mark Wielaard c7f8b4
+    {
Mark Wielaard c7f8b4
+    default:
Mark Wielaard c7f8b4
+      abort ();
Mark Wielaard c7f8b4
+    case -1:
Mark Wielaard c7f8b4
+      perror ("pselect");
Mark Wielaard c7f8b4
+      return 1;
Mark Wielaard c7f8b4
+    case 0:
Mark Wielaard c7f8b4
+      return 0;
Mark Wielaard c7f8b4
+    }
Mark Wielaard c7f8b4
+}
Mark Wielaard c7f8b4
diff --git a/none/tests/pselect_sigmask_null.stderr.exp b/none/tests/pselect_sigmask_null.stderr.exp
Mark Wielaard c7f8b4
new file mode 100644
Mark Wielaard c7f8b4
index 0000000..e69de29
Mark Wielaard c7f8b4
diff --git a/none/tests/pselect_sigmask_null.stdout.exp b/none/tests/pselect_sigmask_null.stdout.exp
Mark Wielaard c7f8b4
new file mode 100644
Mark Wielaard c7f8b4
index 0000000..e69de29
Mark Wielaard c7f8b4
diff --git a/none/tests/pselect_sigmask_null.vgtest b/none/tests/pselect_sigmask_null.vgtest
Mark Wielaard c7f8b4
new file mode 100644
Mark Wielaard c7f8b4
index 0000000..e59688c
Mark Wielaard c7f8b4
--- /dev/null
Mark Wielaard c7f8b4
+++ b/none/tests/pselect_sigmask_null.vgtest
Mark Wielaard c7f8b4
@@ -0,0 +1,2 @@
Mark Wielaard c7f8b4
+prog: pselect_sigmask_null
Mark Wielaard c7f8b4
+vgopts: -q
Mark Wielaard c7f8b4
Mark Wielaard c7f8b4
commit d41bebeb1e561ddfac17d9be65b29aa5bb3ebaf8
Mark Wielaard c7f8b4
Author: mjw <mjw@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Mark Wielaard c7f8b4
Date:   Tue Jun 21 21:06:27 2016 +0000
Mark Wielaard c7f8b4
Mark Wielaard c7f8b4
    Bug 364413 followup - fix signask -> sigmask typo in EXTRA_DIST
Mark Wielaard c7f8b4
    
Mark Wielaard c7f8b4
    git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15894 a5019735-40e9-0310-863c-91ae7b9d1cf9
Mark Wielaard c7f8b4
Mark Wielaard c7f8b4
diff --git a/none/tests/Makefile.am b/none/tests/Makefile.am
Mark Wielaard c7f8b4
index 684c1af..7059e67 100644
Mark Wielaard c7f8b4
--- a/none/tests/Makefile.am
Mark Wielaard c7f8b4
+++ b/none/tests/Makefile.am
Mark Wielaard c7f8b4
@@ -150,7 +150,7 @@ EXTRA_DIST = \
Mark Wielaard c7f8b4
 	procfs-non-linux.stderr.exp-with-readlinkat \
Mark Wielaard c7f8b4
 	procfs-non-linux.stderr.exp-without-readlinkat \
Mark Wielaard c7f8b4
 	pselect_alarm.stdout.exp pselect_alarm.stderr.exp pselect_alarm.vgtest \
Mark Wielaard c7f8b4
-	pselect_signask_null.vgtest \
Mark Wielaard c7f8b4
+	pselect_sigmask_null.vgtest \
Mark Wielaard c7f8b4
 	pselect_sigmask_null.stdout.exp pselect_sigmask_null.stderr.exp \
Mark Wielaard c7f8b4
 	pth_atfork1.stderr.exp pth_atfork1.stdout.exp pth_atfork1.vgtest \
Mark Wielaard c7f8b4
 	pth_blockedsig.stderr.exp \
Mark Wielaard c7f8b4
Only in valgrind-3.11.0: autom4te.cache
Mark Wielaard c7f8b4
diff -ur valgrind-3.11.0.orig/none/tests/Makefile.in valgrind-3.11.0/none/tests/Makefile.in
Mark Wielaard c7f8b4
--- valgrind-3.11.0.orig/none/tests/Makefile.in	2016-06-22 01:12:05.241643238 +0200
Mark Wielaard c7f8b4
+++ valgrind-3.11.0/none/tests/Makefile.in	2016-06-22 01:16:22.545150491 +0200
Mark Wielaard c7f8b4
@@ -153,12 +153,12 @@
Mark Wielaard c7f8b4
 	map_unaligned$(EXEEXT) map_unmap$(EXEEXT) mq$(EXEEXT) \
Mark Wielaard c7f8b4
 	pending$(EXEEXT) ppoll_alarm$(EXEEXT) \
Mark Wielaard c7f8b4
 	procfs-cmdline-exe$(EXEEXT) pselect_alarm$(EXEEXT) \
Mark Wielaard c7f8b4
-	pth_atfork1$(EXEEXT) pth_blockedsig$(EXEEXT) \
Mark Wielaard c7f8b4
-	pth_cancel1$(EXEEXT) pth_cancel2$(EXEEXT) \
Mark Wielaard c7f8b4
-	pth_cvsimple$(EXEEXT) pth_empty$(EXEEXT) pth_exit$(EXEEXT) \
Mark Wielaard c7f8b4
-	pth_exit2$(EXEEXT) pth_mutexspeed$(EXEEXT) pth_once$(EXEEXT) \
Mark Wielaard c7f8b4
-	pth_rwlock$(EXEEXT) pth_stackalign$(EXEEXT) rcrl$(EXEEXT) \
Mark Wielaard c7f8b4
-	readline1$(EXEEXT) require-text-symbol$(EXEEXT) \
Mark Wielaard c7f8b4
+	pselect_sigmask_null$(EXEEXT) pth_atfork1$(EXEEXT) \
Mark Wielaard c7f8b4
+	pth_blockedsig$(EXEEXT) pth_cancel1$(EXEEXT) \
Mark Wielaard c7f8b4
+	pth_cancel2$(EXEEXT) pth_cvsimple$(EXEEXT) pth_empty$(EXEEXT) \
Mark Wielaard c7f8b4
+	pth_exit$(EXEEXT) pth_exit2$(EXEEXT) pth_mutexspeed$(EXEEXT) \
Mark Wielaard c7f8b4
+	pth_once$(EXEEXT) pth_rwlock$(EXEEXT) pth_stackalign$(EXEEXT) \
Mark Wielaard c7f8b4
+	rcrl$(EXEEXT) readline1$(EXEEXT) require-text-symbol$(EXEEXT) \
Mark Wielaard c7f8b4
 	res_search$(EXEEXT) resolv$(EXEEXT) rlimit_nofile$(EXEEXT) \
Mark Wielaard c7f8b4
 	selfrun$(EXEEXT) sem$(EXEEXT) semlimit$(EXEEXT) \
Mark Wielaard c7f8b4
 	sha1_test$(EXEEXT) shortpush$(EXEEXT) shorts$(EXEEXT) \
Mark Wielaard c7f8b4
@@ -342,6 +342,9 @@
Mark Wielaard c7f8b4
 pselect_alarm_SOURCES = pselect_alarm.c
Mark Wielaard c7f8b4
 pselect_alarm_OBJECTS = pselect_alarm.$(OBJEXT)
Mark Wielaard c7f8b4
 pselect_alarm_DEPENDENCIES =
Mark Wielaard c7f8b4
+pselect_sigmask_null_SOURCES = pselect_sigmask_null.c
Mark Wielaard c7f8b4
+pselect_sigmask_null_OBJECTS = pselect_sigmask_null.$(OBJEXT)
Mark Wielaard c7f8b4
+pselect_sigmask_null_LDADD = $(LDADD)
Mark Wielaard c7f8b4
 pth_atfork1_SOURCES = pth_atfork1.c
Mark Wielaard c7f8b4
 pth_atfork1_OBJECTS = pth_atfork1.$(OBJEXT)
Mark Wielaard c7f8b4
 pth_atfork1_DEPENDENCIES =
Mark Wielaard c7f8b4
@@ -535,17 +538,18 @@
Mark Wielaard c7f8b4
 	$(libvexmultiarch_test_SOURCES) manythreads.c map_unaligned.c \
Mark Wielaard c7f8b4
 	map_unmap.c mmap_fcntl_bug.c mq.c munmap_exe.c nestedfns.c \
Mark Wielaard c7f8b4
 	pending.c ppoll_alarm.c process_vm_readv_writev.c \
Mark Wielaard c7f8b4
-	procfs-cmdline-exe.c pselect_alarm.c pth_atfork1.c \
Mark Wielaard c7f8b4
-	pth_blockedsig.c pth_cancel1.c pth_cancel2.c pth_cvsimple.c \
Mark Wielaard c7f8b4
-	pth_empty.c pth_exit.c pth_exit2.c pth_mutexspeed.c pth_once.c \
Mark Wielaard c7f8b4
-	pth_rwlock.c pth_stackalign.c rcrl.c readline1.c \
Mark Wielaard c7f8b4
-	require-text-symbol.c res_search.c resolv.c rlimit64_nofile.c \
Mark Wielaard c7f8b4
-	rlimit_nofile.c selfrun.c sem.c semlimit.c sha1_test.c \
Mark Wielaard c7f8b4
-	shortpush.c shorts.c sigstackgrowth.c stackgrowth.c \
Mark Wielaard c7f8b4
-	syscall-restart1.c syscall-restart2.c syslog.c system.c \
Mark Wielaard c7f8b4
-	thread-exits.c threaded-fork.c threadederrno.c timestamp.c \
Mark Wielaard c7f8b4
-	$(tls_SOURCES) $(tls_so_SOURCES) $(tls2_so_SOURCES) \
Mark Wielaard c7f8b4
-	unit_debuglog.c $(valgrind_cpp_test_SOURCES) vgprintf.c
Mark Wielaard c7f8b4
+	procfs-cmdline-exe.c pselect_alarm.c pselect_sigmask_null.c \
Mark Wielaard c7f8b4
+	pth_atfork1.c pth_blockedsig.c pth_cancel1.c pth_cancel2.c \
Mark Wielaard c7f8b4
+	pth_cvsimple.c pth_empty.c pth_exit.c pth_exit2.c \
Mark Wielaard c7f8b4
+	pth_mutexspeed.c pth_once.c pth_rwlock.c pth_stackalign.c \
Mark Wielaard c7f8b4
+	rcrl.c readline1.c require-text-symbol.c res_search.c resolv.c \
Mark Wielaard c7f8b4
+	rlimit64_nofile.c rlimit_nofile.c selfrun.c sem.c semlimit.c \
Mark Wielaard c7f8b4
+	sha1_test.c shortpush.c shorts.c sigstackgrowth.c \
Mark Wielaard c7f8b4
+	stackgrowth.c syscall-restart1.c syscall-restart2.c syslog.c \
Mark Wielaard c7f8b4
+	system.c thread-exits.c threaded-fork.c threadederrno.c \
Mark Wielaard c7f8b4
+	timestamp.c $(tls_SOURCES) $(tls_so_SOURCES) \
Mark Wielaard c7f8b4
+	$(tls2_so_SOURCES) unit_debuglog.c \
Mark Wielaard c7f8b4
+	$(valgrind_cpp_test_SOURCES) vgprintf.c
Mark Wielaard c7f8b4
 DIST_SOURCES = ansi.c args.c async-sigs.c bitfield1.c bug129866.c \
Mark Wielaard c7f8b4
 	bug234814.c closeall.c $(coolo_sigaction_SOURCES) \
Mark Wielaard c7f8b4
 	coolo_strlen.c discard.c exec-sigmask.c execve.c faultstatus.c \
Mark Wielaard c7f8b4
@@ -556,17 +560,18 @@
Mark Wielaard c7f8b4
 	$(libvexmultiarch_test_SOURCES) manythreads.c map_unaligned.c \
Mark Wielaard c7f8b4
 	map_unmap.c mmap_fcntl_bug.c mq.c munmap_exe.c nestedfns.c \
Mark Wielaard c7f8b4
 	pending.c ppoll_alarm.c process_vm_readv_writev.c \
Mark Wielaard c7f8b4
-	procfs-cmdline-exe.c pselect_alarm.c pth_atfork1.c \
Mark Wielaard c7f8b4
-	pth_blockedsig.c pth_cancel1.c pth_cancel2.c pth_cvsimple.c \
Mark Wielaard c7f8b4
-	pth_empty.c pth_exit.c pth_exit2.c pth_mutexspeed.c pth_once.c \
Mark Wielaard c7f8b4
-	pth_rwlock.c pth_stackalign.c rcrl.c readline1.c \
Mark Wielaard c7f8b4
-	require-text-symbol.c res_search.c resolv.c rlimit64_nofile.c \
Mark Wielaard c7f8b4
-	rlimit_nofile.c selfrun.c sem.c semlimit.c sha1_test.c \
Mark Wielaard c7f8b4
-	shortpush.c shorts.c sigstackgrowth.c stackgrowth.c \
Mark Wielaard c7f8b4
-	syscall-restart1.c syscall-restart2.c syslog.c system.c \
Mark Wielaard c7f8b4
-	thread-exits.c threaded-fork.c threadederrno.c timestamp.c \
Mark Wielaard c7f8b4
-	$(tls_SOURCES) $(tls_so_SOURCES) $(tls2_so_SOURCES) \
Mark Wielaard c7f8b4
-	unit_debuglog.c $(valgrind_cpp_test_SOURCES) vgprintf.c
Mark Wielaard c7f8b4
+	procfs-cmdline-exe.c pselect_alarm.c pselect_sigmask_null.c \
Mark Wielaard c7f8b4
+	pth_atfork1.c pth_blockedsig.c pth_cancel1.c pth_cancel2.c \
Mark Wielaard c7f8b4
+	pth_cvsimple.c pth_empty.c pth_exit.c pth_exit2.c \
Mark Wielaard c7f8b4
+	pth_mutexspeed.c pth_once.c pth_rwlock.c pth_stackalign.c \
Mark Wielaard c7f8b4
+	rcrl.c readline1.c require-text-symbol.c res_search.c resolv.c \
Mark Wielaard c7f8b4
+	rlimit64_nofile.c rlimit_nofile.c selfrun.c sem.c semlimit.c \
Mark Wielaard c7f8b4
+	sha1_test.c shortpush.c shorts.c sigstackgrowth.c \
Mark Wielaard c7f8b4
+	stackgrowth.c syscall-restart1.c syscall-restart2.c syslog.c \
Mark Wielaard c7f8b4
+	system.c thread-exits.c threaded-fork.c threadederrno.c \
Mark Wielaard c7f8b4
+	timestamp.c $(tls_SOURCES) $(tls_so_SOURCES) \
Mark Wielaard c7f8b4
+	$(tls2_so_SOURCES) unit_debuglog.c \
Mark Wielaard c7f8b4
+	$(valgrind_cpp_test_SOURCES) vgprintf.c
Mark Wielaard c7f8b4
 RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
Mark Wielaard c7f8b4
 	ctags-recursive dvi-recursive html-recursive info-recursive \
Mark Wielaard c7f8b4
 	install-data-recursive install-dvi-recursive \
Mark Wielaard c7f8b4
@@ -1087,6 +1092,8 @@
Mark Wielaard c7f8b4
 	procfs-non-linux.stderr.exp-with-readlinkat \
Mark Wielaard c7f8b4
 	procfs-non-linux.stderr.exp-without-readlinkat \
Mark Wielaard c7f8b4
 	pselect_alarm.stdout.exp pselect_alarm.stderr.exp pselect_alarm.vgtest \
Mark Wielaard c7f8b4
+	pselect_sigmask_null.vgtest \
Mark Wielaard c7f8b4
+	pselect_sigmask_null.stdout.exp pselect_sigmask_null.stderr.exp \
Mark Wielaard c7f8b4
 	pth_atfork1.stderr.exp pth_atfork1.stdout.exp pth_atfork1.vgtest \
Mark Wielaard c7f8b4
 	pth_blockedsig.stderr.exp \
Mark Wielaard c7f8b4
 	pth_blockedsig.stdout.exp pth_blockedsig.vgtest \
Mark Wielaard c7f8b4
@@ -1417,6 +1424,10 @@
Mark Wielaard c7f8b4
 	@rm -f pselect_alarm$(EXEEXT)
Mark Wielaard c7f8b4
 	$(AM_V_CCLD)$(LINK) $(pselect_alarm_OBJECTS) $(pselect_alarm_LDADD) $(LIBS)
Mark Wielaard c7f8b4
 
Mark Wielaard c7f8b4
+pselect_sigmask_null$(EXEEXT): $(pselect_sigmask_null_OBJECTS) $(pselect_sigmask_null_DEPENDENCIES) $(EXTRA_pselect_sigmask_null_DEPENDENCIES) 
Mark Wielaard c7f8b4
+	@rm -f pselect_sigmask_null$(EXEEXT)
Mark Wielaard c7f8b4
+	$(AM_V_CCLD)$(LINK) $(pselect_sigmask_null_OBJECTS) $(pselect_sigmask_null_LDADD) $(LIBS)
Mark Wielaard c7f8b4
+
Mark Wielaard c7f8b4
 pth_atfork1$(EXEEXT): $(pth_atfork1_OBJECTS) $(pth_atfork1_DEPENDENCIES) $(EXTRA_pth_atfork1_DEPENDENCIES) 
Mark Wielaard c7f8b4
 	@rm -f pth_atfork1$(EXEEXT)
Mark Wielaard c7f8b4
 	$(AM_V_CCLD)$(LINK) $(pth_atfork1_OBJECTS) $(pth_atfork1_LDADD) $(LIBS)
Mark Wielaard c7f8b4
@@ -1630,6 +1641,7 @@
Mark Wielaard c7f8b4
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/process_vm_readv_writev.Po@am__quote@
Mark Wielaard c7f8b4
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/procfs-cmdline-exe.Po@am__quote@
Mark Wielaard c7f8b4
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pselect_alarm.Po@am__quote@
Mark Wielaard c7f8b4
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pselect_sigmask_null.Po@am__quote@
Mark Wielaard c7f8b4
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pth_atfork1.Po@am__quote@
Mark Wielaard c7f8b4
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pth_blockedsig.Po@am__quote@
Mark Wielaard c7f8b4
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pth_cancel1-pth_cancel1.Po@am__quote@