Re: [PATCH v13 35/36] selftests/sched: Test PI against hotplug and rebuilds in deadline_bw_test

From: sashiko-bot

Date: Tue Dec 01 2026 - 14:51:34 EST


Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] selftests/sched: out-of-bounds read in
pi_deboost_during_rebuild()
--

commit 03c5e3bed0b33b1aacdfd04e920a11ba863127a5
Author: Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx>

selftests/sched: Test PI against hotplug and rebuilds in deadline_bw_test

This commit adds the pi_departed_offline_boost and
pi_deboost_during_rebuild test cases to deadline_bw_test to test
priority inheritance against CPU hotplug and bandwidth accounting
rebuilds.

> diff --git a/tools/testing/selftests/sched/deadline/deadline_bw_test.c b/tools/testing/selftests/sched/deadline/deadline_bw_test.c
> index bca333d5498c6..e68d9437580fa 100644
> --- a/tools/testing/selftests/sched/deadline/deadline_bw_test.c
> +++ b/tools/testing/selftests/sched/deadline/deadline_bw_test.c

[ ... ]

> @@ -12596,6 +12755,320 @@ static int affinity_vs_setattr(void)
> +static int pi_deboost_during_rebuild(void)
> +{
> + int cpu[2] = { top_cpu(4), top_cpu(3) }, q_root = 1, ret = KSFT_FAIL, i;
> + long long base, bw_t, bw_w, tb;
> + char cg_r[PATH_MAX + 32], cpus[32];
> + pid_t filler = -1, proc = -1;
> + uint64_t end, d, dmax = 0;
> +
> + if (ncpus < 5) {
> + ksft_print_msg("needs 5 non-isolated CPUs\n");
> + return KSFT_SKIP;
> + }

[Severity: Low]
Can the cpu[2] initializer read out of bounds before the ncpus < 5 check?

top_cpu(n) returns online[ncpus - n], and main() runs p_cases[] as long
as ncpus >= 3. On a machine with 3 non-isolated CPUs, top_cpu(4)
reads online[-1] before the ncpus < 5 check skips the test.

--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1796146461.git.mathieu.desnoyers@xxxxxxxxxxxx?part=35