[PATCH] elf: Make string tunables startup-only
Adhemerval Zanella Netto
adhemerval.zanella@linaro.org
Thu Jun 18 12:00:52 GMT 2026
On 18/06/26 04:59, Andreas Schwab wrote:
> On Jun 17 2026, Adhemerval Zanella wrote:
>
>> @@ -460,6 +461,12 @@ __tunable_get_val (tunable_id_t id, void *valp, tunable_callback_t callback)
>> }
>> case TUNABLE_TYPE_STRING:
>> {
>> + /* String tunables reference the environment block and are only
>> + valid during early startup; once sealed they must not be read. */
>> + if (__glibc_unlikely (cur->sealed))
>> + _dl_fatal_printf ("Inconsistency detected: trying to read the %s "
>> + "string tunable after process initialization\n",
>> + cur->name);
>
> Why do you need the sealed member? Wouldn't it be enough to check for
> NULL in strval?
>
It would prevent to use a TUNABLE_GET{_FULL} without first checking TUNABLE_IS_INITIALIZED.
I can change all TUNABLE_GET{_FULL} usage to do so, but I don't see this much as
improvement. The internal ABI is already a bit clunky.
More information about the Libc-alpha
mailing list