All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cred: mark the copy in prepare_creds() as a data race
@ 2026-10-30  3:33 Babanpreet Singh
  2026-10-30  3:37 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Babanpreet Singh @ 2026-10-30  3:33 UTC (permalink / raw)
  To: Paul Moore
  Cc: Serge Hallyn, linux-security-module, linux-kernel,
	Babanpreet Singh, syzbot+ee58b040032d8bed63d9,
	syzbot+557fdc985d6ac3831e14

prepare_creds() copies the old cred while other tasks may be changing
its refcount. Mark as data race.

Reported-by: syzbot+ee58b040032d8bed63d9@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=ee58b040032d8bed63d9
Reported-by: syzbot+557fdc985d6ac3831e14@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=557fdc985d6ac3831e14
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Babanpreet Singh <bbnpreetsingh@gmail.com>
---
Compile tested with gcc and clang; the KCSAN instrumentation of
kernel/cred.o was checked before and after.
 kernel/cred.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/cred.c b/kernel/cred.c
index d01df40a9a386..d212db445c138 100644
--- a/kernel/cred.c
+++ b/kernel/cred.c
@@ -189,7 +189,7 @@ struct cred *prepare_creds(void)
 	kdebug("prepare_creds() alloc %p", new);
 
 	old = task->cred;
-	memcpy(new, old, sizeof(struct cred));
+	data_race(memcpy(new, old, sizeof(struct cred)));
 
 	new->non_rcu = 0;
 	atomic_long_set(&new->usage, 1);

base-commit: 881f19c2ffbc73f351b257e09c71e6059939b770
-- 
2.43.0


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

end of thread, other threads:[~2026-10-30  3:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-30  3:33 [PATCH] cred: mark the copy in prepare_creds() as a data race Babanpreet Singh
2026-10-30  3:37 ` sashiko-bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.