Skip to contentSkip to conversation

sched/isolation: avoid reading past string in isolcpus parser

PATCH In review Joseph Salisbury 2 participants 2 messages Mar 9 Scheduler

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 sched/isolation: avoid reading past string in isolcpus parser

The function housekeeping_isolcpus_setup() advanced the parser pointer unconditionally after unknown flags.

For an argument like 'isolcpus=unknownflag', with no trailing comma, this can move the pointer past the terminating NUL, and the next loop test reads out of bounds.

Reproducer:
isolcpus=unknownflag

Advance only when the parser is not already at the terminating NUL, preserving existing parsing semantics while avoiding the invalid read.

Fixes 3662daf02350 ("sched/isolation: Allow "isolcpus=" to skip unknown sub-parameters")
Cc Steven Rostedt <[email protected]>
Assisted-by Codex:GPT-5

---
v2:
- Advance past any non-NUL separator instead of checking specifically for ','.

 kernel/sched/isolation.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/sched/isolation.c +2 -1
index ef152d401fe2..402a1e335277 100644
@@ -355,7 +355,8 @@ static int __init housekeeping_isolcpus_setup(char *str)
 		}
 
 		pr_info("isolcpus: Skipped unknown flag %.*s\n", len, par);
-		str++;
+		if (*str)
+			str++;
 	}
 
 	/* Default behaviour for isolcpus without flags */
Signature · 1 line
2.47.3
reviewer Reviewed-by on v2 1/1
#1 lore raw
Quoted 10 lines · On Mon, 9 Mar 2026 18:02:16 -0400 Joseph Salisbury…

The function housekeeping_isolcpus_setup() advanced the parser pointer unconditionally after unknown flags.

For an argument like 'isolcpus=unknownflag', with no trailing comma, this can move the pointer past the terminating NUL, and the next loop test reads out of bounds.

Reproducer:
isolcpus=unknownflag

Quoted 8 lines

Advance only when the parser is not already at the terminating NUL, preserving existing parsing semantics while avoiding the invalid read.

Fixes 3662daf02350 ("sched/isolation: Allow "isolcpus=" to skip unknown sub-parameters")
Cc Steven Rostedt <[email protected]>
Assisted-by Codex:GPT-5

-- Steve