[PATCH v5] elf: parse /proc/self/maps as the last resort to find the gap for tst-link-map-contiguous-ldso

Xi Ruoyao xry111@xry111.site
Mon Feb 23 16:56:00 GMT 2026


On Fri, 2026-02-13 at 11:06 -0300, Adhemerval Zanella Netto wrote:
> 
> 
> On 03/02/26 05:20, Xi Ruoyao wrote:
> > The initialization process of libc.so calls mmap() several times and the
> > kernel may lay the maps into the gap.  If all pages in the gap are
> > occupied, the test would not be able to find the gap with mmap() and the
> > test would fail.
> > 
> > The failure reproduces most frequently on LoongArch because with the
> > commonly used page size (16 KiB) the gap only contains 4 pages and the
> > probability they are all occupied is not near to zero.
> > 
> > With the changes in the patch, a test run may output:
> > 
> >     info: ld.so link map is not contiguous
> >     info: object "/dev/zero" found at 0x7ffff1fe0000 - 0x7ffff1fe4000
> >     info: anonymous mapping found at 0x7ffff1fe4000 - 0x7ffff1fec000
> > 
> > Also take the chance to fix a mistake in the "object found at" message
> > which has puzzled me during the initial debug session.
> > 
> > Signed-off-by: Xi Ruoyao <xry111@xry111.site>
> 
> I think this version addresses the missing point raised by Florian.
> 
> LGTM, thanks.
> 
> Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

I don't have the write access, please push for me if no objections from
others.

-- 
Xi Ruoyao <xry111@xry111.site>


More information about the Libc-alpha mailing list