public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/release/2.31/master] x86: Set header.feature_1 in TCB for always-on CET [BZ #27177]
@ 2021-01-13 16:23 H.J. Lu
  0 siblings, 0 replies; only message in thread
From: H.J. Lu @ 2021-01-13 16:23 UTC (permalink / raw)
  To: glibc-cvs

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

commit 36eb01dd857f672c849b59d889e22a89e4ae5a75
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Jan 12 19:00:13 2021 -0800

    x86: Set header.feature_1 in TCB for always-on CET [BZ #27177]
    
    Update dl_cet_check() to set header.feature_1 in TCB when both IBT and
    SHSTK are always on.
    
    (cherry picked from commit 2ef23b520597f4ea1790a669b83e608f24f4cf12)

Diff:
---
 NEWS                         | 1 +
 sysdeps/x86/Makefile         | 6 ++++++
 sysdeps/x86/dl-cet.c         | 6 +++++-
 sysdeps/x86/tst-setjmp-cet.c | 1 +
 4 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 58fa101b36..d2fcc44aa4 100644
--- a/NEWS
+++ b/NEWS
@@ -36,6 +36,7 @@ The following bugs are resolved with this release:
   [26923] Assertion failure in iconv when converting invalid UCS4 (CVE-2020-29562)
   [26932] libc: sh: Multiple floating point functions defined as stubs only
   [27130] "rep movsb" performance issue
+  [27177] GLIBC_TUNABLES=glibc.cpu.x86_ibt=on:glibc.cpu.x86_shstk=on doesn't work
 
 Security related changes:
 
diff --git a/sysdeps/x86/Makefile b/sysdeps/x86/Makefile
index 95182a508c..a5112ef367 100644
--- a/sysdeps/x86/Makefile
+++ b/sysdeps/x86/Makefile
@@ -12,6 +12,12 @@ endif
 ifeq ($(subdir),setjmp)
 gen-as-const-headers += jmp_buf-ssp.sym
 sysdep_routines += __longjmp_cancel
+ifneq ($(enable-cet),no)
+ifneq ($(have-tunables),no)
+tests += tst-setjmp-cet
+tst-setjmp-cet-ENV = GLIBC_TUNABLES=glibc.cpu.x86_ibt=on:glibc.cpu.x86_shstk=on
+endif
+endif
 endif
 
 ifeq ($(enable-cet),yes)
diff --git a/sysdeps/x86/dl-cet.c b/sysdeps/x86/dl-cet.c
index ca3b5849bc..8ffaf94a00 100644
--- a/sysdeps/x86/dl-cet.c
+++ b/sysdeps/x86/dl-cet.c
@@ -105,7 +105,11 @@ dl_cet_check (struct link_map *m, const char *program)
   /* No legacy object check if both IBT and SHSTK are always on.  */
   if (enable_ibt_type == CET_ALWAYS_ON
       && enable_shstk_type == CET_ALWAYS_ON)
-    return;
+    {
+      THREAD_SETMEM (THREAD_SELF, header.feature_1,
+		     GL(dl_x86_feature_1)[0]);
+      return;
+    }
 
   /* Check if IBT is enabled by kernel.  */
   bool ibt_enabled
diff --git a/sysdeps/x86/tst-setjmp-cet.c b/sysdeps/x86/tst-setjmp-cet.c
new file mode 100644
index 0000000000..42c795d2a8
--- /dev/null
+++ b/sysdeps/x86/tst-setjmp-cet.c
@@ -0,0 +1 @@
+#include <setjmp/tst-setjmp.c>


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-01-13 16:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-13 16:23 [glibc/release/2.31/master] x86: Set header.feature_1 in TCB for always-on CET [BZ #27177] H.J. Lu

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).