Clarify code comments on ASLR default settings

Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Ed Maste 2022-08-05 10:01:07 -04:00
parent dc3509f1aa
commit f0687f3e0e

View File

@ -173,10 +173,9 @@ SYSCTL_NODE(__CONCAT(_kern_elf, __ELF_WORD_SIZE), OID_AUTO, aslr,
#define ASLR_NODE_OID __CONCAT(__CONCAT(_kern_elf, __ELF_WORD_SIZE), _aslr)
/*
* While for 64-bit machines ASLR works properly, there are
* still some problems when using 32-bit architectures. For this
* reason ASLR is only enabled by default when running native
* 64-bit non-PIE executables.
* Enable ASLR by default for 64-bit non-PIE binaries. 32-bit architectures
* have limited address space (which can cause issues for applications with
* high memory use) so we leave it off there.
*/
static int __elfN(aslr_enabled) = __ELF_WORD_SIZE == 64;
SYSCTL_INT(ASLR_NODE_OID, OID_AUTO, enable, CTLFLAG_RWTUN,
@ -185,7 +184,7 @@ SYSCTL_INT(ASLR_NODE_OID, OID_AUTO, enable, CTLFLAG_RWTUN,
": enable address map randomization");
/*
* Enable ASLR only for 64-bit PIE binaries by default.
* Enable ASLR by default for 64-bit PIE binaries.
*/
static int __elfN(pie_aslr_enabled) = __ELF_WORD_SIZE == 64;
SYSCTL_INT(ASLR_NODE_OID, OID_AUTO, pie_enable, CTLFLAG_RWTUN,
@ -194,9 +193,9 @@ SYSCTL_INT(ASLR_NODE_OID, OID_AUTO, pie_enable, CTLFLAG_RWTUN,
": enable address map randomization for PIE binaries");
/*
* Sbrk is now deprecated and it can be assumed, that in most
* cases it will not be used anyway. This setting is valid only
* for the ASLR enabled and allows for utilizing the bss grow region.
* Sbrk is deprecated and it can be assumed that in most cases it will not be
* used anyway. This setting is valid only with ASLR enabled, and allows ASLR
* to use the bss grow region.
*/
static int __elfN(aslr_honor_sbrk) = 0;
SYSCTL_INT(ASLR_NODE_OID, OID_AUTO, honor_sbrk, CTLFLAG_RW,