Configure kernel to zero out memory before allocation in zIPL
An XCCDF Rule
Description
To ensure that the kernel is configured to zero out memory before allocation, check that all boot entries in/boot/loader/entries/*.conf
have init_on_alloc=1
included in its options.To ensure that new kernels and boot entries continue to zero out memory before allocation, add
init_on_alloc=1
to /etc/kernel/cmdline
.
Rationale
When the kernel configuration option init_on_alloc
is enabled,
all page allocator and slab allocator memory will be zeroed when allocated,
eliminating many kinds of "uninitialized heap memory" flaws, effectively
preventing data leaks.
- ID
- xccdf_org.ssgproject.content_rule_zipl_init_on_alloc_argument
- Severity
- Medium
- Updated
Remediation Templates
A Shell Script
# Remediation is applicable only in certain platforms
if grep -q s390x /proc/sys/kernel/osrelease && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then
# Correct BLS option using grubby, which is a thin wrapper around BLS operations
grubby --update-kernel=ALL --args="init_on_alloc=1"
# Ensure new kernels and boot entries retain the boot option
An Ansible Snippet
- name: Ensure BLS boot entries options contain init_on_alloc=1
block:
- name: 'Check how many boot entries exist '
find:
paths: /boot/loader/entries/
patterns: '*.conf'