lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 16 Feb 2017 00:10:30 +0900
From:   Masami Hiramatsu <mhiramat@...nel.org>
To:     Steven Rostedt <rostedt@...dmis.org>
Cc:     Ingo Molnar <mingo@...nel.org>, linux-kernel@...r.kernel.org,
        Peter Zijlstra <peterz@...radead.org>,
        Ananth N Mavinakayanahalli <ananth@...ux.vnet.ibm.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        "H . Peter Anvin" <hpa@...or.com>,
        Namhyung Kim <namhyung@...nel.org>,
        Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH V2 1/2] tracing/probes: Fix a warning message to show
 correct maximum length

On Fri, 10 Feb 2017 11:04:34 -0500
Steven Rostedt <rostedt@...dmis.org> wrote:

> On Fri, 10 Feb 2017 22:21:55 +0900
> Masami Hiramatsu <mhiramat@...nel.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=@...fies_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@...nel.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@...nel.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ