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: Thu, 22 Jun 2023 13:02:06 +0100
From: Edward Cree <ecree.xilinx@...il.com>
To: Arnd Bergmann <arnd@...db.de>, edward.cree@....com,
 linux-net-drivers@....com, "David S . Miller" <davem@...emloft.net>,
 Jakub Kicinski <kuba@...nel.org>, Eric Dumazet <edumazet@...gle.com>,
 Paolo Abeni <pabeni@...hat.com>
Cc: Netdev <netdev@...r.kernel.org>, Martin Habets <habetsm.xilinx@...il.com>
Subject: Re: [PATCH net-next 1/3] sfc: use padding to fix alignment in
 loopback test

On 22/06/2023 12:38, Arnd Bergmann wrote:
> On Thu, Jun 22, 2023, at 12:18, edward.cree@....com wrote:
>>  drivers/net/ethernet/sfc/selftest.c | 45 +++++++++++++++++------------
>>  1 file changed, 27 insertions(+), 18 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/sfc/selftest.c 
>> b/drivers/net/ethernet/sfc/selftest.c
>> index 3c5227afd497..74b42efe7267 100644
>> --- a/drivers/net/ethernet/sfc/selftest.c
>> +++ b/drivers/net/ethernet/sfc/selftest.c
>> @@ -42,12 +42,16 @@
>>   * Falcon only performs RSS on TCP/UDP packets.
>>   */
>>  struct efx_loopback_payload {
>> +	char pad[2]; /* Ensures ip is 4-byte aligned */
>>  	struct ethhdr header;
>>  	struct iphdr ip;
>>  	struct udphdr udp;
>>  	__be16 iteration;
>>  	char msg[64];
>>  } __packed;
> 
> There should probably be an extra __aligned(4) after the __packed,
> so that the compiler knows the start of the structure is aligned,
> otherwise (depending on the architecture and compiler), any access
> to a member can still turn into multiple single-byte accesses.

Ok, will add that in v2.

> I would also expect to still see a warning without that extra
> attribute. Aside from this, the patch looks good to me.
My compiler (gcc 8.3.1) doesn't reproduce the original warning, so
 I'm flying slightly blind here :(  If you could build-test this on
 your setup with/without the __aligned(4), I'd be very grateful.

-ed

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ