[PATCH v3 15/32] elf: Remove run-time-writable fields from struct link_map_private

Florian Weimer fweimer@redhat.com
Sun Feb 2 17:06:59 GMT 2025


* Joseph Myers:

> On Thu, 7 Dec 2023, Florian Weimer wrote:
>
>> -	  unsigned int max
>> -	    = undef_map->l_reldepsmax ? undef_map->l_reldepsmax * 2 : 10;
>> +	  unsigned int max;
>> +	  if (undef_map->l_rw->l_reldepsmax > 0)
>> +	    max = undef_map->l_rw->l_reldepsmax;
>> +	  else
>> +	    max = 10;
>
> Any particular reason for the change of logic here (removing the "* 2")?
>
>> @@ -1122,8 +1125,6 @@ rtld_setup_main_map (struct link_map_private *main_map)
>>    main_map->l_map_end = 0;
>>    /* Perhaps the executable has no PT_LOAD header entries at all.  */
>>    main_map->l_map_start = ~0;
>> -  /* And it was opened directly.  */
>> -  ++main_map->l_direct_opencount;
>>    main_map->l_contiguous = 1;
>
> I suppose this value of l_direct_opencount doesn't get used, so it doesn't 
> matter that it's no longer incremented here?

I've changed both places to merely add the l_rw indirection (and
changing the line break in the l_reldepsmax case).

Except for the l_rw initialization code and the indirection handling in
link_map_audit_state and in nptl_db, the only changes are the added l_rw
indirection now and a few changed line breaks.

>> +  /* Reference count for dlopen/dlclose.  See the l_direct_opencount
>> +     accessor function below.  */
>> +  unsigned int l_direct_opencount;
>
> I don't see any such accessor function in this patch.

I updated the comment.

Thanks,
Florian



More information about the Libc-alpha mailing list