]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
sysctl: improve KASLR effectiveness for mmap
authorPeter Müller <peter.mueller@ipfire.org>
Thu, 4 Jul 2019 19:15:00 +0000 (19:15 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 4 Jul 2019 10:22:13 +0000 (11:22 +0100)
By feeding more random bits into mmap allocation, the
effectiveness of KASLR will be improved, making attacks
trying to bypass address randomisation more difficult.

Changed sysctl values are:

vm.mmap_rnd_bits = 32 (default: 28)
vm.mmap_rnd_compat_bits = 16 (default: 8)

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
config/etc/sysctl.conf

index 9a943fffa886430d4d45078f19f5b3dbc796bbb6..5a67f179550f719ef67dad90206b665db70740d1 100644 (file)
@@ -45,6 +45,10 @@ kernel.kptr_restrict = 2
 # Avoid kernel memory address exposures via dmesg.
 kernel.dmesg_restrict = 1
 
+# Improve KASLR effectiveness for mmap
+vm.mmap_rnd_bits = 32
+vm.mmap_rnd_compat_bits = 16
+
 # Minimal preemption granularity for CPU-bound tasks:
 # (default: 1 msec#  (1 + ilog(ncpus)), units: nanoseconds)
 kernel.sched_min_granularity_ns = 10000000