The __packed attribute for struct compat_group_req led to a failure of the LTP test accept02 when trying to join a multicast group. Keep it for COMPAT32 but remove it in COMPAT64 by introducing a new macro: NET_COMPAT_PACKED. Do the same for the other structs used here.
Signed-off-by: Teo Couprie Diaz teo.coupriediaz@arm.com --- include/net/compat.h | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/include/net/compat.h b/include/net/compat.h index f2d7423217d2..358895fc5f98 100644 --- a/include/net/compat.h +++ b/include/net/compat.h @@ -64,11 +64,18 @@ int put_cmsg_compat(struct msghdr*, int, int, int, void *); int cmsghdr_from_user_compat_to_kern(struct msghdr *, struct sock *, unsigned char *, int);
+/* No need for packing while in COMPAT64. */ +#ifdef CONFIG_COMPAT32 +#define NET_COMPAT_PACKED __packed +#else +#define NET_COMPAT_PACKED +#endif + struct compat_group_req { __u32 gr_interface; struct __kernel_sockaddr_storage gr_group __aligned(4); -} __packed; +} NET_COMPAT_PACKED;
struct compat_group_source_req { __u32 gsr_interface; @@ -76,7 +83,7 @@ struct compat_group_source_req { __aligned(4); struct __kernel_sockaddr_storage gsr_source __aligned(4); -} __packed; +} NET_COMPAT_PACKED;
struct compat_group_filter { union { @@ -88,7 +95,7 @@ struct compat_group_filter { __u32 gf_numsrc_aux; struct __kernel_sockaddr_storage gf_slist[1] __aligned(4); - } __packed; + } NET_COMPAT_PACKED; struct { __u32 gf_interface; struct __kernel_sockaddr_storage gf_group @@ -97,8 +104,8 @@ struct compat_group_filter { __u32 gf_numsrc; struct __kernel_sockaddr_storage gf_slist_flex[] __aligned(4); - } __packed; + } NET_COMPAT_PACKED; }; -} __packed; +} NET_COMPAT_PACKED;
#endif /* NET_COMPAT_H */
base-commit: 2fcc0af155a19755f68602f400fc845d2c9e6077