mirror of
https://sourceware.org/git/glibc.git
synced 2025-12-24 17:51:17 +03:00
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].
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user