about summary refs log tree commit diff
path: root/sysdeps/x86/dl-procruntime.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/dl-procruntime.c
parentcbfc16122e9c4948b3a17224aeb5f8b70f02417d (diff)
downloadglibc-674ea88294bfb8d89878a0ebbbcec38a85e118a5.tar.gz
glibc-674ea88294bfb8d89878a0ebbbcec38a85e118a5.tar.xz
glibc-674ea88294bfb8d89878a0ebbbcec38a85e118a5.zip
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/dl-procruntime.c')
-rw-r--r--sysdeps/x86/dl-procruntime.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/sysdeps/x86/dl-procruntime.c b/sysdeps/x86/dl-procruntime.c
index 5e39a38133..2c3e97952b 100644
--- a/sysdeps/x86/dl-procruntime.c
+++ b/sysdeps/x86/dl-procruntime.c
@@ -47,7 +47,27 @@
 # if !defined PROCINFO_DECL && defined SHARED
   ._dl_x86_feature_1
 # else
-PROCINFO_CLASS unsigned int _dl_x86_feature_1[2]
+PROCINFO_CLASS unsigned int _dl_x86_feature_1
+# endif
+# ifndef PROCINFO_DECL
+= 0
+# endif
+# if !defined SHARED || defined PROCINFO_DECL
+;
+# else
+,
+# endif
+
+# if !defined PROCINFO_DECL && defined SHARED
+  ._dl_x86_feature_control
+# else
+PROCINFO_CLASS struct dl_x86_feature_control _dl_x86_feature_control
+# endif
+# ifndef PROCINFO_DECL
+= {
+    .ibt = cet_elf_property,
+    .shstk = cet_elf_property
+  }
 # endif
 # if !defined SHARED || defined PROCINFO_DECL
 ;