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:	Wed, 22 Jun 2016 08:50:30 +0200
From:	Jiri Olsa <jolsa@...hat.com>
To:	Yury Norov <ynorov@...iumnetworks.com>
Cc:	Madhavan Srinivasan <maddy@...ux.vnet.ibm.com>,
	linux-kernel@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
	Peter Zijlstra <peterz@...radead.org>,
	Ingo Molnar <mingo@...hat.com>,
	Arnaldo Carvalho de Melo <acme@...nel.org>,
	Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
	Jiri Olsa <jolsa@...nel.org>,
	Adrian Hunter <adrian.hunter@...el.com>,
	Kan Liang <kan.liang@...el.com>,
	Wang Nan <wangnan0@...wei.com>,
	Michael Ellerman <mpe@...erman.id.au>
Subject: Re: [PATCH v3] tools/perf: Fix the mask in regs_dump__printf and
 print_sample_iregs

On Tue, Jun 21, 2016 at 06:35:31PM +0300, Yury Norov wrote:

SNIP

> > index 5214974e841a..1337b1c73f82 100644
> > --- a/tools/perf/util/session.c
> > +++ b/tools/perf/util/session.c
> > @@ -940,8 +940,22 @@ static void branch_stack__printf(struct perf_sample *sample)
> >  static void regs_dump__printf(u64 mask, u64 *regs)
> >  {
> >  	unsigned rid, i = 0;
> > +	unsigned long _mask[sizeof(mask)/sizeof(unsigned long)];
> >  
> > -	for_each_set_bit(rid, (unsigned long *) &mask, sizeof(mask) * 8) {
> > +	/*
> > +	 * Since u64 is passed as 'unsigned long *', check
> > +	 * to see whether we need to swap words within u64.
> > +	 * Reason being, in 32 bit big endian userspace on a
> > +	 * 64bit kernel, 'unsigned long' is 32 bits.
> > +	 * When reading u64 using (u32 *)(&val)[0] and (u32 *)(&val)[1],
> > +	 * we will get wrong value for the mask. This is what
> > +	 * find_first_bit() and find_next_bit() is doing.
> > +	 * Issue here is "(u32 *)(&val)[0]" gets upper 32 bits of u64,
> > +	 * but perf assumes it gets lower 32bits of u64. Hence the check
> > +	 * and swap.
> > +	 */
> 
> Identical comments... I'd prefer to see it in commit message, or
> better in function description. For me it's pretty straightforward in
> understanding what happens here in-place without comments.

yep, please use this just once as the fucntion description

thanks,
jirka

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ