Re: [PATCH RFC net-next] packet: always ensure that we pass hard_header_len bytes in skb_headlen() to the driver

2017-02-07 Thread Willem de Bruijn
On Mon, Jan 30, 2017 at 8:41 AM, David Miller wrote: > From: Sowmini Varadhan > Date: Mon, 30 Jan 2017 11:26:03 -0500 > >> On (01/27/17 19:19), Willem de Bruijn wrote: >>> > other than ax25, are there variable length header protocols out there >>> > without ->validate, and which need the CAP_RAW_

Re: [PATCH RFC net-next] packet: always ensure that we pass hard_header_len bytes in skb_headlen() to the driver

2017-01-30 Thread David Miller
From: Sowmini Varadhan Date: Mon, 30 Jan 2017 11:26:03 -0500 > On (01/27/17 19:19), Willem de Bruijn wrote: >> > other than ax25, are there variable length header protocols out there >> > without ->validate, and which need the CAP_RAW_SYSIO branch? >> >> I don't know. An exhaustive search of pro

Re: [PATCH RFC net-next] packet: always ensure that we pass hard_header_len bytes in skb_headlen() to the driver

2017-01-30 Thread Sowmini Varadhan
On (01/27/17 19:19), Willem de Bruijn wrote: > > other than ax25, are there variable length header protocols out there > > without ->validate, and which need the CAP_RAW_SYSIO branch? > > I don't know. An exhaustive search of protocols (by header_ops) may be > needed to say for sure. > > If there

Re: [PATCH RFC net-next] packet: always ensure that we pass hard_header_len bytes in skb_headlen() to the driver

2017-01-27 Thread Willem de Bruijn
On Fri, Jan 27, 2017 at 4:58 PM, Sowmini Varadhan wrote: > On (01/27/17 15:51), Willem de Bruijn wrote: > : >> - limit capable() check to drivers with with .validate callback > (aka second option below) > : >> - let privileged applications shoot themselves in the foot (change nothing). > >

Re: [PATCH RFC net-next] packet: always ensure that we pass hard_header_len bytes in skb_headlen() to the driver

2017-01-27 Thread Sowmini Varadhan
On (01/27/17 15:51), Willem de Bruijn wrote: : > - limit capable() check to drivers with with .validate callback (aka second option below) : > - let privileged applications shoot themselves in the foot (change nothing). > The second will break variable length header protocols unless > yo

Re: [PATCH RFC net-next] packet: always ensure that we pass hard_header_len bytes in skb_headlen() to the driver

2017-01-27 Thread Willem de Bruijn
On Fri, Jan 27, 2017 at 3:06 PM, Sowmini Varadhan wrote: > On (01/27/17 14:29), Willem de Bruijn wrote: >> >> As your patch state, the contract is that any packet delivered to a >> driver has the entire L2 in its linear section. Drivers are not required >> to be robust against shorter packets, so

Re: [PATCH RFC net-next] packet: always ensure that we pass hard_header_len bytes in skb_headlen() to the driver

2017-01-27 Thread Sowmini Varadhan
On (01/27/17 14:29), Willem de Bruijn wrote: > > As your patch state, the contract is that any packet delivered to a > driver has the entire L2 in its linear section. Drivers are not required > to be robust against shorter packets, so there is no reason to test > those. > > One option is to limit

Re: [PATCH RFC net-next] packet: always ensure that we pass hard_header_len bytes in skb_headlen() to the driver

2017-01-27 Thread Willem de Bruijn
> On (01/27/17 10:28), Willem de Bruijn wrote: >> > Would it make sense to only do the CAP_SYS_RAWIO branch if the >> > driver declares itself to have variable length L2 headers, via, e.g., >> > some priv flag? >> >> At the time, the comments were not specific to AX25. Again, we should >> probably

Re: [PATCH RFC net-next] packet: always ensure that we pass hard_header_len bytes in skb_headlen() to the driver

2017-01-27 Thread Sowmini Varadhan
On (01/27/17 10:28), Willem de Bruijn wrote: > > Would it make sense to only do the CAP_SYS_RAWIO branch if the > > driver declares itself to have variable length L2 headers, via, e.g., > > some priv flag? > > At the time, the comments were not specific to AX25. Again, we should > probably put tha

Re: [PATCH RFC net-next] packet: always ensure that we pass hard_header_len bytes in skb_headlen() to the driver

2017-01-27 Thread Willem de Bruijn
> " The AX.25 device level drivers are simply written to be robust if > thrown partial frames. >: > The other thing that concerns me about this added logic in general is > that you are also breaking test tools that want to deliberately send > corrupt frames to certain classes of interfa

Re: [PATCH RFC net-next] packet: always ensure that we pass hard_header_len bytes in skb_headlen() to the driver

2017-01-27 Thread Sowmini Varadhan
On (01/27/17 09:37), Willem de Bruijn wrote: > The immediate problem you were facing is that dev_validate_header > accepts values smaller than hard_header_len even for protocols with > fixed header lengths. Yes! > This is a consequence of that CAP_SYS_RAWIO branch. Without it, > dev_validate_head

Re: [PATCH RFC net-next] packet: always ensure that we pass hard_header_len bytes in skb_headlen() to the driver

2017-01-27 Thread Willem de Bruijn
On Thu, Jan 26, 2017 at 9:08 PM, Sowmini Varadhan wrote: > On (01/26/17 19:08), Willem de Bruijn wrote: >> >> Thanks for the context. ax25_addr_parse doesn't adjust length, it only >> verifies that the contents of the variable length header matches >> protocol spec. I don't think that it or the .v

Re: [PATCH RFC net-next] packet: always ensure that we pass hard_header_len bytes in skb_headlen() to the driver

2017-01-26 Thread Sowmini Varadhan
On (01/26/17 19:08), Willem de Bruijn wrote: > > Thanks for the context. ax25_addr_parse doesn't adjust length, it only > verifies that the contents of the variable length header matches > protocol spec. I don't think that it or the .validate callback have to > be modified to return length. Yes,

Re: [PATCH RFC net-next] packet: always ensure that we pass hard_header_len bytes in skb_headlen() to the driver

2017-01-26 Thread Willem de Bruijn
On Thu, Jan 26, 2017 at 4:37 PM, Sowmini Varadhan wrote: > On (01/26/17 15:21), Willem de Bruijn wrote: >> > If the application has provided fewer than hard_header_len bytes, >> > dev_validate_header() will zero out the skb->data as needed. This is >> > acceptable for SOCK_DGRAM/PF_PACKET sockets

Re: [PATCH RFC net-next] packet: always ensure that we pass hard_header_len bytes in skb_headlen() to the driver

2017-01-26 Thread Sowmini Varadhan
On (01/26/17 15:21), Willem de Bruijn wrote: > > If the application has provided fewer than hard_header_len bytes, > > dev_validate_header() will zero out the skb->data as needed. This is > > acceptable for SOCK_DGRAM/PF_PACKET sockets but in all other cases, > > This was added not for datagram so

Re: [PATCH RFC net-next] packet: always ensure that we pass hard_header_len bytes in skb_headlen() to the driver

2017-01-26 Thread Willem de Bruijn
> If the application has provided fewer than hard_header_len bytes, > dev_validate_header() will zero out the skb->data as needed. This is > acceptable for SOCK_DGRAM/PF_PACKET sockets but in all other cases, This was added not for datagram sockets, but to be able to bypass validation. See the mes

Re: [PATCH RFC net-next] packet: always ensure that we pass hard_header_len bytes in skb_headlen() to the driver

2017-01-25 Thread David Miller
From: Sowmini Varadhan Date: Tue, 24 Jan 2017 08:11:49 -0800 > @@ -2685,21 +2685,22 @@ static inline int dev_parse_header(const struct > sk_buff *skb, > } > > /* ll_header must have at least hard_header_len allocated */ > -static inline bool dev_validate_header(const struct net_device *dev,

[PATCH RFC net-next] packet: always ensure that we pass hard_header_len bytes in skb_headlen() to the driver

2017-01-24 Thread Sowmini Varadhan
The contract between the socket layer and the device is that there will be at least enough bytes in the non-paged part of the skb to cover a link layer header, and this is ensured by copying any application provided L2 header into the skb->data and then invoking dev_validate_header(). If the appli