I don't know a way to read it, besides the obvious (but unreliable) /boot/config-`uname -r`. There is /proc/sys/vm/mmap_min_addr, but this is actually a separate control; see the kernel's security/min_addr.c. So on Fedora that sysctl is only 4096 even while LSM is 65536.
Yay Linux. However, if it really doesn't matter that the mmap is so low, then why not pick somewhere arbitrary for the starting point? The 32-bit case is using loAddr=0x50000000. The 64-bit case could use the same, or choose some other wild loAddr in the huge address space.
For that matter, why do you want mmap in specific ranges at all? If you don't care where this ends up, then just mmap(NULL,...) and let the kernel find an open address in a single syscall.
So that we can allocate "close" to original code for instrumentation, where "close" means "within branch range". So for 32-bit it doesn't matter, since there's a 5-byte jump. For 64-bit it's actually important.
Drew
-- Andrew Bernat Paradyn Project
|