[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4d867df02dcc3cc8f519903282f6e63b2974a461.camel@surriel.com>
Date: Tue, 23 Dec 2025 14:31:32 -0500
From: Rik van Riel <riel@...riel.com>
To: Breno Leitao <leitao@...ian.org>, Ard Biesheuvel <ardb@...nel.org>,
Catalin Marinas <catalin.marinas@....com>, Will Deacon <will@...nel.org>
Cc: linux-efi@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, puranjay@...nel.org,
usamaarif642@...il.com, kernel-team@...a.com
Subject: Re: [PATCH 2/2] kthread: Warn if mm_struct lacks user_ns in
kthread_use_mm()
On Tue, 2025-12-23 at 02:55 -0800, Breno Leitao wrote:
> 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@...ian.org>
Acked-by: Rik van Riel <riel@...riel.com>
--
All Rights Reversed.
Powered by blists - more mailing lists