From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Tremer To: development@lists.ipfire.org Subject: Re: [PATCH] linux: Do not allow slab caches to be merged Date: Mon, 01 Aug 2022 21:19:26 +0100 Message-ID: <6477003F-E0BE-41D3-8401-C3002A933230@ipfire.org> In-Reply-To: <8bb7718c-1f3b-1882-c081-4b3d31dcda9f@ipfire.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1720423474667910046==" List-Id: --===============1720423474667910046== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable And there are no downsides to this whatsoever? > On 1 Aug 2022, at 18:39, Peter M=C3=BCller wro= te: >=20 > From the kernel documentation: >=20 >> For reduced kernel memory fragmentation, slab caches can be >> merged when they share the same size and other characteristics. >> This carries a risk of kernel heap overflows being able to >> overwrite objects from merged caches (and more easily control >> cache layout), which makes such heap attacks easier to exploit >> by attackers. By keeping caches unmerged, these kinds of exploits >> can usually only damage objects in the same cache. [...] >=20 > Thus, it is more sane to leave slab merging disabled. KSPP and ClipOS > recommend this as well. >=20 > Signed-off-by: Peter M=C3=BCller > --- > config/kernel/kernel.config.aarch64-ipfire | 2 +- > config/kernel/kernel.config.armv6l-ipfire | 2 +- > config/kernel/kernel.config.riscv64-ipfire | 2 +- > config/kernel/kernel.config.x86_64-ipfire | 2 +- > 4 files changed, 4 insertions(+), 4 deletions(-) >=20 > diff --git a/config/kernel/kernel.config.aarch64-ipfire b/config/kernel/ker= nel.config.aarch64-ipfire > index 9232335ff..023c3d5aa 100644 > --- a/config/kernel/kernel.config.aarch64-ipfire > +++ b/config/kernel/kernel.config.aarch64-ipfire > @@ -247,7 +247,7 @@ CONFIG_VM_EVENT_COUNTERS=3Dy > # CONFIG_SLAB is not set > CONFIG_SLUB=3Dy > # CONFIG_SLOB is not set > -CONFIG_SLAB_MERGE_DEFAULT=3Dy > +# CONFIG_SLAB_MERGE_DEFAULT is not set > CONFIG_SLAB_FREELIST_RANDOM=3Dy > CONFIG_SLAB_FREELIST_HARDENED=3Dy > CONFIG_SHUFFLE_PAGE_ALLOCATOR=3Dy > diff --git a/config/kernel/kernel.config.armv6l-ipfire b/config/kernel/kern= el.config.armv6l-ipfire > index dc0aee51b..b4587826e 100644 > --- a/config/kernel/kernel.config.armv6l-ipfire > +++ b/config/kernel/kernel.config.armv6l-ipfire > @@ -250,7 +250,7 @@ CONFIG_VM_EVENT_COUNTERS=3Dy > # CONFIG_SLAB is not set > CONFIG_SLUB=3Dy > # CONFIG_SLOB is not set > -CONFIG_SLAB_MERGE_DEFAULT=3Dy > +# CONFIG_SLAB_MERGE_DEFAULT is not set > CONFIG_SLAB_FREELIST_RANDOM=3Dy > CONFIG_SLAB_FREELIST_HARDENED=3Dy > CONFIG_SHUFFLE_PAGE_ALLOCATOR=3Dy > diff --git a/config/kernel/kernel.config.riscv64-ipfire b/config/kernel/ker= nel.config.riscv64-ipfire > index 0801f4389..fb7cda4dd 100644 > --- a/config/kernel/kernel.config.riscv64-ipfire > +++ b/config/kernel/kernel.config.riscv64-ipfire > @@ -230,7 +230,7 @@ CONFIG_VM_EVENT_COUNTERS=3Dy > # CONFIG_SLAB is not set > CONFIG_SLUB=3Dy > # CONFIG_SLOB is not set > -CONFIG_SLAB_MERGE_DEFAULT=3Dy > +# CONFIG_SLAB_MERGE_DEFAULT is not set > CONFIG_SLAB_FREELIST_RANDOM=3Dy > CONFIG_SLAB_FREELIST_HARDENED=3Dy > CONFIG_SHUFFLE_PAGE_ALLOCATOR=3Dy > diff --git a/config/kernel/kernel.config.x86_64-ipfire b/config/kernel/kern= el.config.x86_64-ipfire > index 40975b5fc..d3792cbb7 100644 > --- a/config/kernel/kernel.config.x86_64-ipfire > +++ b/config/kernel/kernel.config.x86_64-ipfire > @@ -270,7 +270,7 @@ CONFIG_VM_EVENT_COUNTERS=3Dy > # CONFIG_SLAB is not set > CONFIG_SLUB=3Dy > # CONFIG_SLOB is not set > -CONFIG_SLAB_MERGE_DEFAULT=3Dy > +# CONFIG_SLAB_MERGE_DEFAULT is not set > CONFIG_SLAB_FREELIST_RANDOM=3Dy > CONFIG_SLAB_FREELIST_HARDENED=3Dy > CONFIG_SHUFFLE_PAGE_ALLOCATOR=3Dy > --=20 > 2.35.3 --===============1720423474667910046==--