[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20190803.110339.449734752227362483.davem@davemloft.net>
Date: Sat, 03 Aug 2019 11:03:39 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: cai@....pw
Cc: vyasevich@...il.com, nhorman@...driver.com,
marcelo.leitner@...il.com, David.Laight@...LAB.COM,
linux-sctp@...r.kernel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] net/socket: fix GCC8+ Wpacked-not-aligned warnings
From: Qian Cai <cai@....pw>
Date: Tue, 30 Jul 2019 11:30:33 -0400
> There are a lot of those warnings with GCC8+ 64-bit,
...
> This is because the commit 20c9c825b12f ("[SCTP] Fix SCTP socket options
> to work with 32-bit apps on 64-bit kernels.") added "packed, aligned(4)"
> GCC attributes to some structures but one of the members, i.e, "struct
> sockaddr_storage" in those structures has the attribute,
> "aligned(__alignof__ (struct sockaddr *)" which is 8-byte on 64-bit
> systems, so the commit overwrites the designed alignments for
> "sockaddr_storage".
>
> To fix this, "struct sockaddr_storage" needs to be aligned to 4-byte as
> it is only used in those packed sctp structure which is part of UAPI,
> and "struct __kernel_sockaddr_storage" is used in some other
> places of UAPI that need not to change alignments in order to not
> breaking userspace.
>
> Use an implicit alignment for "struct __kernel_sockaddr_storage" so it
> can keep the same alignments as a member in both packed and un-packed
> structures without breaking UAPI.
>
> Suggested-by: David Laight <David.Laight@...LAB.COM>
> Signed-off-by: Qian Cai <cai@....pw>
Ok, this just changes how the alignment is declared from using the
aligned attribute to using a union member which requires the same
alignment.
Applied.
Powered by blists - more mailing lists