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]
Date:	Fri, 02 Sep 2011 14:06:08 -0600
From:	David Ahern <dsahern@...il.com>
To:	Arnaldo Carvalho de Melo <acme@...stprotocols.net>
CC:	linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org,
	mingo@...e.hu, peterz@...radead.org, fweisbec@...il.com,
	paulus@...ba.org, tglx@...utronix.de, anton@...ba.org
Subject: Re: [PATCH] perf tool: fix endianness handling of u32 data in samples



On 09/02/2011 02:02 PM, Arnaldo Carvalho de Melo wrote:
> Em Fri, Sep 02, 2011 at 01:41:51PM -0600, David Ahern escreveu:
>> @@ -423,18 +449,25 @@ int perf_event__parse_sample(const union perf_event *event, u64 type,
>>  	}
>>  
>>  	if (type & PERF_SAMPLE_RAW) {
>> -		u32 *p = (u32 *)array;
>> +		u.val64 = *array;
>> +		if (swapped) {
>> +			/* undo swap of u64, then swap on individual u32s */
>> +			u.val64 = bswap_64(u.val64);
>> +			u.val32[0] = bswap_32(u.val32[0]);
>> +			u.val32[1] = bswap_32(u.val32[1]);
>> +
>> +			WARN_ONCE(swapped, "Endianness of raw data not corrected!\n");
>> +		}
> 
> That works too, but then we'll be always testing swapped two times :-)
> 
> - Arnaldo


I did not see a WARN_ONCE with no 'condition' variable, so I went with
the redundant test. I guess swapped really could be changed to '1' --
like an example I saw in the acpi code.

David
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ