From: sashiko-bot@kernel.org
To: "Andrea Righi" <arighi@nvidia.com>
Cc: sched-ext@lists.linux.dev
Subject: Re: [PATCH 1/2] sched_ext: Auto-register/unregister dl_server reservations
Date: Tue, 26 May 2026 09:22:27 +0000 [thread overview]
Message-ID: <20260526092228.3B6891F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260526082954.550958-2-arighi@nvidia.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
New issues:
- [High] Bypassing the overflow check for detached deadline servers allows configuring an arbitrarily large bandwidth for offline CPUs, breaking root domain admission control upon hotplug.
Pre-existing issues:
- [High] Modifying a deadline server's bandwidth via debugfs for an offline CPU causes division-by-zero crashes.
--
commit e4e3b446a7561269980e46cfd4aec61572b0cae1
Author: Andrea Righi <arighi@nvidia.com>
sched_ext: Auto-register/unregister dl_server reservations
This commit makes deadline server bandwidth reservations dynamic by
introducing an attached/detached state. It ensures that only the currently
active scheduling policy registers its bandwidth reservation, allowing unused
bandwidth to be reclaimed without losing the configured runtime and period.
> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> index ddfd6bc63ab1d..8de5f182fd659 100644
> --- a/kernel/sched/deadline.c
> +++ b/kernel/sched/deadline.c
[ ... ]
> @@ -1907,13 +1918,16 @@ int dl_server_apply_params(struct sched_dl_entity *dl_se, u64 runtime, u64 perio
> cpus = dl_bw_cpus(cpu);
> cap = dl_bw_capacity(cpu);
>
> - if (__dl_overflow(dl_b, cap, old_bw, new_bw))
> - return -EBUSY;
> + if (init || dl_se->dl_bw_attached) {
> + if (__dl_overflow(dl_b, cap, old_bw, new_bw))
> + return -EBUSY;
> + }
[Severity: High]
Does bypassing the overflow check for detached servers allow configuring an
invalid bandwidth?
If userspace configures a massive bandwidth for an offline CPU while the
server is detached, the overflow check is skipped. Later, when the BPF
scheduler is loaded, scx_root_enable_workfn() calls dl_server_attach_bw()
for all possible CPUs. For the offline CPU, __dl_server_attach_bw_locked()
skips its own overflow check since the CPU is not active, but it still sets
dl_bw_attached = 1.
When that CPU is later brought online, the hotplug rebuild path calls
dl_server_add_bw(), which unconditionally adds the unvalidated bandwidth to
the root domain's total_bw since dl_bw_attached is now true. Could this
force the root domain into a permanently overcommitted state and break
SCHED_DEADLINE admission control?
>
> if (init) {
> __add_rq_bw(new_bw, &rq->dl);
> __dl_add(dl_b, new_bw, cpus);
> - } else {
> + dl_se->dl_bw_attached = 1;
> + } else if (dl_se->dl_bw_attached) {
> __dl_sub(dl_b, dl_se->dl_bw, cpus);
> __dl_add(dl_b, new_bw, cpus);
[Severity: High]
This isn't a bug introduced by this patch, but can modifying an attached
server's bandwidth on an offline CPU cause a division by zero?
When a CPU is offline, it belongs to a root domain with zero active CPUs, so
dl_bw_cpus() returns 0. If a user modifies the runtime/period via debugfs
for an offline CPU with an attached server, we reach this update path.
Both __dl_sub() and __dl_add() divide by cpus internally:
kernel/sched/deadline.c:__dl_sub() {
...
__dl_update(dl_b, (s32)tsk_bw / cpus);
}
Since cpus is 0, will this trigger a kernel panic and allow a local denial
of service?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260526082954.550958-1-arighi@nvidia.com?part=1
next prev parent reply other threads:[~2026-05-26 9:22 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-26 8:27 [PATCHSET v2 sched_ext/for-7.2] sched_ext: Auto-manage ext/fair dl_server bandwidth Andrea Righi
2026-05-26 8:27 ` [PATCH 1/2] sched_ext: Auto-register/unregister dl_server reservations Andrea Righi
2026-05-26 9:22 ` sashiko-bot [this message]
2026-05-26 8:27 ` [PATCH 2/2] selftests/sched_ext: Validate dl_server attach/detach in total_bw test Andrea Righi
-- strict thread matches above, loose matches on Subject: below --
2026-05-26 16:42 [PATCHSET v3 sched_ext/for-7.2] sched_ext: Auto-manage ext/fair dl_server bandwidth Andrea Righi
2026-05-26 16:42 ` [PATCH 1/2] sched_ext: Auto-register/unregister dl_server reservations Andrea Righi
2026-05-26 17:14 ` sashiko-bot
2026-05-28 11:36 ` Peter Zijlstra
2026-05-28 16:13 ` Andrea Righi
2026-05-21 17:33 [PATCHSET sched_ext/for-7.2] sched_ext: Auto-manage ext/fair dl_server bandwidth Andrea Righi
2026-05-21 17:33 ` [PATCH 1/2] sched_ext: Auto-register/unregister dl_server reservations Andrea Righi
2026-05-21 18:23 ` sashiko-bot
2026-05-22 8:36 ` Peter Zijlstra
2026-05-22 10:02 ` 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=20260526092228.3B6891F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=arighi@nvidia.com \
--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