You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mm: Allow userspace to reserve VA range for use by userspace only
Add support for ELF binaries to reserve address ranges. Address
range can be reserved at load time by adding an ELF NOTE section, or
at run time with mprotect() with PROT_RESERVED flag. Reserved ranges
can be allocated with mmap(..... MAP_FIXED...) and shmat(....,
SHM_REMAP) later. Any reserved address ranges are annotated with
"[rsvd]" in /proc/<pid>/maps output. A binary can check if the
kernel supports VA range reservation by checking the value of
auxiliary vector AT_VA_RESERVATION.
VA reservation is done by adding a special NOTE section to binary
using declarations similar to following:
.section .note.rsvd_range, "a", @note
.p2align 2
.long 1f - 0f # name size (not including padding)
.long 3f - 2f # desc size (not including padding)
.long 0x07c10001
0: .asciz "Reserved VA" # name
1: .p2align 2
2: .quad 0x7f2000000000
.quad 0x7f2000e00000
.quad 0x7f5000200000
.quad 0x7f500d000000
3: .p2align 2
Each reserved range is specified as pair of addresses (start and
end). This note section is read by kernel elf loader and address
ranges are reserved for the lifetime of process. A maximum of 64
such entries can be made in NOTE section. Execution of a binary file
with more than 64 pairs of addresses in this note section will be
terminated with ENOEXEC.
NOTE: Kernel can not guarantee all VA ranges in the NOTE section
will be reserved. If the address range is valid but is already in
use (possibly by a shared library loaded earlier), execution of
binary will be terminated with ENOMEM.
NOTE: This feature needs two VMA flag bits. There are no free bits
available in lower 32 bits. As a result this feature can only be
supported on architectures that support high VMA flag bits (bits
32-63).
Orabug: 28438736
Signed-off-by: Khalid Aziz <[email protected]>
Reviewed-by: Konrad Rzeszutek Wilk <[email protected]>
Reviewed-by: Mike Kravetz <[email protected]>
(cherry picked from LUCI 97f7b3403bf1b2c3b4dea2e46e766aa3195a40c4)
Signed-off-by: Khalid Aziz <[email protected]>
Reviewed-by: Mike Kravetz <[email protected]>
Signed-off-by: Somasundaram Krishnasamy <[email protected]>
0 commit comments