summaryrefslogtreecommitdiff
path: root/kern
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2023-08-13 20:11:19 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-08-13 20:13:37 +0200
commitf4c38f0bb27cd41abef69a03495d6eaf1ac215ed (patch)
treed05ab20a5dfe4e1c2730c1c0ed7d81cd8ff19f1c /kern
parenta0feecf7d2c79aca27b443a983aa0d52888f8a36 (diff)
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.
Diffstat (limited to 'kern')
-rw-r--r--kern/slab.c6
1 files 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)