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, 24 Dec 2013 15:37:01 +1100
From:	Benjamin Herrenschmidt <benh@...nel.crashing.org>
To:	Joe Perches <joe@...ches.com>
Cc:	Anton Blanchard <anton@...ba.org>, Alexander Graf <agraf@...e.de>,
	linuxppc-dev@...ts.ozlabs.org, Dinar Valeev <dvaleev@...e.com>,
	Santiago Leon <santil@...ux.vnet.ibm.com>,
	netdev@...r.kernel.org
Subject: Re: [PATCH] ibmveth: Fix more little endian issues

On Mon, 2013-12-23 at 06:52 -0800, Joe Perches wrote:
> On Mon, 2013-12-23 at 17:38 +1100, Anton Blanchard wrote:
> > The hypervisor expects MAC addresses passed in registers to be big
> > endian u64.
> 
> So maybe use __be64 declarations?
> 
> > +static unsigned long ibmveth_encode_mac_addr(char *mac)
> 
> static __be64 ibmveth_encode_mac_addr(const char *mac)

A register value has no endianness. Only memory content does. Especially
talking of a MAC address which is really a byte stream.... (Yes, our
__beXX types used without a * are borderline, but we've got used to it).

In fact I find the use of 

    memcpy(((char *)&encoded) + 2, mac, ETH_ALEN);

Really gross :-) Yes it works with the added cpu_to_be64() but in that
specific case, I think it would be nicer to simply load & shift into
position the 6 bytes and avoid the endianness issue completely.

Cheers,
Ben.




--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ