[PATCH RFC] elf: Implement glibc.elf.map_shared tunable

Florian Weimer fweimer@redhat.com
Mon Sep 28 13:13:23 GMT 2026


* Mark Wielaard:

> Hi Florian,
>
> On Mon, Sep 28, 2026 at 01:38:13PM +0200, Florian Weimer wrote:
>> >> @@ -3830,3 +3831,5 @@ LDFLAGS-tst-origin-secure-victim += \
>> >>  $(objpfx)tst-origin-secure.out: $(objpfx)tst-origin-secure-victim \
>> >>  			       $(objpfx)libtst-origin-secure-mod.so \
>> >>  			       $(objpfx)tst-origin-secure-evilmod.so
>> >> +
>> >> +tst-elf-map_shared-TUNABLES += glibc.elf.map_shared=1
>> >
>> > This part doesn't seem to work in my backport.
>> 
>> Yes, you have to use
>> 
>> tst-elf-map_shared-ENV += GLIBC_TUNABLES=glibc.elf.map_shared=1
>> 
>> instead.  (*-TUNABLES seems to be a fairly recent addition.)
>
> Thanks, that works indeed, the test now passes as expected.
>
>> >> diff --git a/elf/dl-map-segments.h b/elf/dl-map-segments.h
>> >> index 1854fab7dc..ce710fe23f 100644
>> >> --- a/elf/dl-map-segments.h
>> >> +++ b/elf/dl-map-segments.h
>> >> @@ -22,13 +22,29 @@
>> >>  
>> >>  /* Map a segment and align it properly.  */
>> >>  
>> >> +/* Replace MAP_PRIVATE with MAP_SHARED if glibc.elf.map_shared=1 is
>> >> +   active and the mapping is not writable.  */
>> >
>> > Note the comment of the next function is now misplaced before the
>> > comment to this function.
>> 
>> I thought the comment applied to the entire file.
>
> Fair. I didn't know if each function needs a comment.

May I consider this a proper review for inclusion into the glibc
sources?

Thanks,
Florian



More information about the Libc-alpha mailing list