[PATCH v10 2/4] elf: Fix initial-exec TLS access on audit modules (BZ #28096)
Florian Weimer
fweimer@redhat.com
Tue Jan 18 13:29:58 GMT 2022
* Adhemerval Zanella:
>>> So we need to avoid initialization only for the libc.so loading by
>>> audit libraries, the default one should still be initialized (marked
>>> as [INIT]). Later when new threads are created we need to initialized
>>> everything.
>>
>> That's what I tried to express with the LM_ID_BASE check.
>
> The problem is 'map->l_ns == LM_ID_BASE && !init_tls' will not initilize
> the required libc.so for main application during audit module loading.
> With tst-audit21:
>
> 1593586: [rtld.c:965] load_audit_module
> 1593586: [rtld.c:972] load_audit_module
> 1593586: [rtld.c:2464] dl_main
> 1593586: [../elf/dl-tls.c:605] map->l_name= map->l_ns=0 map->l_auditing=0 init_tls=0
> 1593586: [../elf/dl-tls.c:610] map->l_name=[...]/elf/tst-auditmod21a.so map->l_ns=1 map->l_auditing=1 init_tls=0 [INIT]
> 1593586: [../elf/dl-tls.c:610] map->l_name=[...]/libc.so.6 map->l_ns=1 map->l_auditing=1 init_tls=0 [INIT]
> 1593586: [../elf/dl-tls.c:605] map->l_name=[...]/libc.so.6 map->l_ns=0 map->l_auditing=0 init_tls=0
> 1593586: [../elf/dl-tls.c:627]
> 1593586: [rtld.c:2466] dl_main
> Segmentation fault (core dumped)
Looks like the condition is simply reversed? [INIT] should only appear
for map->l_ns == 0, right?
Thanks,
Florian
More information about the Libc-alpha
mailing list