Re: [RFC PATCH 00/14] Prevent cross-cache attacks in the SLUB allocator

From: Lameter, Christopher
Date: Fri Sep 15 2023 - 12:31:18 EST


On Fri, 15 Sep 2023, Dave Hansen wrote:

On 9/15/23 03:59, Matteo Rizzo wrote:
The goal of this patch series is to deterministically prevent cross-cache
attacks in the SLUB allocator.

What's the cost?

The only thing that I see is 1-2% on kernel compilations (and "more on machines with lots of cores")?

Having a virtualized slab subsystem could enable other things:

- The page order calculation could be simplified since vmalloc can stitch arbitrary base pages together to form larger contiguous virtual segments. So just use f.e. order 5 or so for all slabs to reduce contention?

- Maybe we could make slab pages movable (if we can ensure that slab objects are not touched somehow. At least stop_machine run could be used to move batches of slab memory)

- Maybe we can avoid allocating page structs somehow for slab memory? Looks like this is taking a step into that direction. The metadata storage of the slab allocator could be reworked and optimized better.

Problems:

- Overhead due to more TLB lookups

- Larger amounts of TLBs are used for the OS. Currently we are trying to use the maximum mappable TLBs to reduce their numbers. This presumably means using 4K TLBs for all slab access.

- Memory may not be physically contiguous which may be required by some drivers doing DMA.