From f4c38f0bb27cd41abef69a03495d6eaf1ac215ed Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sun, 13 Aug 2023 20:11:19 +0200 Subject: slab [SLAB_VERIFY]: Do not enable KMEM_CF_VERIFY on large slabs That would be refused by kmem_cache_compute_properties later on anyway, and prevent the kernel from booting at all. --- kern/slab.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kern/slab.c b/kern/slab.c index e26567fb..d4b6b7a3 100644 --- a/kern/slab.c +++ b/kern/slab.c @@ -814,10 +814,10 @@ void kmem_cache_init(struct kmem_cache *cache, const char *name, #endif /* SLAB_USE_CPU_POOLS */ size_t buf_size; -#if SLAB_VERIFY - cache->flags = KMEM_CF_VERIFY; -#else /* SLAB_VERIFY */ cache->flags = 0; +#if SLAB_VERIFY + if (obj_size <= PAGE_SIZE - sizeof(union kmem_bufctl) + sizeof(struct kmem_buftag)) + cache->flags |= KMEM_CF_VERIFY; #endif /* SLAB_VERIFY */ if (flags & KMEM_CACHE_VERIFY) -- cgit v1.2.3