On 01/12/2022 16:20, Kristina Martsenko wrote:
On 30/11/2022 17:19, Teo Couprie Diaz wrote:
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, do the same for the other structs used here.
Signed-off-by: Teo Couprie Diaz teo.coupriediaz@arm.com
Not really sure this is the right way to go, nor if the others structs should be left alone. Chaning them all didn't lead to failures in setsockopt or accept LTP tests, which was where the issue was detected.
FWIW I agree with changing it for the other structs as well (might save some time debugging later).
include/net/compat.h | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/include/net/compat.h b/include/net/compat.h index f2d7423217d2..5cb091e2a6a6 100644 --- a/include/net/compat.h +++ b/include/net/compat.h @@ -68,7 +68,11 @@ struct compat_group_req { __u32 gr_interface; struct __kernel_sockaddr_storage gr_group __aligned(4); +#ifdef CONFIG_COMPAT32 } __packed; +#else +}; +#endif
It might be nice to define a new macro similar to EPOLL_PACKED, and use that on each of the structs, just to have less #ifdefing.
That does sound much cleaner, I'll give it a look !
Otherwise this patch looks good to me!
Thanks, Kristina
Thanks for the review, Téo
struct compat_group_source_req { __u32 gsr_interface; @@ -76,7 +80,11 @@ struct compat_group_source_req { __aligned(4); struct __kernel_sockaddr_storage gsr_source __aligned(4); +#ifdef CONFIG_COMPAT32 } __packed; +#else +}; +#endif struct compat_group_filter { union { @@ -88,7 +96,11 @@ struct compat_group_filter { __u32 gf_numsrc_aux; struct __kernel_sockaddr_storage gf_slist[1] __aligned(4); +#ifdef CONFIG_COMPAT32 } __packed; +#else
};
+#endif struct { __u32 gf_interface; struct __kernel_sockaddr_storage gf_group @@ -97,8 +109,16 @@ struct compat_group_filter { __u32 gf_numsrc; struct __kernel_sockaddr_storage gf_slist_flex[] __aligned(4); +#ifdef CONFIG_COMPAT32 } __packed; +#else
};
+#endif }; -} __packed; +#ifdef CONFIG_COMPAT32
- } __packed;
+#else
- };
+#endif #endif /* NET_COMPAT_H */
base-commit: 2fcc0af155a19755f68602f400fc845d2c9e6077