Linux Security Modules development
 help / color / mirror / Atom feed
* [PATCH v2] cred: prevent slab cache merging for cred_jar
@ 2026-06-11  7:00 Mohammed EL Kadiri
  2026-09-09 21:48 ` Paul Moore
  0 siblings, 1 reply; 2+ messages in thread
From: Mohammed EL Kadiri @ 2026-06-11  7:00 UTC (permalink / raw)
  To: Paul Moore
  Cc: Serge Hallyn, Vlastimil Babka, Kees Cook, linux-security-module,
	linux-hardening, linux-kernel, Mohammed EL Kadiri

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.

Reviewed-by: Kees Cook <kees@kernel.org>
Signed-off-by: Mohammed EL Kadiri <med08elkadiri@gmail.com>
---

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(-)

diff --git a/kernel/cred.c b/kernel/cred.c
index 9676965c0981..0e4ee60a5acd 100644
--- a/kernel/cred.c
+++ b/kernel/cred.c
@@ -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);
 }
 
 /**
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] cred: prevent slab cache merging for cred_jar
  2026-06-11  7:00 [PATCH v2] cred: prevent slab cache merging for cred_jar Mohammed EL Kadiri
@ 2026-09-09 21:48 ` Paul Moore
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Moore @ 2026-09-09 21:48 UTC (permalink / raw)
  To: Mohammed EL Kadiri
  Cc: Serge Hallyn, Vlastimil Babka, Kees Cook, linux-security-module,
	linux-hardening, linux-kernel, Mohammed EL Kadiri

On Jun 11, 2026 Mohammed EL Kadiri <med08elkadiri@gmail.com> wrote:
> 
> 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.
> 
> Reviewed-by: Kees Cook <kees@kernel.org>
> Signed-off-by: Mohammed EL Kadiri <med08elkadiri@gmail.com>
> ---
> 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-09 21:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-11  7:00 [PATCH v2] cred: prevent slab cache merging for cred_jar Mohammed EL Kadiri
2026-09-09 21:48 ` Paul Moore

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox