diff mbox series

[v2,08/19] elf: Emit warning if tunable is ill-formatted

Message ID 20231017130526.2216827-9-adhemerval.zanella@linaro.org
State Superseded
Headers show
Series Improve loader environment variable handling | expand

Commit Message

Adhemerval Zanella Netto Oct. 17, 2023, 1:05 p.m. UTC
So caller knows that the tunable will be ignored.

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

Comments

Siddhesh Poyarekar Oct. 27, 2023, 10:28 a.m. UTC | #1
On 2023-10-17 09:05, Adhemerval Zanella wrote:
> So caller knows that the tunable will be ignored.
> 
> Checked on x86_64-linux-gnu.
> ---
>   elf/dl-tunables.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/elf/dl-tunables.c b/elf/dl-tunables.c
> index 5d4b8c5bc0..b39c14694c 100644
> --- a/elf/dl-tunables.c
> +++ b/elf/dl-tunables.c
> @@ -236,7 +236,11 @@ parse_tunables (char *valstring)
>     struct tunable_toset_t tunables[tunables_list_size];
>     int ntunables = parse_tunables_string (valstring, tunables);
>     if (ntunables == -1)
> -    return;
> +    {
> +      _dl_error_printf (
> +        "ERROR: ld.so: invalid GLIBC_TUNABLES `%s': ignored.\n", valstring);

If it's a warning, then we should say WARNING here.

> +      return;
> +    }
>   
>     for (int i = 0; i < ntunables; i++)
>       tunable_initialize (tunables[i].t, tunables[i].value);
Adhemerval Zanella Netto Oct. 27, 2023, 12:51 p.m. UTC | #2
On 27/10/23 07:28, Siddhesh Poyarekar wrote:
> 
> 
> On 2023-10-17 09:05, Adhemerval Zanella wrote:
>> So caller knows that the tunable will be ignored.
>>
>> Checked on x86_64-linux-gnu.
>> ---
>>   elf/dl-tunables.c | 6 +++++-
>>   1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/elf/dl-tunables.c b/elf/dl-tunables.c
>> index 5d4b8c5bc0..b39c14694c 100644
>> --- a/elf/dl-tunables.c
>> +++ b/elf/dl-tunables.c
>> @@ -236,7 +236,11 @@ parse_tunables (char *valstring)
>>     struct tunable_toset_t tunables[tunables_list_size];
>>     int ntunables = parse_tunables_string (valstring, tunables);
>>     if (ntunables == -1)
>> -    return;
>> +    {
>> +      _dl_error_printf (
>> +        "ERROR: ld.so: invalid GLIBC_TUNABLES `%s': ignored.\n", valstring);
> 
> If it's a warning, then we should say WARNING here.

Ack.

> 
>> +      return;
>> +    }
>>       for (int i = 0; i < ntunables; i++)
>>       tunable_initialize (tunables[i].t, tunables[i].value);
diff mbox series

Patch

diff --git a/elf/dl-tunables.c b/elf/dl-tunables.c
index 5d4b8c5bc0..b39c14694c 100644
--- a/elf/dl-tunables.c
+++ b/elf/dl-tunables.c
@@ -236,7 +236,11 @@  parse_tunables (char *valstring)
   struct tunable_toset_t tunables[tunables_list_size];
   int ntunables = parse_tunables_string (valstring, tunables);
   if (ntunables == -1)
-    return;
+    {
+      _dl_error_printf (
+        "ERROR: 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);