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] [day] [month] [year] [list]
Message-ID: <YJarJWbjlhizmt5A@kernel.org>
Date:   Sat, 8 May 2021 12:15:49 -0300
From:   Arnaldo Carvalho de Melo <acme@...nel.org>
To:     Jiri Olsa <jolsa@...hat.com>
Cc:     Dmitry Koshelev <karaghiozis@...il.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Namhyung Kim <namhyung@...nel.org>,
        Adrian Hunter <adrian.hunter@...el.com>,
        Kan Liang <kan.liang@...ux.intel.com>,
        Leo Yan <leo.yan@...aro.org>, linux-perf-users@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] perf: Fix swapping of cpu_map and stat_config records

Em Thu, May 06, 2021 at 03:32:10PM +0200, Jiri Olsa escreveu:
> On Thu, May 06, 2021 at 01:11:49PM +0000, Dmitry Koshelev wrote:
> > 'data' field in perf_record_cpu_map_data struct is 16-bit
> > wide and so should be swapped using bswap_16().
> > 
> > 'nr' field in perf_record_stat_config struct should be
> > swapped before being used for size calculation.
> > 
> > Signed-off-by: Dmitry Koshelev <karaghiozis@...il.com>
> 
> Acked-by: Jiri Olsa <jolsa@...hat.com>

Thanks, applied.

- Arnaldo

 
> thanks,
> jirka
> 
> > ---
> >  tools/perf/util/session.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
> > index a12cf4f0e97a..106b3d60881a 100644
> > --- a/tools/perf/util/session.c
> > +++ b/tools/perf/util/session.c
> > @@ -904,7 +904,7 @@ static void perf_event__cpu_map_swap(union perf_event *event,
> >  	struct perf_record_record_cpu_map *mask;
> >  	unsigned i;
> >  
> > -	data->type = bswap_64(data->type);
> > +	data->type = bswap_16(data->type);
> >  
> >  	switch (data->type) {
> >  	case PERF_CPU_MAP__CPUS:
> > @@ -937,7 +937,7 @@ static void perf_event__stat_config_swap(union perf_event *event,
> >  {
> >  	u64 size;
> >  
> > -	size  = event->stat_config.nr * sizeof(event->stat_config.data[0]);
> > +	size  = bswap_64(event->stat_config.nr) * sizeof(event->stat_config.data[0]);
> >  	size += 1; /* nr item itself */
> >  	mem_bswap_64(&event->stat_config.nr, size);
> >  }
> > -- 
> > 2.25.1
> > 
> 

-- 

- Arnaldo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ