From: Masami Hiramatsu <mhiramat@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@kernel.org>,
linux-kernel@vger.kernel.org,
Peter Zijlstra <peterz@infradead.org>,
Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>,
Thomas Gleixner <tglx@linutronix.de>,
"H . Peter Anvin" <hpa@zytor.com>,
Namhyung Kim <namhyung@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH V2 1/2] tracing/probes: Fix a warning message to show correct maximum length
Date: Thu, 16 Feb 2017 00:10:30 +0900 [thread overview]
Message-ID: <20170216001030.bd1ee215ea9d31289e2441ed@kernel.org> (raw)
In-Reply-To: <20170210110434.36d50ed2@gandalf.local.home>
On Fri, 10 Feb 2017 11:04:34 -0500
Steven Rostedt <rostedt@goodmis.org> wrote:
> On Fri, 10 Feb 2017 22:21:55 +0900
> Masami Hiramatsu <mhiramat@kernel.org> wrote:
>
> > Since tracing/*probe_events will accept a probe definition
> > up to 4096 - 2 ('\n' and '\0') bytes, it must show 4094 instead
> > of 4096 in warning message.
>
> Actually, during the testing I found that we don't need the '\n'.
>
> echo -n 'p:irq do_IRQ a=@jiffies_64' > kprobe_events
>
> works just fine. My tests work with 4095 characters. Before and after
> my patch.
Yeah, I see. I concider the case that if the writer writes
4095 chars command + '\n' + next command, it will fail, that
is what I pointed out below note.
> >
> > Note that there is one possible case of exceed 4094. If user
> > prepare 4096 bytes null-terminated string and syscall write
> > it with the count == 4095, then it can be accepted. However,
> > if user puts a '\n' after that, it must rejected.
> > So IMHO, the warning message should indicate shorter one,
> > since it is safer.
Thank you,
> >
> > Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
> > ---
> > kernel/trace/trace_probe.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
> > index 2a06f1f..847c1e0 100644
> > --- a/kernel/trace/trace_probe.c
> > +++ b/kernel/trace/trace_probe.c
> > @@ -678,8 +678,9 @@ ssize_t traceprobe_probes_write(struct file *file, const char __user *buffer,
> > if (done + size < count) {
> > if (buf != kbuf)
> > break;
> > + /* This can accept WRITE_BUFSIZE - 2 ('\n' + '\0') */
> > pr_warn("Line length is too long: Should be less than %d\n",
> > - WRITE_BUFSIZE);
> > + WRITE_BUFSIZE - 2);
> > ret = -EINVAL;
> > goto out;
> > }
>
--
Masami Hiramatsu <mhiramat@kernel.org>
next prev parent reply other threads:[~2017-02-15 15:10 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-09 23:04 [RFC][PATCH] tracing: Have traceprobe_probes_write() not access userspace unnecessarily Steven Rostedt
2017-02-10 5:50 ` Masami Hiramatsu
2017-02-10 7:53 ` Ingo Molnar
2017-02-10 10:37 ` Masami Hiramatsu
2017-02-10 14:05 ` Steven Rostedt
2017-02-10 13:21 ` [PATCH V2 1/2] tracing/probes: Fix a warning message to show correct maximum length Masami Hiramatsu
2017-02-10 16:04 ` Steven Rostedt
2017-02-15 15:10 ` Masami Hiramatsu [this message]
2017-02-15 15:31 ` Steven Rostedt
2017-02-10 13:23 ` [PATCH V2 2/2] tracing/probe: Show subsystem name in messages Masami Hiramatsu
2017-02-10 16:01 ` Namhyung Kim
2017-02-10 16:17 ` Steven Rostedt
2017-02-10 22:35 ` Masami Hiramatsu
2017-02-10 22:36 ` [PATCH V3] " Masami Hiramatsu
2017-02-10 6:20 ` [RFC][PATCH] tracing: Have traceprobe_probes_write() not access userspace unnecessarily Namhyung Kim
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=20170216001030.bd1ee215ea9d31289e2441ed@kernel.org \
--to=mhiramat@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=ananth@linux.vnet.ibm.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
/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