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: <37D7C6CF3E00A74B8858931C1DB2F0775381C4E7@SHSMSX103.ccr.corp.intel.com>
Date:   Thu, 1 Feb 2018 21:55:50 +0000
From:   "Liang, Kan" <kan.liang@...el.com>
To:     Arnaldo Carvalho de Melo <acme@...nel.org>
CC:     "peterz@...radead.org" <peterz@...radead.org>,
        "mingo@...hat.com" <mingo@...hat.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "wangnan0@...wei.com" <wangnan0@...wei.com>,
        "jolsa@...nel.org" <jolsa@...nel.org>,
        "namhyung@...nel.org" <namhyung@...nel.org>,
        "ak@...ux.intel.com" <ak@...ux.intel.com>,
        "yao.jin@...ux.intel.com" <yao.jin@...ux.intel.com>
Subject: RE: [PATCH V5 02/17] perf mmap: fix: recalculate size for overwrite
 mode.

> Em Thu, Jan 18, 2018 at 01:26:17PM -0800, kan.liang@...el.com escreveu:
> > From: Kan Liang <kan.liang@...el.com>
> >
> > In perf_mmap__push(), the 'size' need to be recalculated, otherwise
> > the invalid data might be pushed to the record in overwrite mode.
> >
> > The issue is introduced by commit 7fb4b407a124 ("perf mmap: Don't
> > discard prev in backward mode").
> 
> In these cases, please add the Fixes tag, like:
>
> Fixes: 7fb4b407a124 ("perf mmap: Don't discard prev in backward mode")
> 
> I'm doing it this time.
>

Thanks. I'll be careful next time.

Thanks,
Kan
 
> Thanks,
> 
> - Arnaldo
> 
> > When the ringbuffer is full in overwrite mode, backward_rb_find_range
> > will be called to recalculate the 'start' and 'end'. The 'size' needs
> > to be recalculated accordingly.
> >
> > Unconditionally recalculate the 'size', not just for full ringbuffer
> > in overwrite mode. Because,
> > - There is no harmful to recalculate the 'size' for other cases.
> > - The code of calculating 'start' and 'end' will be factored out later.
> >   The new function does not need to return 'size'.
> >
> > Signed-off-by: Kan Liang <kan.liang@...el.com>
> > ---
> >  tools/perf/util/mmap.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/tools/perf/util/mmap.c b/tools/perf/util/mmap.c index
> > 05076e6..97cf4fa 100644
> > --- a/tools/perf/util/mmap.c
> > +++ b/tools/perf/util/mmap.c
> > @@ -302,6 +302,8 @@ int perf_mmap__push(struct perf_mmap *md,
> bool overwrite,
> >  			return -1;
> >  	}
> >
> > +	size = end - start;
> > +
> >  	if ((start & md->mask) + size != (end & md->mask)) {
> >  		buf = &data[start & md->mask];
> >  		size = md->mask + 1 - (start & md->mask);
> > --
> > 2.5.5

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ