tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Statically allocated guard pages in ELF



On Fri, Mar 28, 2025 at 07:30:55PM +0000, Taylor R Campbell wrote:
 > Can it be done with an ELF trick to request a guard page instead, so
 > there's no additional syscall overhead but the kernel sets up a
 > PROT_NONE page before each table it already maps from the file?

AFAIK there's no way to have a guard page section/segment other than
by using a linker script to manipulate the address space and leave a
gap.

However, it might work to do that for the libc image provided that the
table can go in its own section. I think the dynamic loader should
preserve all the offsets between segments in a shared library,
regardless of the base load address.

And on the plus side, a gap doesn't require mprotect, nor does it
require an extra mmap if the table can be placed at the beginning of
readonly data. (iow, there isn't anything else that needs to go there)

-- 
David A. Holland
dholland%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index