Re: [GIT PULL] tracing: Prevent trace_marker being bigger than unsigned short

From: Linus Torvalds
Date: Mon Mar 04 2024 - 19:17:56 EST


On Mon, 4 Mar 2024 at 15:50, Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
>
> But this still isn't fixing anything. It's just adding a limit.

Limiting things to a common maximum size is a good thing. The kernel
limits much more important things for very good reasons.

The kernel really shouldn't have big strings. EVER. And it literally
shows in our kernel infrastructure. It showed in that vsnprintf
precision thing. It shows in our implementation choices, where we tend
to have simplistic implementations because doing things a byte at a
time is simple and cheap when the strings are limited in size (and we
don't want fancy and can't use vector state anyway).

If something as core as a pathname can be limited to 4kB, then
something as unimportant as a trace string had better be limited too.
Because we simply DO NOT WANT to have to deal with longer strings in
the kernel.

Linus