From: Andrea Righi <arighi@nvidia.com>
To: Tejun Heo <tj@kernel.org>, David Vernet <void@manifault.com>,
Changwoo Min <changwoo@igalia.com>
Cc: Masoud Aghasi <maghasi@disroot.org>,
sched-ext@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: [PATCHSET v2 sched_ext/for-7.4-fixes] sched_ext: Fix unbounded format string reads in the bstr kfuncs
Date: Mon, 30 Nov 2026 17:18:26 +0100 [thread overview]
Message-ID: <20261130161913.1379563-1-arighi@nvidia.com> (raw)
The format strings passed to the sched_ext bstr kfuncs are only checked
by the verifier to be readable for a single byte, so an unterminated
format makes bpf_bprintf_prepare() scan past the end of the BPF object
[1].
Annotating them with __str would break compatibility in both directions,
since common.bpf.h places the formats in writable .data. Instead, copy
the format into a private kernel buffer with a bounded, fault-safe read
and use only the copy for both preparation and formatting, leaving the
kfunc prototypes and the BPF-side wrappers unchanged.
[1] https://lore.kernel.org/all/20261130054957.570822-1-maghasi@disroot.org
Changes in v2:
- Add a patch to disallow scx_bpf_dump_bstr() from tracing programs,
preventing a nested call on the dumping CPU from overwriting the
format snapshot of the outer call (Sashiko)
- Link to v1: https://lore.kernel.org/r/20261130075303.1261456-1-arighi@nvidia.com
Andrea Righi (2):
sched_ext: Disallow scx_bpf_dump_bstr() from tracing programs
sched_ext: Fix unbounded format string reads in the bstr kfuncs
kernel/sched/ext/ext.c | 55 +++++++++++++++++++++++++++----------
kernel/sched/ext/internal.h | 4 +++
kernel/sched/ext/types.h | 1 +
3 files changed, 46 insertions(+), 14 deletions(-)
next reply other threads:[~2026-11-30 16:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 16:18 Andrea Righi [this message]
2026-11-30 16:18 ` [PATCH 1/2] sched_ext: Disallow scx_bpf_dump_bstr() from tracing programs Andrea Righi
2026-11-30 16:18 ` [PATCH 2/2] sched_ext: Fix unbounded format string reads in the bstr kfuncs Andrea Righi
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=20261130161913.1379563-1-arighi@nvidia.com \
--to=arighi@nvidia.com \
--cc=changwoo@igalia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maghasi@disroot.org \
--cc=sched-ext@lists.linux.dev \
--cc=tj@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®