[PATCH] elf: Fix elf_get_dynamic_info definition
Florian Weimer
fw@deneb.enyo.de
Wed Oct 13 15:18:13 GMT 2021
* Adhemerval Zanella:
> On 12/10/2021 03:35, Florian Weimer wrote:
>> * Adhemerval Zanella via Libc-alpha:
>>
>>> + if (check)
>>> + {
>>> + /* Only the bind now flags are allowed. */
>>> + assert (info[VERSYMIDX (DT_FLAGS_1)] == NULL
>>> + || (info[VERSYMIDX (DT_FLAGS_1)]->d_un.d_val & ~DF_1_NOW) == 0);
>>> + /* Flags must not be set for ld.so. */
>>> + assert (info[DT_FLAGS] == NULL
>>> + || (info[DT_FLAGS]->d_un.d_val & ~DF_BIND_NOW) == 0);
>>> +# ifdef STATIC_PIE_BOOTSTRAP
>>> + assert (info[DT_RUNPATH] == NULL);
>>> + assert (info[DT_RPATH] == NULL);
>>> +# endif
>>> + }
>>
>> Why is a conditional check required? Is this an optimization?
>>
>
> Because these asserts are only meaningful for the loader itself, but
> this function is used by setup_vdso() as well. Enabling it regardless
> leads to:
Please add a comment mentioning this.
In the long run, we should replace these asserts with a build-time
check. I hesitate to add more tests based on readelf output, though.
More information about the Libc-alpha
mailing list