[PATCH 3/4] elf: align ET_DYN base to exec folio order for contpte mapping
From: WANG Rui
Date: Fri Mar 13 2026 - 10:46:36 EST
Hi Usama,
Glad to see you're pushing on this, I'm also following it. I first noticed this when rustc's perf regressed after a binutils upgrade. I'm trying to make ld.so to aware THP and adjust PT_LOAD alignment to increase the chances of shared libraries being mapped by THP [1]. As you're probably seen, I'm doing something similar in the kernel to improve it for executables [2].
> + if (exec_folio_order())
> + alignment = max(alignment,
> + (unsigned long)PAGE_SIZE << exec_folio_order());
I’m curious, does it make sense to add some constraints here, like only increasing p_align when the segment length, virtual address, and file offset are all huge-aligned, as I did in my patch? This has come up several times in the glibc review, where increasing alignment was noted to reduce ASLR entropy.
[1] https://sourceware.org/pipermail/libc-alpha/2026-March/175776.html
[2] https://lore.kernel.org/linux-fsdevel/20260313005211.882831-1-r@xxxxxx
Thanks,
Rui