[PATCH] x32: Add <fixup-asm-unistd.h> and regenerate arch-syscall.h
H.J. Lu
hjl.tools@gmail.com
Tue Aug 25 12:51:29 GMT 2020
On Tue, Aug 25, 2020 at 3:50 AM Florian Weimer <fweimer@redhat.com> wrote:
>
> * H. J. Lu:
>
> > I am putting tools/testing/selftests/x86/sigreturn.c from Linux kernel
> > into glibc to test a new arch_prctl syscall for CET:
> >
> > ARCH_X86_CET_MMAP_SHSTK:
> >
> > /* Allocate a new shadow stack with unsigned long long *addr:
> > IN: requested shadow stack size: addr[0].
> > IN: The mmap flags: addr[1].
> > 1. MAP_32BIT
> > 2. MAP_POPULATE
> > OUT: allocated shadow stack address: *addr.
> > */
>
> This patch works for me.
>
> Thanks,
> Flroian
>
> diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/Makefile b/sysdeps/unix/sysv/linux/x86_64/x32/Makefile
> index 16b768d8ba..2cd35c120b 100644
> --- a/sysdeps/unix/sysv/linux/x86_64/x32/Makefile
> +++ b/sysdeps/unix/sysv/linux/x86_64/x32/Makefile
> @@ -3,6 +3,8 @@ default-abi := x32
>
> ifeq ($(subdir),misc)
> sysdep_routines += arch_prctl
> +
> +tests-internal += tst-set_thread_area
> endif
>
> ifeq ($(subdir),conform)
> diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h b/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h
> index 1a701c1472..7b64b1fa0c 100644
> --- a/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h
> +++ b/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h
> @@ -260,6 +260,7 @@
> #define __NR_sendto 1073741868
> #define __NR_set_mempolicy 1073742062
> #define __NR_set_robust_list 1073742354
> +#define __NR_set_thread_area 1073742029
> #define __NR_set_tid_address 1073742042
> #define __NR_setdomainname 1073741995
> #define __NR_setfsgid 1073741947
> diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/fixup-asm-unistd.h b/sysdeps/unix/sysv/linux/x86_64/x32/fixup-asm-unistd.h
> new file mode 100644
> index 0000000000..984f948626
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/x86_64/x32/fixup-asm-unistd.h
> @@ -0,0 +1,3 @@
> +#ifndef __NR_set_thread_area
> +# define __NR_set_thread_area 1073742029
> +#endif
> diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/tst-set_thread_area.c b/sysdeps/unix/sysv/linux/x86_64/x32/tst-set_thread_area.c
> new file mode 100644
> index 0000000000..ff2249d343
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/x86_64/x32/tst-set_thread_area.c
> @@ -0,0 +1,9 @@
> +#include <sys/syscall.h>
> +
> +static int
> +do_test (void)
> +{
> + return __NR_set_thread_area != 0;
> +}
> +
> +#include <support/test-driver.c>
>
Here is the updated patch. OK for master?
Thanks.
--
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-x32-Add-fixup-asm-unistd.h-and-regenerate-arch-sysca.patch
Type: application/x-patch
Size: 4614 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20200825/957262b5/attachment.bin>
More information about the Libc-alpha
mailing list