From: Tejun Heo <tj@kernel.org>
To: sashiko-reviews@lists.linux.dev
Cc: sched-ext@lists.linux.dev
Subject: Re: [PATCH 2/2] sched_ext: Make scx_bpf_events() read the calling scheduler's counters
Date: Fri, 14 Aug 2026 23:35:25 -1000 [thread overview]
Message-ID: <db213c23e9faf8f5871bd0307fbd97e5@kernel.org> (raw)
In-Reply-To: <20260815060403.0C69F1F000E9@smtp.kernel.org>
Hello,
> If a BPF_PROG_TYPE_TRACING or BPF_PROG_TYPE_SYSCALL program is associated
> with a different struct_ops map (like tcp_congestion_ops), the pointer is
> blindly cast to struct sched_ext_ops *.
>
> Since struct sched_ext_ops is much larger than other struct_ops structures,
> reading ops->priv could read memory well past the end of the map allocation
> and cause a kernel panic when the garbage value is dereferenced as a
> struct scx_sched *.
The hole exists but reaching it requires the privileged userspace to
deliberately associate its own tracing or syscall program with a wrong type
of struct_ops map and then call SCX kfuncs from it. Association is an
explicit per-program operation, so this can't happen accidentally. The
right fix is rejecting the association of a program which uses SCX kfuncs
with a non-sched_ext struct_ops map at association time, which the
association path has enough information to do. Will worry about it later.
Thanks.
--
tejun
next prev parent reply other threads:[~2026-08-15 9:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-15 5:51 [PATCHSET sched_ext/for-7.3] sched_ext: Misc fixes Tejun Heo
2026-08-15 5:51 ` [PATCH 1/2] sched_ext: Drop unlocked scx_rq_clock_invalidate() from scx_root_disable() Tejun Heo
2026-08-15 6:03 ` sashiko-bot
2026-08-15 9:42 ` [PATCH v2 " Tejun Heo
2026-08-15 5:51 ` [PATCH 2/2] sched_ext: Make scx_bpf_events() read the calling scheduler's counters Tejun Heo
2026-08-15 6:04 ` sashiko-bot
2026-08-15 9:35 ` Tejun Heo [this message]
2026-08-15 10:03 ` [PATCHSET sched_ext/for-7.3] sched_ext: Misc fixes Tejun Heo
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=db213c23e9faf8f5871bd0307fbd97e5@kernel.org \
--to=tj@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=sched-ext@lists.linux.dev \
/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