aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/x86/cpu-features.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2020-04-28 10:05:25 -0700
committerH.J. Lu <hjl.tools@gmail.com>2020-05-18 06:15:02 -0700
commit674ea88294bfb8d89878a0ebbbcec38a85e118a5 (patch)
tree35c81a44dc6e7eea5f406bbba208dec19f2114a7 /sysdeps/x86/cpu-features.c
parentcbfc16122e9c4948b3a17224aeb5f8b70f02417d (diff)
downloadglibc-674ea88294bfb8d89878a0ebbbcec38a85e118a5.zip
glibc-674ea88294bfb8d89878a0ebbbcec38a85e118a5.tar.gz
glibc-674ea88294bfb8d89878a0ebbbcec38a85e118a5.tar.bz2
x86: Move CET control to _dl_x86_feature_control [BZ #25887]
1. Include <dl-procruntime.c> to get architecture specific initializer in rtld_global. 2. Change _dl_x86_feature_1[2] to _dl_x86_feature_1. 3. Add _dl_x86_feature_control after _dl_x86_feature_1, which is a struct of 2 bitfields for IBT and SHSTK control This fixes [BZ #25887].
Diffstat (limited to 'sysdeps/x86/cpu-features.c')
-rw-r--r--sysdeps/x86/cpu-features.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c
index bfb415f..b6d5d9d 100644
--- a/sysdeps/x86/cpu-features.c
+++ b/sysdeps/x86/cpu-features.c
@@ -39,7 +39,6 @@ extern void TUNABLE_CALLBACK (set_x86_shstk) (tunable_val_t *)
#if CET_ENABLED
# include <dl-cet.h>
-# include <cet-tunables.h>
#endif
static void
@@ -620,7 +619,7 @@ no_cpuid:
if (cet_status)
{
- GL(dl_x86_feature_1)[0] = cet_status;
+ GL(dl_x86_feature_1) = cet_status;
# ifndef SHARED
/* Check if IBT and SHSTK are enabled by kernel. */
@@ -644,14 +643,13 @@ no_cpuid:
/* Clear the disabled bits in dl_x86_feature_1. */
if (res == 0)
- GL(dl_x86_feature_1)[0] &= ~cet_feature;
+ GL(dl_x86_feature_1) &= ~cet_feature;
}
/* Lock CET if IBT or SHSTK is enabled in executable. Don't
- lock CET if SHSTK is enabled permissively. */
- if (((GL(dl_x86_feature_1)[1] >> CET_MAX)
- & ((1 << CET_MAX) - 1))
- != CET_PERMISSIVE)
+ lock CET if IBT or SHSTK is enabled permissively. */
+ if (GL(dl_x86_feature_control).ibt != cet_permissive
+ && GL(dl_x86_feature_control).shstk != cet_permissive)
dl_cet_lock_cet ();
}
# endif