summaryrefslogtreecommitdiff
path: root/security/keys
diff options
context:
space:
mode:
authorMohammed EL Kadiri <med08elkadiri@gmail.com>2026-06-10 07:50:52 +0100
committerJarkko Sakkinen <jarkko@kernel.org>2026-06-15 15:19:13 +0300
commit0934c38b12bd838cc133d5895fc8b42c2c1717ee (patch)
tree5b459f86e1f72e2299370f46b1935a4007e87a36 /security/keys
parent44b9597fea4b4d6d79d8b70a297ea425e05543c1 (diff)
downloadlinux-next-0934c38b12bd838cc133d5895fc8b42c2c1717ee.tar.gz
linux-next-0934c38b12bd838cc133d5895fc8b42c2c1717ee.zip
keys: prevent slab cache merging for key_jar
Add SLAB_NO_MERGE to key_jar to prevent the allocator from merging it with other similarly-sized caches. This hardens struct key isolation by ensuring dedicated slab pages. Acked-by: Vlastimil Babka (SUSE) <vbabka@kernel.org> Signed-off-by: Mohammed EL Kadiri <med08elkadiri@gmail.com> Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org> Link: https://lore.kernel.org/r/20260610065052.9120-1-med08elkadiri@gmail.com Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Diffstat (limited to 'security/keys')
-rw-r--r--security/keys/key.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/security/keys/key.c b/security/keys/key.c
index 091ee084bc30..b34a64d81d47 100644
--- a/security/keys/key.c
+++ b/security/keys/key.c
@@ -1275,7 +1275,7 @@ void __init key_init(void)
{
/* allocate a slab in which we can store keys */
key_jar = kmem_cache_create("key_jar", sizeof(struct key),
- 0, SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL);
+ 0, SLAB_HWCACHE_ALIGN | SLAB_PANIC | SLAB_NO_MERGE, NULL);
/* add the special key types */
list_add_tail(&key_type_keyring.link, &key_types_list);