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] TODO: fix variadic syscalls
Date: Wed, 26 Oct 2022 14:49:54 +0000 (GMT)	[thread overview]
Message-ID: <20221026144954.64E883853803@sourceware.org> (raw)

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

commit a46c1b96f3949c2c15e130249094818981b06835
Author: Szabolcs Nagy <szabolcs.nagy@arm.com>
Date:   Tue Oct 25 13:10:54 2022 +0100

    TODO: fix variadic syscalls
    
    Only use as many varargs as accessible according to the bounds of c9.
    
    TODO: squash into original syscall support

Diff:
---
 sysdeps/unix/sysv/linux/aarch64/clone.S   |  5 +++++
 sysdeps/unix/sysv/linux/aarch64/syscall.S | 13 +++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/sysdeps/unix/sysv/linux/aarch64/clone.S b/sysdeps/unix/sysv/linux/aarch64/clone.S
index 663853ab4a..4d7852304b 100644
--- a/sysdeps/unix/sysv/linux/aarch64/clone.S
+++ b/sysdeps/unix/sysv/linux/aarch64/clone.S
@@ -66,8 +66,13 @@ ENTRY(__clone)
 	PTR_ARG (6)
 #else
 	cbz	x9, L(skip_args)
+	gclen   x10, c9
 	ldr	c4, [c9]
+	cmp	x10, 16
+	bls	L(skip_args)
 	ldr	c5, [c9,16]
+	cmp	x10, 32
+	bls	L(skip_args)
 	ldr	c6, [c9,32]
 L(skip_args):
 #endif
diff --git a/sysdeps/unix/sysv/linux/aarch64/syscall.S b/sysdeps/unix/sysv/linux/aarch64/syscall.S
index ec4688433d..43a81fc248 100644
--- a/sysdeps/unix/sysv/linux/aarch64/syscall.S
+++ b/sysdeps/unix/sysv/linux/aarch64/syscall.S
@@ -30,12 +30,25 @@ ENTRY (syscall)
 	uxtw	x8, w0
 #ifdef __CHERI_PURE_CAPABILITY__
 	cbz	x9, L(skip_args)
+	gclen   x10, c9
 	ldr	c0, [c9]
+	cmp	x10, 16
+	bls	L(skip_args)
 	ldr	c1, [c9,16]
+	cmp	x10, 32
+	bls	L(skip_args)
 	ldr	c2, [c9,32]
+	cmp	x10, 48
+	bls	L(skip_args)
 	ldr	c3, [c9,48]
+	cmp	x10, 64
+	bls	L(skip_args)
 	ldr	c4, [c9,64]
+	cmp	x10, 80
+	bls	L(skip_args)
 	ldr	c5, [c9,80]
+	cmp	x10, 96
+	bls	L(skip_args)
 	ldr	c6, [c9,96]
 L(skip_args):
 #else

                 reply	other threads:[~2022-10-26 14:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20221026144954.64E883853803@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).