linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Daniel Bristot de Oliveira <bristot@kernel.org>,
	Kalesh Singh <kaleshsingh@google.com>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [GIT PULL] tracing: Three small fixes for 5.16
Date: Sun, 14 Nov 2021 12:43:09 -0500	[thread overview]
Message-ID: <20211114124309.799dc917@rorschach.local.home> (raw)
In-Reply-To: <CAHk-=wjREUihCGrtRBwfX47y_KrLCGjiq3t6QtoNJpmVrAEb1w@mail.gmail.com>

On Sat, 13 Nov 2021 10:26:29 -0800
Linus Torvalds <torvalds@linux-foundation.org> wrote:

> On Sat, Nov 13, 2021 at 5:35 AM Steven Rostedt <rostedt@goodmis.org> wrote:
> >
> >  - Copy just actual size of histogram strings  
> 
> I have pulled this, but I think it's wrong. Or at least it looks
> _very_ suspicious.
> 
> > -                       strscpy(str, val_str, STR_VAR_LEN_MAX);
> > +                       strscpy(str, val_str, val->size);  
> 
> So now it doesn't overrun the source string any more, but I don't see
> what protects it from not overrunning the destination - which is
> indeed STR_VAR_LEN_MAX.
> 
> Maybe 'val->size' is guaranteed to be sufficiently limited, but that
> sure as hell isn't obvious at least lkocally.

Ideally this should be checked on the time the histogram is created.
But looking into it, the size could be determined by the size of a
string of an event field. Now in practice, no event field should be
bigger than 256 bytes, but nothing prevents it from happening.

I'll add logic here to include:

	size = min(val->size, STR_VAR_LEN_MAX);

and use that instead.

-- Steve

  reply	other threads:[~2021-11-14 17:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-13 13:35 [GIT PULL] tracing: Three small fixes for 5.16 Steven Rostedt
2021-11-13 18:26 ` Linus Torvalds
2021-11-14 17:43   ` Steven Rostedt [this message]
2021-11-13 19:15 ` pr-tracker-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211114124309.799dc917@rorschach.local.home \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=bristot@kernel.org \
    --cc=kaleshsingh@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=mingo@kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).