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: Mon, 14 Aug 2023 15:45:10 +0200
From: "Arnd Bergmann" <arnd@...db.de>
To: "Edward Cree" <ecree.xilinx@...il.com>,
 "edward.cree" <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>,
 "Kees Cook" <keescook@...omium.org>
Subject: Re: [PATCH v2 net-next 1/3] sfc: use padding to fix alignment in loopback test

On Mon, Aug 14, 2023, at 12:06, Edward Cree wrote:
> On 12/08/2023 09:23, Arnd Bergmann wrote:
>> On Fri, Jun 23, 2023, at 20:38, edward.cree@....com wrote:
>> Unfortunately, the same warning now came back after commit
>> 55c1528f9b97f ("sfc: fix field-spanning memcpy in selftest")
> ...
>> I'm out of ideas for how to fix both warnings at the same time,
>> with the struct group we get the iphdr at an invalid offset from
>> the start of the inner structure,
>
> But the actual address of the iphdr is properly aligned now, right?

Yes

> AFAICT the concept of the offset per se being 'valid' or not is not
>  even meaningful; it's the access address that must be aligned, not
>  the difference from random addresses used to construct it.
> In which case arguably the warning is just bogus and it's a compiler
>  fix we need at this point.

I think overall this is still a useful warning, in the sense that
it can spot incorrect code elsewhere. The reasoning seems to be
that the behavior of __packed is GNU specific and incompatible with
the C23 _Alignas() annotation that is specified as

  5 The combined effect of all alignment specifiers in a declaration
    shall not specify an alignment that is less strict than the
    alignment that would otherwise be required for the type of
    the object or member being declared.
    ...
    When multiple alignment specifiers occur in a declaration, the
    effective alignment requirement is the strictest specified
    alignment.

I tried the same code using the standard C notation, which
turns the warning into an error in clang.

      Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ