Thread (2 messages) 2 messages, 2 authors, 2019-08-03

Re: [PATCH v3] net/socket: fix GCC8+ Wpacked-not-aligned warnings

From: David Miller <davem@davemloft.net>
Date: 2019-08-03 18:03:43
Also in: linux-sctp, lkml

From: Qian Cai <redacted>
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 <redacted>
Signed-off-by: Qian Cai <redacted>
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help