public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Szabolcs Nagy <nsz@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc/arm/morello/main] cheri: Fix pselect signal mask argument
Date: Wed, 23 Nov 2022 14:43:56 +0000 (GMT)	[thread overview]
Message-ID: <20221123144356.46A1A3853D7C@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=d816620531d550a42d422fcb7cae534f260b30f3

commit d816620531d550a42d422fcb7cae534f260b30f3
Author: Szabolcs Nagy <szabolcs.nagy@arm.com>
Date:   Thu Nov 17 15:19:10 2022 +0000

    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.

Diff:
---
 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

             reply	other threads:[~2022-11-23 14:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-23 14:43 Szabolcs Nagy [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-11-18 11:35 Szabolcs Nagy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221123144356.46A1A3853D7C@sourceware.org \
    --to=nsz@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).