Re: [RFC PATCH 10/14] x86: Create virtual memory region for SLUB

From: Kees Cook
Date: Fri Sep 15 2023 - 17:14:39 EST


On Fri, Sep 15, 2023 at 10:59:29AM +0000, Matteo Rizzo wrote:
> From: Jann Horn <jannh@xxxxxxxxxx>
>
> SLAB_VIRTUAL reserves 512 GiB of virtual memory and uses them for both
> struct slab and the actual slab memory. The pointers returned by
> kmem_cache_alloc will point to this range of memory.

I think the 512 GiB limit may be worth mentioning in the Kconfig help
text.

And in the "640K is enough for everything" devil's advocacy, why is 512
GiB enough here? Is there any greater risk of a pathological allocation
pattern breaking a system any more (or less) than is currently possible?
>
> Signed-off-by: Jann Horn <jannh@xxxxxxxxxx>

But, yes, I'm still a fan, and I think it interacts well here with the
rest of the KASLR initialization:

Reviewed-by: Kees Cook <keescook@xxxxxxxxxxxx>

Have you tried to make this work on arm64? I imagine it should be
roughly as easy?

--
Kees Cook