[PATCH v6 13/20] elf: Fix initial-exec TLS access on audit modules (BZ #28096)

Adhemerval Zanella adhemerval.zanella@linaro.org
Mon Dec 20 13:25:07 GMT 2021



On 18/12/2021 15:01, Florian Weimer wrote:
> * Adhemerval Zanella:
> 
>> diff --git a/elf/dl-object.c b/elf/dl-object.c
>> index 1875599eb2..eb2158a84b 100644
>> --- a/elf/dl-object.c
>> +++ b/elf/dl-object.c
>> @@ -175,6 +175,9 @@ _dl_new_object (char *realname, const char *libname, int type,
>>  
>>    new->l_local_scope[0] = &new->l_searchlist;
>>  
>> +  if (mode & __RTLD_AUDIT)
>> +    new->l_dont_set_tls_static = 1;
>> +
>>    /* Determine the origin.  If allocating the link map for the main
>>       executable, the realname is not known and "".  In this case, the
>>       origin needs to be determined by other means.  However, in case
> 
> Is this sufficient?  What happens if an auditor calls dlopen?  I don't
> see anything that causes that dlopen call to use __RTLD_AUDIT, so
> 
> I suspect the change in initialization logic needs to be changed for
> audit namespaces, not just each audit module contained in them.

Good point, maybe just check if nsid != LM_ID_BASE and also not
initialize for dlmopen.


More information about the Libc-alpha mailing list