Re: __sk_buff.data_end

2017-04-20 Thread Johannes Berg
On Thu, 2017-04-20 at 16:46 +0200, Daniel Borkmann wrote: > > Hmm. I don't see what "somewhere else" I could possibly have > > though, given that I want the (kernel-side) context to be "struct > > sk_buff *" to allow the skb helpers? > > I have not enough context on the wireless side, perhaps

Re: __sk_buff.data_end

2017-04-20 Thread Daniel Borkmann
On 04/20/2017 04:32 PM, Johannes Berg wrote: On Thu, 2017-04-20 at 16:28 +0200, Daniel Borkmann wrote: I see what you mean now. Yes, that's fine. We already do something similar essentially with skb->ifindex access already (skb->dev + dev->ifindex), f.e.: [...] case offsetof(struct

Re: __sk_buff.data_end

2017-04-20 Thread Johannes Berg
On Thu, 2017-04-20 at 16:28 +0200, Daniel Borkmann wrote: > > I see what you mean now. Yes, that's fine. We already do something > similar essentially with skb->ifindex access already (skb->dev + > dev->ifindex), f.e.: > > [...] > case offsetof(struct __sk_buff, ifindex): >

Re: __sk_buff.data_end

2017-04-20 Thread Daniel Borkmann
On 04/20/2017 04:17 PM, Johannes Berg wrote: On Thu, 2017-04-20 at 16:10 +0200, Daniel Borkmann wrote: I think this would be a rather more complex operation on the BPF side, it would need changes from LLVM (which assumes initial ctx sits in r1), verifier for tracking this ctx2, all the way

Re: __sk_buff.data_end

2017-04-20 Thread Johannes Berg
On Thu, 2017-04-20 at 16:10 +0200, Daniel Borkmann wrote: > > I think this would be a rather more complex operation on the BPF > side, it would need changes from LLVM (which assumes initial ctx sits > in r1), verifier for tracking this ctx2, all the way down to JITs > plus some way to handle 1

Re: __sk_buff.data_end

2017-04-20 Thread Daniel Borkmann
On 04/20/2017 08:01 AM, Johannes Berg wrote: On Thu, 2017-04-20 at 02:01 +0200, Daniel Borkmann wrote: Yeah, should work as well for the 32 bit archs, on 64 bit we have this effectively already: Right. [...] Can you elaborate on why this works for mac80211? It uses cb only up to that

Re: __sk_buff.data_end

2017-04-20 Thread Johannes Berg
On Thu, 2017-04-20 at 02:38 +0200, Daniel Borkmann wrote: > > Since wifi skbs have only eth in headlen, there is not much > > pointing adding support for data/data_end to wifi. > > Just use ld_abs/ld_ind instructions and load_bytes() helper. > > Afaik, the ld_abs/ld_ind are not an option due to

Re: __sk_buff.data_end

2017-04-20 Thread Johannes Berg
On Wed, 2017-04-19 at 17:12 -0700, Alexei Starovoitov wrote: > > also didn't we discuss that wifi has crazy non-linear skb? Not always, depends on the driver. But also, you have to remember that this filter would be before the conversion to Ethernet header. Right now, when packets enter the

Re: __sk_buff.data_end

2017-04-20 Thread Johannes Berg
On Thu, 2017-04-20 at 02:01 +0200, Daniel Borkmann wrote: > > Yeah, should work as well for the 32 bit archs, on 64 bit we > have this effectively already: Right. [...] > Can you elaborate on why this works for mac80211? It uses cb > only up to that point from where you invoke the prog? No,

Re: __sk_buff.data_end

2017-04-19 Thread Daniel Borkmann
On 04/20/2017 02:12 AM, Alexei Starovoitov wrote: On Thu, Apr 20, 2017 at 02:01:49AM +0200, Daniel Borkmann wrote: On 04/20/2017 12:20 AM, Johannes Berg wrote: On Wed, 2017-04-19 at 23:31 +0200, Johannes Berg wrote: Hi Alexei, Daniel, I'm looking at adding the __wifi_sk_buff I talked about,

Re: __sk_buff.data_end

2017-04-19 Thread Alexei Starovoitov
On Thu, Apr 20, 2017 at 02:01:49AM +0200, Daniel Borkmann wrote: > On 04/20/2017 12:20 AM, Johannes Berg wrote: > >On Wed, 2017-04-19 at 23:31 +0200, Johannes Berg wrote: > >>Hi Alexei, Daniel, > >> > >>I'm looking at adding the __wifi_sk_buff I talked about, and I notice > >>that it uses CB space

Re: __sk_buff.data_end

2017-04-19 Thread Daniel Borkmann
On 04/20/2017 12:20 AM, Johannes Berg wrote: On Wed, 2017-04-19 at 23:31 +0200, Johannes Berg wrote: Hi Alexei, Daniel, I'm looking at adding the __wifi_sk_buff I talked about, and I notice that it uses CB space to store data_end. Unfortunately, in a lot of cases, we don't have any CB space to

Re: __sk_buff.data_end

2017-04-19 Thread Daniel Borkmann
On 04/19/2017 11:31 PM, Johannes Berg wrote: Hi Alexei, Daniel, I'm looking at adding the __wifi_sk_buff I talked about, and I notice that it uses CB space to store data_end. Unfortunately, in a lot of cases, we don't have any CB space to spare in wifi. Is there any way to generate a series of

Re: __sk_buff.data_end

2017-04-19 Thread Johannes Berg
On Wed, 2017-04-19 at 23:31 +0200, Johannes Berg wrote: > Hi Alexei, Daniel, > > I'm looking at adding the __wifi_sk_buff I talked about, and I notice > that it uses CB space to store data_end. Unfortunately, in a lot of > cases, we don't have any CB space to spare in wifi. I guess I can work

__sk_buff.data_end

2017-04-19 Thread Johannes Berg
Hi Alexei, Daniel, I'm looking at adding the __wifi_sk_buff I talked about, and I notice that it uses CB space to store data_end. Unfortunately, in a lot of cases, we don't have any CB space to spare in wifi. Is there any way to generate a series of instructions that instead does the necessary