[PATCH] exit: use READ_ONCE() to read mm->owner
From: Mani Tofigh via B4 Relay
Date: Tue Oct 27 2026 - 16:10:09 EST
From: Mani Tofigh <mt4022@xxxxxxxxxxxx>
mm->owner is written with WRITE_ONCE() when ownership moves to another
task, but mm_update_next_owner() reads it with a plain load. The race
is expected, so read it with READ_ONCE() to match the writer.
[ 14.915975] BUG: KCSAN: data-race in mm_update_next_owner / try_to_set_owner
[ 14.916154] write (marked) to 0xff11000004471b80 of 8 bytes by task 71 on cpu 0:
[ 14.916204] try_to_set_owner+0x100/0x140
[ 14.916302] mm_update_next_owner+0x177/0x300
...
[ 14.917246] read to 0xff11000004471b80 of 8 bytes by task 75 on cpu 1:
[ 14.917293] mm_update_next_owner+0x2a/0x300
[ 14.917396] do_exit+0x575/0x18b0
...
[ 14.923906] value changed: 0xff1100002ec04180 -> 0xff1100002ed3a0c0
Found with KCSAN while fuzzing under a deterministic hypervisor that's
currently under development.
Signed-off-by: Mani Tofigh <mt4022@xxxxxxxxxxxx>
---
kernel/exit.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/exit.c b/kernel/exit.c
index d5e7bc2af804..cc78596db74d 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -494,7 +494,7 @@ void mm_update_next_owner(struct mm_struct *mm)
* If the exiting or execing task is not the owner, it's
* someone else's problem.
*/
- if (mm->owner != p)
+ if (READ_ONCE(mm->owner) != p)
return;
/*
* The current owner is exiting/execing and there are no other
---
base-commit: d135ab453a7400a34930bdda1ef4bdc8acfac80e
change-id: 20261027-kcsan-exit-109dce625d81
Best regards,
--
Mani Tofigh <mt4022@xxxxxxxxxxxx>