aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2022-08-05 14:01:07 +0000
committerEd Maste <emaste@FreeBSD.org>2022-08-05 14:01:16 +0000
commitf0687f3e0e4d09edce906308f79b312abd574553 (patch)
tree7327354c2e2e8e0b4a5522de330e4352deaa4e48
parentdc3509f1aafcd966f3dd9226115cf94b691ff3c7 (diff)
downloadsrc-f0687f3e0e4d09edce906308f79b312abd574553.tar.gz
src-f0687f3e0e4d09edce906308f79b312abd574553.zip
Clarify code comments on ASLR default settings
Sponsored by: The FreeBSD Foundation
-rw-r--r--sys/kern/imgact_elf.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c
index ca1a7aaca331..ca4c59089775 100644
--- a/sys/kern/imgact_elf.c
+++ b/sys/kern/imgact_elf.c
@@ -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,