[Devel] [PATCH rh7 0/5] slab: God mode allocations for SLABs

2024-09-06 Thread Konstantin Khorenko
We suspect some SLAB allocation failures handling code is not ideal and leads to memory corruptions, in particular we often see slab freelist corruptions. In order to minimize damage / possibility of those corruptions we have implemented several things: 1. Moved slab freelist pointer to the midd

[Devel] [PATCH rh7 2/5] ms/mm/slub: fix incorrect interpretation of s->offset

2024-09-06 Thread Konstantin Khorenko
From: Waiman Long In a couple of places in the slub memory allocator, the code uses "s->offset" as a check to see if the free pointer is put right after the object. That check is no longer true with commit 3202fa62fb43 ("slub: relocate freelist pointer to middle of object"). As a result, echoin

[Devel] [PATCH rh7 5/5] slub: introduce static_key switch for unlimited_slabs tweak

2024-09-06 Thread Konstantin Khorenko
Introduce 2 ways to setup/configure "unlimited_slabs" tweak: 1. "unlimited_slabs=" kernel boot option * "unlimited_slabs=1" to enable the tweak * "unlimited_slabs=0" to disable the tweak 2. /sys/kernel/debug/unlimited_slabs entry * echo 1 > /sys/kernel/debug/unlimited_slabs to enable

[Devel] [PATCH rh7 1/5] ms/slub: relocate freelist pointer to middle of object

2024-09-06 Thread Konstantin Khorenko
From: Kees Cook In a recent discussion[1] with Vitaly Nikolenko and Silvio Cesare, it became clear that moving the freelist pointer away from the edge of allocations would likely improve the overall defensive posture of the inline freelist pointer. My benchmarks show no meaningful change to perf

[Devel] [PATCH rh7 4/5] slab: ignore memcg limits during marked SLAB allocations

2024-09-06 Thread Konstantin Khorenko
Pretend marked SLABs are always allocated by a PF_MEMALLOC process to bypass memory cgroup limits. Added per-SLAB "pf_memalloc" attribute to disable/enable the logic on the fly. https://virtuozzo.atlassian.net/browse/PSBM-155867 Signed-off-by: Konstantin Khorenko --- include/linux/slab.h | 1

[Devel] [PATCH rh7 3/5] slub_debug: fail allocation on a bad freelist pointer

2024-09-06 Thread Konstantin Khorenko
From: Pavel Tikhomirov We saw crashes where slub percpu freelist was corrupted, this may catch the problem earlier where we first time see bad freelist, and suppress further corruption. This is enabled with 'slub_debug=F'. https://virtuozzo.atlassian.net/browse/PSBM-155867 Signed-off-by: Pavel