From: Tejun Heo <tj@kernel.org>
To: Andrea Righi <arighi@nvidia.com>
Cc: David Vernet <void@manifault.com>,
Changwoo Min <changwoo@igalia.com>,
Masoud Aghasi <maghasi@disroot.org>,
sched-ext@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH sched_ext/for-7.4-fixes] sched_ext: Fix unbounded format string reads in the bstr kfuncs
Date: Mon, 30 Nov 2026 05:36:25 -1000 [thread overview]
Message-ID: <9a62510c0dd0fe29ed5a40e89aa80e83@kernel.org> (raw)
In-Reply-To: <20261130075303.1261456-1-arighi@nvidia.com>
Hello, Andrea.
On Mon, Nov 30, 2026 at 08:53:03AM +0100, Andrea Righi wrote:
> @@ -11513,11 +11535,11 @@ __bpf_kfunc void scx_bpf_dump_bstr(char *fmt, unsigned long long *data,
> }
>
> /* append the formatted string to the line buf */
> - ret = __bstr_format(sch, buf->data, buf->line + dd->cursor,
> + ret = __bstr_format(sch, buf->data, buf->fmt, buf->line + dd->cursor,
> sizeof(buf->line) - dd->cursor, fmt, data, data__sz);
The reentrancy that sashiko pointed out reproduces. With an fexit program
on bpf_bprintf_prepare() calling scx_bpf_dump() on the dump CPU and the
outer call passing no args, bstr_printf() runs the inner format on NULL
bin_args:
KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
RIP: 0010:strlen+0x25/0x70
Call Trace:
<IRQ>
bstr_printf+0x182/0x8d0
__bstr_format+0x12e/0x1b0
scx_bpf_dump_bstr+0xe2/0x310
bpf_prog_1088b804fb0352ba_bstr_dump+0x117/0x1ce
bpf__sched_ext_ops_dump+0x48/0xa4
scx_dump_state+0x4b9/0xe00
scx_disable_irq_workfn+0x7b/0xf0
Without the patch, the same test only loses dump lines, so the oops is new
with the shared buf->fmt. scx_kfunc_ids_no_tracing was added in this cycle
and this is headed to stable, so can you close it in this patch instead of
a follow-up?
Thanks.
--
tejun
prev parent reply other threads:[~2026-11-30 15:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 7:53 [PATCH sched_ext/for-7.4-fixes] sched_ext: Fix unbounded format string reads in the bstr kfuncs Andrea Righi
2026-11-30 10:49 ` Masoud Aghasi
2026-11-30 11:03 ` Andrea Righi
2026-11-30 15:36 ` 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=9a62510c0dd0fe29ed5a40e89aa80e83@kernel.org \
--to=tj@kernel.org \
--cc=arighi@nvidia.com \
--cc=changwoo@igalia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maghasi@disroot.org \
--cc=sched-ext@lists.linux.dev \
--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