[PATCH v3 08/19] elf: Emit warning if tunable is ill-formatted

Adhemerval Zanella adhemerval.zanella@linaro.org
Mon Nov 6 20:25:41 GMT 2023


So caller knows that the tunable will be ignored.

Checked on x86_64-linux-gnu.
---
 elf/dl-tunables.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/elf/dl-tunables.c b/elf/dl-tunables.c
index e1198869d6..6e3e6a2cf8 100644
--- a/elf/dl-tunables.c
+++ b/elf/dl-tunables.c
@@ -235,6 +235,12 @@ parse_tunables (char *valstring)
 {
   struct tunable_toset_t tunables[tunables_list_size];
   int ntunables = parse_tunables_string (valstring, tunables);
+  if (ntunables == -1)
+    {
+      _dl_error_printf (
+        "WARNING: ld.so: invalid GLIBC_TUNABLES `%s': ignored.\n", valstring);
+      return;
+    }
 
   for (int i = 0; i < ntunables; i++)
     tunable_initialize (tunables[i].t, tunables[i].value);
-- 
2.34.1



More information about the Libc-alpha mailing list