Re: [PATCH v10 1/3] mm: Shuffle initial free memory to improve memory-side-cache utilization

From: Kees Cook
Date: Tue Feb 05 2019 - 18:11:24 EST


On Tue, Feb 5, 2019 at 10:04 PM Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> On Thu, 31 Jan 2019 21:15:17 -0800 Dan Williams <dan.j.williams@xxxxxxxxx> wrote:
>
> > +config SHUFFLE_PAGE_ALLOCATOR
> > + bool "Page allocator randomization"
> > + default SLAB_FREELIST_RANDOM && ACPI_NUMA
> > + help
>
> SLAB_FREELIST_RANDOM is default n, so this patchset won't get much
> runtime testing.
>
> How about you cook up a (-mm only) patch which makes the kernel default
> to SLAB_FREELIST_RANDOM=y, SHUFFLE_PAGE_ALLOCATOR=y (or whatever) to
> ensure we get a decent amount of runtime testing? Then I can hold that
> in -mm (and -next) until we get bored of it?

I love this plan. :)

FWIW, distros have enabled it by default for a while. Here's Ubuntu,
for example:

$ grep SLAB_FREELIST /boot/config-4.1*
/boot/config-4.15.0-45-generic:CONFIG_SLAB_FREELIST_RANDOM=y
/boot/config-4.15.0-45-generic:CONFIG_SLAB_FREELIST_HARDENED=y
/boot/config-4.18.0-13-generic:CONFIG_SLAB_FREELIST_RANDOM=y
/boot/config-4.18.0-13-generic:CONFIG_SLAB_FREELIST_HARDENED=y
/boot/config-4.18.0-14-generic:CONFIG_SLAB_FREELIST_RANDOM=y
/boot/config-4.18.0-14-generic:CONFIG_SLAB_FREELIST_HARDENED=y

and Fedora too:

$ curl -s 'https://git.kernel.org/pub/scm/linux/kernel/git/jwboyer/fedora.git/patch/fedora/configs/kernel-4.16.12-x86_64.config?h=f26'
| grep SLAB_FREELIST
+CONFIG_SLAB_FREELIST_RANDOM=y
+CONFIG_SLAB_FREELIST_HARDENED=y

--
Kees Cook