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:	Tue, 21 Apr 2015 15:13:35 +0200
From:	Stefan Richter <stefanr@...6.in-berlin.de>
To:	Laurent Vivier <laurent@...ier.eu>
Cc:	linux1394-devel@...ts.sourceforge.net,
	linux-kernel@...r.kernel.org, Joe Perches <joe@...ches.com>
Subject: Re: [PATCH 1/2] firewire: firewire is a big-endian bus

On Apr 21 Laurent Vivier wrote:
> So, dump config_rom data as big-endian values.
> 
> The value given by /sys/bus/firewire/devices/fw0 were correctly
> given on a big-endian host (like powermac) not on a little-endian host
> (like PC), for instance:
> 
> 00000000  87 a4 04 04 34 39 33 31  22 a2 00 f0 33 22 11 00  |....4931"...3"..|
> 00000010  66 66 66 33 0b dd 05 00  c0 83 00 0c 1e 0d d0 03  |fff3............|
> 00000020  03 00 00 81 01 00 00 17  08 00 00 81 b7 4c 06 00  |.............L..|
> 00000030  00 00 00 00 00 00 00 00  75 6e 69 4c 69 46 20 78  |........uniLiF x|
> 00000040  69 77 65 72 00 00 65 72  1c ff 03 00 00 00 00 00  |iwer..er........|
> 00000050  00 00 00 00 75 6a 75 4a                           |....ujuJ|
> 00000058
> 
> instead of:
> 
> 00000000  04 04 a4 87 31 33 39 34  f0 00 a2 22 00 11 22 33  |....1394...".."3|
> 00000010  33 66 66 66 00 05 dd 0b  0c 00 83 c0 03 d0 0d 1e  |3fff............|
> 00000020  81 00 00 03 17 00 00 01  81 00 00 08 00 06 4c b7  |..............L.|
> 00000030  00 00 00 00 00 00 00 00  4c 69 6e 75 78 20 46 69  |........Linux Fi|
> 00000040  72 65 77 69 72 65 00 00  00 03 ff 1c 00 00 00 00  |rewire..........|
> 00000050  00 00 00 00 4a 75 6a 75                           |....Juju|
> 00000058
> 
> This patch corrects this.
> 
> Signed-off-by: Laurent Vivier <laurent@...ier.eu>

As defined in Documentation/ABI/stable/sysfs-bus-firewire we deliberately
export the Configuration ROM as an array of host-endian quadlets.  As a
stable kernel ABI, this will not be changed.

(A python script called crpp which transforms this kind of binary data into
a richly annotated hexdump is available as part of the jujuutils package,
or standalone from http://me.in-berlin.de/~s5r6/linux1394/utils/.)

> ---
>  drivers/firewire/core-device.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/firewire/core-device.c b/drivers/firewire/core-device.c
> index f9e3aee..5245567 100644
> --- a/drivers/firewire/core-device.c
> +++ b/drivers/firewire/core-device.c
> @@ -399,14 +399,14 @@ static ssize_t config_rom_show(struct device *dev,
>  			       struct device_attribute *attr, char *buf)
>  {
>  	struct fw_device *device = fw_device(dev);
> -	size_t length;
> +	size_t i;
>  
>  	down_read(&fw_device_rwsem);
> -	length = device->config_rom_length * 4;
> -	memcpy(buf, device->config_rom, length);
> +	for (i = 0; i < device->config_rom_length; i++)
> +		((u32 *)buf)[i] = be32_to_cpu(device->config_rom[i]);
>  	up_read(&fw_device_rwsem);
>  
> -	return length;
> +	return i * 4;
>  }
>  
>  static ssize_t guid_show(struct device *dev,



-- 
Stefan Richter
-=====-===== -=-- =-=-=
http://arcgraph.de/sr/
--
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