1
0
mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2026-01-12 09:32:12 +00:00
Breno Leitao cfe54f4591 kthread: Warn if mm_struct lacks user_ns in kthread_use_mm()
Add a WARN_ON_ONCE() check to detect mm_struct instances that are
missing user_ns initialization when passed to kthread_use_mm().

When a kthread adopts an mm via kthread_use_mm(), LSM hooks and
capability checks may access current->mm->user_ns for credential
validation. If user_ns is NULL, this leads to a NULL pointer
dereference crash.

This was observed with efi_mm on arm64, where commit a5baf582f4c0
("arm64/efi: Call EFI runtime services without disabling preemption")
introduced kthread_use_mm(&efi_mm), but efi_mm lacked user_ns
initialization, causing crashes during /proc access.

Adding this warning helps catch similar bugs early during development
rather than waiting for hard-to-debug NULL pointer crashes in
production.

Signed-off-by: Breno Leitao <leitao@debian.org>
Acked-by: Rik van Riel <riel@surriel.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
2025-12-24 21:32:58 +01:00
..
2025-12-11 08:14:23 +09:00
2025-12-10 17:21:30 +09:00
2025-11-09 21:19:44 -08:00
2025-12-14 06:07:09 +12:00
2025-12-03 13:46:48 -08:00
2025-12-03 12:18:07 -08:00
2025-12-05 17:29:04 -08:00
2025-12-03 12:18:07 -08:00
2025-12-05 17:29:04 -08:00
2025-12-06 13:49:40 -08:00
2025-12-01 13:45:41 -08:00
2025-11-11 10:01:31 +01:00
2025-11-14 18:15:49 +08:00
2025-11-04 08:30:50 +01:00
2025-10-02 18:44:54 -07:00
2025-10-29 10:29:54 +01:00
2025-09-29 11:20:29 -07:00