diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2021-01-12 19:00:13 -0800 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2021-01-13 05:08:27 -0800 |
commit | 87450ecf8a80fa0572ec3a99abad30d11b5ccd4b (patch) | |
tree | 290fa2a365dfe2cca6b3dcce342a920552a0d0d2 | |
parent | 2b4f67c2b33b545eac6a921fe08d0499ca679df3 (diff) | |
download | glibc-87450ecf8a80fa0572ec3a99abad30d11b5ccd4b.tar.gz glibc-87450ecf8a80fa0572ec3a99abad30d11b5ccd4b.tar.xz glibc-87450ecf8a80fa0572ec3a99abad30d11b5ccd4b.zip |
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)
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | sysdeps/x86/Makefile | 6 | ||||
-rw-r--r-- | sysdeps/x86/dl-cet.c | 5 | ||||
-rw-r--r-- | sysdeps/x86/tst-setjmp-cet.c | 1 |
4 files changed, 12 insertions, 1 deletions
diff --git a/NEWS b/NEWS index 5c32a966b7..8b589b175b 100644 --- a/NEWS +++ b/NEWS @@ -21,6 +21,7 @@ The following bugs are resolved with this release: [26853] aarch64: Missing unwind information in statically linked startup code [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 Version 2.32 diff --git a/sysdeps/x86/Makefile b/sysdeps/x86/Makefile index a6736aef25..9736a13e7b 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 ($(subdir),string) diff --git a/sysdeps/x86/dl-cet.c b/sysdeps/x86/dl-cet.c index 03572f7af6..3cc54a8d53 100644 --- a/sysdeps/x86/dl-cet.c +++ b/sysdeps/x86/dl-cet.c @@ -47,7 +47,10 @@ 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)); + 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> |