1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-12-24 17:51:17 +03:00

x86/cet: Check feature_1 in TCB for active IBT and SHSTK

Initially, IBT and SHSTK are marked as active when CPU supports them
and CET are enabled in glibc.  They can be disabled early by tunables
before relocation.  Since after relocation, GLRO(dl_x86_cpu_features)
becomes read-only, we can't update GLRO(dl_x86_cpu_features) to mark
IBT and SHSTK as inactive.  Instead, check the feature_1 field in TCB
to decide if IBT and SHST are active.
This commit is contained in:
H.J. Lu
2023-12-29 08:43:52 -08:00
parent 541641a3de
commit d360dcc001
3 changed files with 35 additions and 1 deletions

View File

@@ -15,9 +15,18 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <assert.h>
#include <tcb-offsets.h>
#include <ldsodefs.h>
#ifdef __x86_64__
# ifdef __LP64__
_Static_assert (FEATURE_1_OFFSET == 72, "FEATURE_1_OFFSET != 72");
# else
_Static_assert (FEATURE_1_OFFSET == 40, "FEATURE_1_OFFSET != 40");
# endif
#endif
const struct cpuid_feature *
__x86_get_cpuid_feature_leaf (unsigned int leaf)
{