]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
TODO: fix variadic syscalls
authorSzabolcs Nagy <szabolcs.nagy@arm.com>
Tue, 25 Oct 2022 12:10:54 +0000 (13:10 +0100)
committerSzabolcs Nagy <szabolcs.nagy@arm.com>
Wed, 26 Oct 2022 14:39:59 +0000 (15:39 +0100)
Only use as many varargs as accessible according to the bounds of c9.

TODO: squash into original syscall support

sysdeps/unix/sysv/linux/aarch64/clone.S
sysdeps/unix/sysv/linux/aarch64/syscall.S

index 663853ab4a59a4359be0689684688ef9fa32a0dd..4d7852304bd2a64f7a00ba397465d6bbed8a47e9 100644 (file)
@@ -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
index ec4688433ddd266bd9683517714cc8777004b4c4..43a81fc248264cb75fb14bf3661aba8839f87541 100644 (file)
@@ -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