public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: "H.J. Lu via Libc-alpha" <libc-alpha@sourceware.org>
Subject: Re: [PATCH] x32: Add <asm/unistd_x32.h> and regenerate arch-syscall.h
Date: Tue, 25 Aug 2020 12:50:41 +0200	[thread overview]
Message-ID: <87sgcb80e6.fsf@oldenburg2.str.redhat.com> (raw)
In-Reply-To: <CAMe9rOpwkZotmstjk6_G7Df39cPfYG8_T=0G1ik_VhHSLpVorw@mail.gmail.com> (H. J. Lu's message of "Mon, 24 Aug 2020 12:29:56 -0700")

* 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>


  reply	other threads:[~2020-08-25 10:50 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-15 21:31 H.J. Lu
2020-08-24 11:17 ` Florian Weimer
2020-08-24 12:42   ` H.J. Lu
2020-08-24 13:22     ` Florian Weimer
2020-08-24 13:56       ` H.J. Lu
2020-08-24 17:17         ` Florian Weimer
2020-08-24 18:54           ` H.J. Lu
2020-08-24 19:10             ` Florian Weimer
2020-08-24 19:29               ` H.J. Lu
2020-08-25 10:50                 ` Florian Weimer [this message]
2020-08-25 12:51                   ` [PATCH] x32: Add <fixup-asm-unistd.h> " H.J. Lu
2020-08-26  9:35                     ` Florian Weimer
2020-08-27 13:36                       ` H.J. Lu
2020-08-31 12:56                         ` Florian Weimer

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=87sgcb80e6.fsf@oldenburg2.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=hjl.tools@gmail.com \
    --cc=libc-alpha@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).