]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
cheri: Fix pselect signal mask argument
authorSzabolcs Nagy <szabolcs.nagy@arm.com>
Thu, 17 Nov 2022 15:19:10 +0000 (15:19 +0000)
committerSzabolcs Nagy <szabolcs.nagy@arm.com>
Thu, 17 Nov 2022 15:32:23 +0000 (15:32 +0000)
The signal mask argument is passed as a struct with a pointer and size
in the linux syscall abi, but the types used in glibc were wrong for
CHERI due to an x32 specific hack.

sysdeps/unix/sysv/linux/pselect.c

index eba1c111f8bbbaab1c979a3d34db406ba0cff35b..553de0a490805c4273dde56f1784ad7683a626b2 100644 (file)
@@ -27,12 +27,19 @@ pselect64_syscall (int nfds, fd_set *readfds, fd_set *writefds,
 # define __NR_pselect6_time64 __NR_pselect6
 #endif
   /* NB: This is required by ARGIFY used in x32 internal_syscallN.  */
-  __syscall_ulong_t data[2] =
-    {
-      (uintptr_t) sigmask, __NSIG_BYTES
-    };
+#ifdef __CHERI_PURE_CAPABILITY__
+  typedef uintptr_t kernel_ptr_t;
+  typedef size_t kernel_size_t;
+#else
+  typedef __syscall_ulong_t kernel_ptr_t;
+  typedef __syscall_ulong_t kernel_size_t;
+#endif
+  struct {
+    kernel_ptr_t ptr;
+    kernel_size_t size;
+  } data = { (uintptr_t) sigmask, __NSIG_BYTES };
   return SYSCALL_CANCEL (pselect6_time64, nfds, readfds, writefds, exceptfds,
-                        timeout, data);
+                        timeout, &data);
 }
 
 int