From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753295AbdBJQPF (ORCPT ); Fri, 10 Feb 2017 11:15:05 -0500 Received: from mail.kernel.org ([198.145.29.136]:39734 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752351AbdBJQPD (ORCPT ); Fri, 10 Feb 2017 11:15:03 -0500 Date: Fri, 10 Feb 2017 11:04:34 -0500 From: Steven Rostedt To: Masami Hiramatsu Cc: Ingo Molnar , linux-kernel@vger.kernel.org, Peter Zijlstra , Ananth N Mavinakayanahalli , Thomas Gleixner , "H . Peter Anvin" , Namhyung Kim , Andrew Morton Subject: Re: [PATCH V2 1/2] tracing/probes: Fix a warning message to show correct maximum length Message-ID: <20170210110434.36d50ed2@gandalf.local.home> In-Reply-To: <148673290462.2579.7966778294009665632.stgit@devbox> References: <20170210075302.GB24405@gmail.com> <148673290462.2579.7966778294009665632.stgit@devbox> X-Mailer: Claws Mail 3.14.0 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 10 Feb 2017 22:21:55 +0900 Masami Hiramatsu 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. -- Steve > > 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 > --- > 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; > }