Re: [PATCH net-next] net: Add options as a flexible array to struct ip_tunnel_info

2025-02-11 Thread Jakub Kicinski
On Tue, 11 Feb 2025 20:59:24 +0200 Gal Pressman wrote: > > Everything else looks very good, though, yes, I would agree with the > > alignment comments made down-thread. This was "accidentally correct" > > before in the sense that the end of the struct would be padded for > > alignment, but isn't gu

Re: [PATCH net-next] net: Add options as a flexible array to struct ip_tunnel_info

2025-02-11 Thread Gal Pressman
On 11/02/2025 19:49, Kees Cook wrote: >> @@ -659,7 +654,7 @@ static inline void ip_tunnel_info_opts_set(struct >> ip_tunnel_info *info, >> { >> info->options_len = len; >> if (len > 0) { >> -memcpy(ip_tunnel_info_opts(info), from, len); >> +memcpy(info->options,

Re: [PATCH net-next] net: Add options as a flexible array to struct ip_tunnel_info

2025-02-11 Thread Kees Cook
On Sun, Feb 09, 2025 at 12:18:53PM +0200, Gal Pressman wrote: > Remove the hidden assumption that options are allocated at the end of > the struct, and teach the compiler about them using a flexible array. > > With this, we can revert the unsafe_memcpy() call we have in > tun_dst_unclone() [1], an

Re: [ovs-dev] [PATCH net-next] net: Add options as a flexible array to struct ip_tunnel_info

2025-02-11 Thread Gal Pressman
On 09/02/2025 22:16, Ilya Maximets wrote: > Ideally we would have a proper union with all the potential option types > instead of this hacky construct. But if that's not the the way to go, then > 8 bytes may indeed be the way, as it is the maximum guaranteed alignment > for allocations and the cur

Re: [ovs-dev] [PATCH net-next] net: Add options as a flexible array to struct ip_tunnel_info

2025-02-09 Thread Ilya Maximets
On 2/9/25 20:37, Gal Pressman wrote: > Hi Ilya, thanks for the review. > > On 09/02/2025 18:21, Ilya Maximets wrote: >> On 2/9/25 11:18, Gal Pressman via dev wrote: >>> Remove the hidden assumption that options are allocated at the end of >>> the struct, and teach the compiler about them using a f

Re: [ovs-dev] [PATCH net-next] net: Add options as a flexible array to struct ip_tunnel_info

2025-02-09 Thread Gal Pressman
Hi Ilya, thanks for the review. On 09/02/2025 18:21, Ilya Maximets wrote: > On 2/9/25 11:18, Gal Pressman via dev wrote: >> Remove the hidden assumption that options are allocated at the end of >> the struct, and teach the compiler about them using a flexible array. >> >> With this, we can revert

Re: [ovs-dev] [PATCH net-next] net: Add options as a flexible array to struct ip_tunnel_info

2025-02-09 Thread Ilya Maximets
On 2/9/25 11:18, Gal Pressman via dev wrote: > Remove the hidden assumption that options are allocated at the end of > the struct, and teach the compiler about them using a flexible array. > > With this, we can revert the unsafe_memcpy() call we have in > tun_dst_unclone() [1], and resolve the fal

[PATCH net-next] net: Add options as a flexible array to struct ip_tunnel_info

2025-02-09 Thread Gal Pressman
Remove the hidden assumption that options are allocated at the end of the struct, and teach the compiler about them using a flexible array. With this, we can revert the unsafe_memcpy() call we have in tun_dst_unclone() [1], and resolve the false field-spanning write warning caused by the memcpy()