[PATCH] x32: Add <asm/unistd_x32.h> and regenerate arch-syscall.h
Florian Weimer
fweimer@redhat.com
Tue Aug 25 10:50:41 GMT 2020
* 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>
More information about the Libc-alpha
mailing list