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: <20160617112401.GA3904@krava>
Date:	Fri, 17 Jun 2016 13:24:01 +0200
From:	Jiri Olsa <jolsa@...hat.com>
To:	Madhavan Srinivasan <maddy@...ux.vnet.ibm.com>
Cc:	linux-kernel@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
	Yury Norov <ynorov@...iumnetworks.com>,
	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] tools/perf: Fix the mask in regs_dump__printf

On Fri, Jun 17, 2016 at 02:43:31PM +0530, Madhavan Srinivasan wrote:

SNIP

> 
>  
>                 if (data->user_regs.abi) {
> -                       u64 mask = evsel->attr.sample_regs_user;
> +                       u.val64 = evsel->attr.sample_regs_user;
>  
> -                       sz = hweight_long(mask) * sizeof(u64);
> +                       if (sizeof(u64) > sizeof(unsigned long)) {
> +                               u64 mask = u.val64;
> +                               u.val32[1] = mask >> 32;
> +                               u.val32[0] = mask & ULONG_MAX;
> +                       }
> +
> +                       sz = hweight_long(u.val64) * sizeof(u64);
>                         OVERFLOW_CHECK(array, sz, max_size);
> -                       data->user_regs.mask = mask;
> +                       data->user_regs.mask = u.val64;
>                         data->user_regs.regs = (u64 *)array;
> 
> Issue I see is when printing the mask value in a 32bit perf
> on a 64bit kernel (big endian).
> 
> 442044948492 0xdc0 [0x188]: PERF_RECORD_SAMPLE(IP, 0x1): 7299/7299:
> 0xc000000000059200 period: 12599 addr: 0
> ... intr regs: mask 0xffffffff000007ff ABI 32-bit
>                             ^^^ shld have been 0x7ffffffffff
> 
> I agree it is better to fix this when reading, but
> we need to swap again when printing?

hum, sample data should be swap at this point already..
see perf_session__process_event

jirka

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ