Chapter 42. Enabling kstack randomization offset to improve security
The kernel stack (kstack) randomization offset security feature randomizes the kernel stack location for each system call. This prevents attackers to exploit kernel vulnerabilities.
Unlike other architectures that rely on cycle counters for kstack randomization, a method that can be unreliable, 64-bit ARM (aarch64) uses the kernel’s random number generator (RNG). This approach is preferred for several reasons:
- The absence of a consistently enabled or fast cycle counter
- The lack of a ubiquitous high-frequency timer
-
Systems that do not support the v8.5
FEAT_RNGinstruction set
While the kernel RNG is generally a robust solution, it can introduce significant latency spikes, particularly for real-time (RT) workloads. As a result, the kstack randomization offset feature is disabled by default in the aarch64 real-time kernel. This decision, however, includes a tradeoff: it slightly reduces kernel security.
42.1. Enabling kstack randomization offset on 64-bit ARM Copy linkLink copied to clipboard!
On 64-bit ARM (aarch64) systems, the kstack randomization offset feature is disabled by default in the real-time kernel. If the potential latency is acceptable for your use case, you can re-enable this feature to improve kernel security.
Prerequisites
- You have administrator permissions.
- Your system is running on 64-bit ARM (aarch64) architecture.
Procedure
Enable the
randomize_kstack_offsetkernel parameter by usinggrubby.# grubby --update-kernel=ALL --args="randomize_kstack_offset=y"Reboot the system for changes to take effect.
# reboot
Verification
Check that the
randomize_kstack_offset=yparameter is specified in the/proc/cmdlinefile.# cat /proc/cmdlineThe output includes
randomize_kstack_offset=y.