From 187b3dd4263cccc0087df3c4311ded95d866d116 Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Thu, 17 Nov 2022 15:19:10 +0000 Subject: cheri: Fix pselect signal mask argument 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 | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/sysdeps/unix/sysv/linux/pselect.c b/sysdeps/unix/sysv/linux/pselect.c index eba1c111f8..553de0a490 100644 --- a/sysdeps/unix/sysv/linux/pselect.c +++ b/sysdeps/unix/sysv/linux/pselect.c @@ -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 -- cgit 1.4.1