From: Masami Hiramatsu <mhiramat@kernel.org>
To: Ingo Molnar <mingo@kernel.org>, Steven Rostedt <rostedt@goodmis.org>
Cc: Masami Hiramatsu <mhiramat@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: [PATCH V2 1/2] tracing/probes: Fix a warning message to show correct maximum length
Date: Fri, 10 Feb 2017 22:21:55 +0900 [thread overview]
Message-ID: <148673290462.2579.7966778294009665632.stgit@devbox> (raw)
In-Reply-To: <20170210075302.GB24405@gmail.com>
In-Reply-To: <20170210075302.GB24405@gmail.com>
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.
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.
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;
}
next prev parent reply other threads:[~2017-02-10 13:23 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 ` Masami Hiramatsu [this message]
2017-02-10 16:04 ` [PATCH V2 1/2] tracing/probes: Fix a warning message to show correct maximum length Steven Rostedt
2017-02-15 15:10 ` Masami Hiramatsu
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=148673290462.2579.7966778294009665632.stgit@devbox \
--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