cred: prevent slab cache merging for cred_jar
Subsystems (2)
PATCH v2 1/1 cred: prevent slab cache merging for cred_jar
Add SLAB_NO_MERGE to cred_jar to ensure struct cred objects get dedicated slab pages, preventing the allocator from merging this cache with other similarly-sized caches. This is a hardening measure to provide type isolation for credential objects.
---
Changes in v2:
- Collected Reviewed-by tag from Kees Cook.
- No code changes from v1.
kernel/cred.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/cred.c +1 -1
@@ -557,7 +557,7 @@ void __init cred_init(void) {/* allocate a slab in which we can store credentials */ cred_jar =KMEM_CACHE (cred, -SLAB_HWCACHE_ALIGN |SLAB_PANIC |SLAB_ACCOUNT ); +SLAB_HWCACHE_ALIGN |SLAB_PANIC |SLAB_ACCOUNT |SLAB_NO_MERGE ); }/**
Signature · 1 line
2.43.0
Quoted 8 lines · On Jun 11, 2026 Mohammed EL Kadiri <[email protected]> wrote:
Add
SLAB_NO_MERGEtocred_jarto ensure struct cred objects get dedicated slab pages, preventing the allocator from merging this cache with other similarly-sized caches. This is a hardening measure to provide type isolation for credential objects.Reviewed-by Kees Cook <[email protected]>Signed-off-by Mohammed EL Kadiri <[email protected]>
Quoted 7 lines
---
Changes in v2:
- Collected Reviewed-by tag from Kees Cook.
- No code changes from v1.kernel/cred.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Merged into lsm/dev, thanks!
--
paul-moore.com