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)
This commit is contained in:
H.J. Lu 2021-01-12 19:00:13 -08:00
parent 2b4f67c2b3
commit 87450ecf8a
4 changed files with 12 additions and 1 deletions

1
NEWS
View File

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

View File

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

View File

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

View File

@ -0,0 +1 @@
#include <setjmp/tst-setjmp.c>