Consider enabling the init_on_alloc=1 and init_on_free=1 Linux options
We should normally have done this when upgrading to Linux 5.3, but Kees' blog post was not published yet back then.
Zero heap memory at allocation time and at free time (refs: #17236)
These options are "aimed at preventing possible information leaks and making the
control-flow bugs that depend on uninitialized values more deterministic"¹.
All kmalloc()s effectively become kzalloc()s and all kfree()s effectively become
In passing, apart of the defense-in-depth security benefits intended by the
authors of this Linux feature, init_on_free=1 may ensure we clean more kernel
memory at shutdown time.
- a negligible performance hit with init_on_alloc=1
- a 7-25% performance hit with init_on_free=1
Let's see if/how this affects our use cases.