From: Valentin Schneider <vschneid@redhat.com>
To: Breno Leitao <leitao@debian.org>, Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>
Cc: linux-kernel@vger.kernel.org, tj@kernel.org,
kernel-team@meta.com, Breno Leitao <leitao@debian.org>
Subject: Re: [PATCH] sched: Fix NULL pointer dereference in sched_mm_cid_fork()
Date: Fri, 09 Jan 2026 10:15:17 +0100 [thread overview]
Message-ID: <xhsmho6n3no4a.mognet@vschneid-thinkpadt14sgen2i.remote.csb> (raw)
In-Reply-To: <20251230-sched-v1-1-dd4b2a21cef4@debian.org>
On 30/12/25 06:34, Breno Leitao wrote:
> Function sched_mm_cid_fork() contains a WARN_ON_ONCE() check that
> triggers when mm is NULL, but execution continues regardless, leading to
> a NULL pointer dereference when attempting to lock &mm->mm_cid.mutex.
>
> Unable to handle kernel NULL pointer dereference at virtual address 00000000000001e0
> [00000000000001e0] user address but active_mm is swapper
> Internal error: Oops: 0000000096000005 [#1] SMP
> Modules linked in:
> CPU: 9 UID: 0 PID: 1 Comm: swapper/0 Tainted:
> pc : __mutex_lock_common
> Call trace:
> __mutex_lock_common
> mutex_lock_nested
> sched_mm_cid_fork
> sched_mm_cid_after_execve
> bprm_execve
>
> This crash can occur during execve() failure paths where
> sched_mm_cid_after_execve() is called with a task that has a NULL mm.
>
> Fix this by making the function return early if the WARN_ON_ONCE()
> condition is true, preventing the NULL pointer dereference.
>
> Signed-off-by: Breno Leitao <leitao@debian.org>
> ---
> I've inadvertently reproduced this bug by booting the kernel with an
> init binary from a different architecture.
>
> Specifically, I cross-compiled the kernel, but the init binary was built
> for an architecture that didn't match the kernel.
>
> With the applied fix, I now see the following line instead of
> experiencing a crash.
>
> Kernel panic - not syncing: Requested init mybinary failed (error -8)
A slightly different fix is on its way, see:
https://lore.kernel.org/lkml/20251223215113.639686-1-xiyou.wangcong@gmail.com/
prev parent reply other threads:[~2026-01-09 9:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-30 14:34 Breno Leitao
2026-01-09 9:15 ` Valentin Schneider [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xhsmho6n3no4a.mognet@vschneid-thinkpadt14sgen2i.remote.csb \
--to=vschneid@redhat.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=kernel-team@meta.com \
--cc=leitao@debian.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tj@kernel.org \
--cc=vincent.guittot@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®