mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] sched/isolation: avoid reading past string in isolcpus parser
@ 2026-03-09 22:02 Joseph Salisbury
  2026-03-09 22:09 ` Steven Rostedt
  0 siblings, 1 reply; 2+ messages in thread
From: Joseph Salisbury @ 2026-03-09 22:02 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot
  Cc: Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
	Valentin Schneider, linux-kernel

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: stable@vger.kernel.org
Cc: Steven Rostedt <rostedt@goodmis.org>
Assisted-by: Codex:GPT-5
Signed-off-by: Joseph Salisbury <joseph.salisbury@oracle.com>
---
v2:
 - Advance past any non-NUL separator instead of checking specifically
   for ','.

 kernel/sched/isolation.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/isolation.c b/kernel/sched/isolation.c
index ef152d401fe2..402a1e335277 100644
--- a/kernel/sched/isolation.c
+++ b/kernel/sched/isolation.c
@@ -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 */
-- 
2.47.3

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] sched/isolation: avoid reading past string in isolcpus parser
  2026-03-09 22:02 [PATCH v2] sched/isolation: avoid reading past string in isolcpus parser Joseph Salisbury
@ 2026-03-09 22:09 ` Steven Rostedt
  0 siblings, 0 replies; 2+ messages in thread
From: Steven Rostedt @ 2026-03-09 22:09 UTC (permalink / raw)
  To: Joseph Salisbury
  Cc: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
	Dietmar Eggemann, Ben Segall, Mel Gorman, Valentin Schneider,
	linux-kernel

On Mon,  9 Mar 2026 18:02:16 -0400
Joseph Salisbury <joseph.salisbury@oracle.com> wrote:

> 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: stable@vger.kernel.org
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Assisted-by: Codex:GPT-5
> Signed-off-by: Joseph Salisbury <joseph.salisbury@oracle.com>

Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>

-- Steve

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-03-09 22:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-09 22:02 [PATCH v2] sched/isolation: avoid reading past string in isolcpus parser Joseph Salisbury
2026-03-09 22:09 ` Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®