Re: [PATCH] netdev: Use flexible array for trailing private bytes

2024-03-06 Thread Kees Cook
On Wed, Mar 06, 2024 at 07:06:58AM -0800, Jakub Kicinski wrote: > On Wed, 6 Mar 2024 05:16:16 -0800 Breno Leitao wrote: > > I've been looking at some of these embedders as reported by Kees[1], and > > most of them are for dummy interfaces. I.e, they are basically used for > > schedule NAPI poll. >

Re: [PATCH] netdev: Use flexible array for trailing private bytes

2024-03-06 Thread Jakub Kicinski
On Wed, 6 Mar 2024 05:16:16 -0800 Breno Leitao wrote: > I've been looking at some of these embedders as reported by Kees[1], and > most of them are for dummy interfaces. I.e, they are basically used for > schedule NAPI poll. > > From that list[1], most of the driver matches with: > > # git

Re: [PATCH] netdev: Use flexible array for trailing private bytes

2024-03-06 Thread Breno Leitao
On Thu, Feb 29, 2024 at 10:59:10PM -0800, Jakub Kicinski wrote: > On Thu, 29 Feb 2024 13:30:22 -0800 Kees Cook wrote: > > Introduce a new struct net_device_priv that contains struct net_device > > but also accounts for the commonly trailing bytes through the "size" and > > "data" members. > > I'm

Re: [PATCH] netdev: Use flexible array for trailing private bytes

2024-03-04 Thread Jakub Kicinski
On Mon, 4 Mar 2024 15:32:51 +0100 Alexander Lobakin wrote: > > 100% I should have linked to the thread that led to Kees's work. > > Adding directly to net_device would be way better but there's > > a handful of drivers which embed the struct. > > I think it's okay to embed a struct with flex arr

Re: [PATCH] netdev: Use flexible array for trailing private bytes

2024-03-04 Thread Alexander Lobakin
From: Jakub Kicinski Date: Fri, 1 Mar 2024 09:35:17 -0800 > On Fri, 1 Mar 2024 15:30:03 +0100 Alexander Lobakin wrote: >> I like the idea of declaring priv explicitly rather than doing size + >> ptr magic. But maybe we could just add this flex array to struct >> net_device and avoid introducing a

Re: [PATCH] netdev: Use flexible array for trailing private bytes

2024-03-01 Thread Jakub Kicinski
On Fri, 1 Mar 2024 15:30:03 +0100 Alexander Lobakin wrote: > I like the idea of declaring priv explicitly rather than doing size + > ptr magic. But maybe we could just add this flex array to struct > net_device and avoid introducing a new structure. 100% I should have linked to the thread that led

Re: [PATCH] netdev: Use flexible array for trailing private bytes

2024-03-01 Thread Alexander Lobakin
From: Eric Dumazet Date: Fri, 1 Mar 2024 14:25:37 +0100 > On Fri, Mar 1, 2024 at 1:59 PM Alexander Lobakin > wrote: >> >> From: Eric Dumazet >> Date: Fri, 1 Mar 2024 09:03:55 +0100 >> >>> On Fri, Mar 1, 2024 at 7:59 AM Jakub Kicinski wrote: On Thu, 29 Feb 2024 13:30:22 -0800 Kees Coo

Re: [PATCH] netdev: Use flexible array for trailing private bytes

2024-03-01 Thread Eric Dumazet
On Fri, Mar 1, 2024 at 1:59 PM Alexander Lobakin wrote: > > From: Eric Dumazet > Date: Fri, 1 Mar 2024 09:03:55 +0100 > > > On Fri, Mar 1, 2024 at 7:59 AM Jakub Kicinski wrote: > >> > >> On Thu, 29 Feb 2024 13:30:22 -0800 Kees Cook wrote: > > Re WARN_ONCE() in netdev_priv(): netdev_priv() is VER

Re: [PATCH] netdev: Use flexible array for trailing private bytes

2024-03-01 Thread Alexander Lobakin
From: Eric Dumazet Date: Fri, 1 Mar 2024 09:03:55 +0100 > On Fri, Mar 1, 2024 at 7:59 AM Jakub Kicinski wrote: >> >> On Thu, 29 Feb 2024 13:30:22 -0800 Kees Cook wrote: Re WARN_ONCE() in netdev_priv(): netdev_priv() is VERY hot, I'm not sure we want to add checks there. Maybe under CONFIG_DEBUG

Re: [PATCH] netdev: Use flexible array for trailing private bytes

2024-03-01 Thread Greg KH
On Thu, Feb 29, 2024 at 10:59:10PM -0800, Jakub Kicinski wrote: > On Thu, 29 Feb 2024 13:30:22 -0800 Kees Cook wrote: > > Introduce a new struct net_device_priv that contains struct net_device > > but also accounts for the commonly trailing bytes through the "size" and > > "data" members. > > I'm

Re: [PATCH] netdev: Use flexible array for trailing private bytes

2024-03-01 Thread Eric Dumazet
On Fri, Mar 1, 2024 at 7:59 AM Jakub Kicinski wrote: > > On Thu, 29 Feb 2024 13:30:22 -0800 Kees Cook wrote: > > diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h > > index 118c40258d07..b476809d0bae 100644 > > --- a/include/linux/netdevice.h > > +++ b/include/linux/netdevice.h >

Re: [PATCH] netdev: Use flexible array for trailing private bytes

2024-02-29 Thread Jakub Kicinski
On Thu, 29 Feb 2024 13:30:22 -0800 Kees Cook wrote: > Introduce a new struct net_device_priv that contains struct net_device > but also accounts for the commonly trailing bytes through the "size" and > "data" members. I'm a bit unclear on the benefit. Perhaps I'm unaccustomed to "safe C". > As ma

Re: [PATCH] netdev: Use flexible array for trailing private bytes

2024-02-29 Thread Gustavo A. R. Silva
On 2/29/24 15:30, Kees Cook wrote: Introduce a new struct net_device_priv that contains struct net_device but also accounts for the commonly trailing bytes through the "size" and "data" members. As many dummy struct net_device instances exist still, it is non-trivial to but this flexible array

[PATCH] netdev: Use flexible array for trailing private bytes

2024-02-29 Thread Kees Cook
Introduce a new struct net_device_priv that contains struct net_device but also accounts for the commonly trailing bytes through the "size" and "data" members. As many dummy struct net_device instances exist still, it is non-trivial to but this flexible array inside struct net_device itself. But we