about summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2024-05-06 13:18:48 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2024-05-07 12:16:36 -0300
commiteb59c7b43dd5c64c38e4c3cd21e7ad75d8d29cb0 (patch)
tree1e328170bed00764e57cb25bda2a1829e1da4f6a /scripts
parent1e1ad714ee9a663eda0e2bffad1d9f258b00a4e9 (diff)
downloadglibc-eb59c7b43dd5c64c38e4c3cd21e7ad75d8d29cb0.tar.gz
glibc-eb59c7b43dd5c64c38e4c3cd21e7ad75d8d29cb0.tar.xz
glibc-eb59c7b43dd5c64c38e4c3cd21e7ad75d8d29cb0.zip
elf: Make glibc.rtld.enable_secure ignore alias environment variables
Tunable with environment variables aliases are also ignored if
glibc.rtld.enable_secure is enabled.  The tunable parsing is also
optimized a bit, where the loop that checks each environment variable
only checks for the tunables with aliases instead of all tables.

Checked on aarch64-linux-gnu and x86_64-linux-gnu.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/gen-tunables.awk16
1 files changed, 15 insertions, 1 deletions
diff --git a/scripts/gen-tunables.awk b/scripts/gen-tunables.awk
index 9f5336381e..fc3b41376f 100644
--- a/scripts/gen-tunables.awk
+++ b/scripts/gen-tunables.awk
@@ -156,7 +156,7 @@ END {
   print "# define TUNABLE_ALIAS_MAX " (max_alias_len + 1)
   print "# include \"dl-tunable-types.h\""
   # Finally, the tunable list.
-  print "static tunable_t tunable_list[] attribute_relro = {"
+  print "static tunable_t tunable_list[] attribute_relro __attribute_used__ = {"
   for (tnm in types) {
     split (tnm, indices, SUBSEP);
     t = indices[1];
@@ -168,5 +168,19 @@ END {
 	    default_val[t,n,m], env_alias[t,n,m]);
   }
   print "};"
+
+  # Map of tunable with environment variables aliases used during parsing.  */
+  print "\nstatic const tunable_id_t tunable_env_alias_list[] ="
+  printf "{\n"
+  for (tnm in types) {
+    split (tnm, indices, SUBSEP);
+    t = indices[1];
+    n = indices[2];
+    m = indices[3];
+    if (env_alias[t,n,m] != "{0}") {
+      printf ("  TUNABLE_ENUM_NAME(%s, %s, %s),\n", t, n, m);
+    }
+  }
+  printf "};\n"
   print "#endif"
 }