RFC: add init_allocations=1 boot option
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest3 patches 20 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | mm: security: introduce the init_allocations=1 boot optiondrivers/ include/ include/ +10 more | +58 | 11 replies | |
| 2/3 | gfp: mm: introduce __GFP_NOINITinclude/ include/ kernel/ +3 more | +10 | 4 replies | |
| 3/3 | RFC: net: apply __GFP_NOINIT to AF_UNIX sk_buff allocationsinclude/ net/ net/ | +37 | 1 reply |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/3] RFC: add init_allocations=1 boot option
Following the recent discussions here's another take at initializing pages and heap objects with zeroes. This is needed to prevent possible information leaks and make the control-flow bugs that depend on uninitialized values more deterministic.
The patchset introduces a new boot option, init_allocations, which makes page allocator and SL[AOU]B initialize newly allocated memory. init_allocations=0 doesn't (hopefully) add any overhead to the allocation fast path (no noticeable slowdown on hackbench).
With only the the first of the proposed patches the slowdown numbers are:
- 1.1% (stdev 0.2%) sys time slowdown building Linux kernel
- 3.1% (stdev 0.3%) sys time slowdown on af_inet_loopback benchmark
- 9.4% (stdev 0.5%) sys time slowdown on hackbench
The second patch introduces a GFP flag that allows to disable initialization for certain allocations. The third page is an example of applying it to af_unix.c, which helps hackbench greatly.
Slowdown numbers for the whole patchset are:
- 1.8% (stdev 0.8%) on kernel build
- 6.5% (stdev 0.2%) on af_inet_loopback
- 0.12% (stdev 0.6%) on hackbench
Alexander Potapenko (3):
mm: security: introduce the init_allocations=1 boot option
gfp: mm: introduce __GFP_NOINIT
net: apply __GFP_NOINIT to AF_UNIX sk_buff allocations
drivers/infiniband/core/uverbs_ioctl.c | 2 +- include/linux/gfp.h | 6 ++++- include/linux/mm.h | 8 +++++++ include/linux/slab_def.h | 1 + include/linux/slub_def.h | 1 + include/net/sock.h | 5 +++++ kernel/kexec_core.c | 4 ++-- mm/dmapool.c | 2 +- mm/page_alloc.c | 18 ++++++++++++++- mm/slab.c | 14 ++++++------ mm/slab.h | 1 + mm/slab_common.c | 15 +++++++++++++ mm/slob.c | 3 ++- mm/slub.c | 9 ++++---- net/core/sock.c | 31 +++++++++++++++++++++----- net/unix/af_unix.c | 13 ++++++----- 16 files changed, 104 insertions(+), 29 deletions(-)
Signature · 1 line
2.21.0.392.gf8f6787159e-goog