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

From: Linus Torvalds
Date: Mon Mar 04 2024 - 18:21:23 EST


On Mon, 4 Mar 2024 at 14:08, Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
>
> Fine, I'll just remove the precision as that's not needed. There was no
> other overflows involved here.

I really want you to add the size check on the trace buffer *creation* side.

I don't understand why you refuse to accept the fact that the
precision warning found a PROBLEM.

And no, the fix was never to paper over the problem by limiting the
precision field. Hiding a problem isn't fixing it.

And no, the fix was also never to chop up the printing of the string
in smaller pieces to hide paper over the precision field. Again,
hiding a problem isn't fixing it.

And finally, NO, the fix was also never to add extra debug code to see
that there was a NUL character there.

The fix was *always* to simply not accept insanely long strings in the
first place, and make sure that the field was correctly *set*.

IOW, at *creation* time the code needed a proper check for length
(which obviously indirectly includes checking for the terminating NUL
character at that point).

Why do these threads with you always have to end up this long? Why do
I Nhave to explain every single step of the way that you need to *FIX*
the problem, not try to hide it with new extra code.

Linus