From 3cdc1fc4a1d84b9324dcacb756cfc597459ab284 Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Wed, 16 Dec 2015 14:59:39 +0100 Subject: [PATCH] ld.so.8: Tweaks to H.J. Lu's patch Signed-off-by: Michael Kerrisk --- man8/ld.so.8 | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/man8/ld.so.8 b/man8/ld.so.8 index da3340499..430b39084 100644 --- a/man8/ld.so.8 +++ b/man8/ld.so.8 @@ -474,13 +474,22 @@ If set to a nonempty string, warn about unresolved symbols. .TP .B LD_PREFER_MAP_32BIT_EXEC (x86-64 only)(glibc since 2.23) -According to Silvermont software optimization guide, for 64-bit +According to the Intel Silvermont software optimization guide, for 64-bit applications, branch prediction performance can be negatively impacted when the target of a branch is more than 4GB away from the branch. -If set, ld.so will try to map executable pages with MAP_32BIT first. -NB: MAP_32BIT will map to lower 2GB, not lower 4GB, address. Since -MAP_32BIT reduces bits available for address space layout randomization -(ASLR), LD_PREFER_MAP_32BIT_EXEC is always disabled for SUID programs. +If this environment variable is set (to any value), +.BR ld.so +will first try to map executable pages using the +.BR mmap (2) +.BR MAP_32BIT +flag, and fall back to mapping without that flag if that attempt fails. +NB: MAP_32BIT will map to the low 2GB (not 2GB) of the address space. +Because +.B MAP_32BIT +reduces the address range available for address space layout +randomization (ASLR), +.B LD_PREFER_MAP_32BIT_EXEC +is always disabled in secure-execution mode. .TP .B LDD_ARGV0 (libc5)