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]
Message-ID: <20161007041907.GC31113@sejong>
Date:   Fri, 7 Oct 2016 13:19:08 +0900
From:   Namhyung Kim <namhyung@...nel.org>
To:     Steven Rostedt <rostedt@...dmis.org>
CC:     Arnaldo Carvalho de Melo <acme@...nel.org>,
        Ingo Molnar <mingo@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Jiri Olsa <jolsa@...nel.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] tools lib traceevent: Fix kbuffer_read_at_offset()

Hi Steve,

On Wed, Oct 05, 2016 at 09:28:01AM -0400, Steven Rostedt wrote:
> On Sat,  1 Oct 2016 19:17:00 +0900
> Namhyung Kim <namhyung@...nel.org> wrote:
> 
> > When it's called with an offset less than or equal to the first event,
> > it'll return a garbage value since the data is not initialized.
> 
> Well, it can at most be equal to (unless offset is negative) because
> kbuffer_load_subbuffer() sets kbuf->curr to zero.

Actually kbuffer_load_subbuffer() calls kbuf->next_event().  Inside
the function it has a loop updating next valid event.  Sometimes, the
data starts with TIME_EXTEND with value of 0 and the loop skips it
which ended up setting kbuf->curr to 8. :)

I'll take a look it later.

> 
> But that said, it looks like offset == 0 is buggy.
> 
> Acked-by: Steven Rostedt <rostedt@...dmis.org>

Thanks,
Namhyung

> 
> 
> -- Steve
> 
> > 
> > Cc: Steven Rostedt <rostedt@...dmis.org>
> > Signed-off-by: Namhyung Kim <namhyung@...nel.org>
> > ---
> >  tools/lib/traceevent/kbuffer-parse.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/tools/lib/traceevent/kbuffer-parse.c b/tools/lib/traceevent/kbuffer-parse.c
> > index 3bcada3ae05a..65984f1c2974 100644
> > --- a/tools/lib/traceevent/kbuffer-parse.c
> > +++ b/tools/lib/traceevent/kbuffer-parse.c
> > @@ -622,6 +622,7 @@ void *kbuffer_read_at_offset(struct kbuffer *kbuf, int offset,
> >  
> >  	/* Reset the buffer */
> >  	kbuffer_load_subbuffer(kbuf, kbuf->subbuffer);
> > +	data = kbuffer_read_event(kbuf, ts);
> >  
> >  	while (kbuf->curr < offset) {
> >  		data = kbuffer_next_event(kbuf, ts);
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ