[PATCH] sched_ext: Validate cid override before updating tables
"zhidao su (Xiaomi)" <[email protected]> Tue, 14 Jul 2026 10:47:04 +0800
| Newsgroups | dev.linux.lists.sched-ext,org.kernel.vger.bpf,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
scx_bpf_cid_override() currently updates the cid lookup tables as it walks the user supplied mapping. If validation fails midway, earlier entries may remain installed. Split validation and table updates so a failed override leaves the existing mapping unchanged. Signed-off-by: zhidao su (Xiaomi) <[email protected]> --- kernel/sched/ext/cid.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kernel/sched/ext/cid.c b/kernel/sched/ext/cid.c index f31113b080e9..9e3a466f296f 100644 --- a/kernel/sched/ext/cid.c +++ b/kernel/sched/ext/cid.c @@ -329,6 +329,11 @@ __bpf_kfunc void scx_bpf_cid_override(const s32 *cpu_to_cid, u32 cpu_to_cid__sz, scx_error(sch, "cid %d assigned to multiple cpus", c); return; } + } + + for_each_possible_cpu(cpu) { + s32 c = cpu_to_cid[cpu]; + scx_cpu_to_cid_tbl[cpu] = c; scx_cid_to_cpu_tbl[c] = cpu; } -- 2.43.0