From: Tejun Heo <tj@kernel.org>
To: Andrea Righi <arighi@nvidia.com>
Cc: David Vernet <void@manifault.com>,
Changwoo Min <changwoo@igalia.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH sched_ext/for-6.16] sched_ext: Avoid NULL scx_root deref in __scx_exit()
Date: Wed, 30 Apr 2025 12:47:54 -1000 [thread overview]
Message-ID: <aBKomkWrLtPvnnB9@slm.duckdns.org> (raw)
In-Reply-To: <20250430084021.348347-1-arighi@nvidia.com>
On Wed, Apr 30, 2025 at 10:40:21AM +0200, Andrea Righi wrote:
> A sched_ext scheduler may trigger __scx_exit() from a BPF timer
> callback, where scx_root may not be safely dereferenced.
>
> This can lead to a NULL pointer dereference as shown below (triggered by
> scx_tickless):
>
> BUG: kernel NULL pointer dereference, address: 0000000000000330
> ...
> CPU: 0 UID: 0 PID: 0 Comm: swapper/0 Not tainted 6.14.0-virtme #1 PREEMPT(full)
> RIP: 0010:__scx_exit+0x2b/0x190
> ...
> Call Trace:
> <IRQ>
> scx_bpf_get_idle_smtmask+0x59/0x80
> bpf_prog_8320d4217989178c_dispatch_all_cpus+0x35/0x1b6
> ...
> bpf_prog_97f847d871513f95_sched_timerfn+0x4c/0x264
> bpf_timer_cb+0x7a/0x140
> __hrtimer_run_queues+0x1f9/0x3a0
> hrtimer_run_softirq+0x8c/0xd0
> handle_softirqs+0xd3/0x3d0
> __irq_exit_rcu+0x9a/0xc0
> irq_exit_rcu+0xe/0x20
>
> Fix this by checking for a valid scx_root and adding proper RCU
> protection.
>
> Fixes: 48e1267773866 ("sched_ext: Introduce scx_sched")
> Signed-off-by: Andrea Righi <arighi@nvidia.com>
Applied to sched_ext/for-6.16.
Thanks.
--
tejun
prev parent reply other threads:[~2025-04-30 22:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-30 8:40 Andrea Righi
2025-04-30 22:47 ` Tejun Heo [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=aBKomkWrLtPvnnB9@slm.duckdns.org \
--to=tj@kernel.org \
--cc=arighi@nvidia.com \
--cc=changwoo@igalia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=void@manifault.com \
/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®