Re: Interruption in eBPF program after kernel update

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

On Thu, 2019-02-14 at 14:39 -0800, Y Song wrote:
> On Thu, Feb 14, 2019 at 10:33 AM Eric Leblond <eric@xxxxxxxxx> wrote:
> > Hello,
> > 
> > On Wed, 2019-02-13 at 20:46 +0100, Eric Leblond wrote:
> > > Hello,
> > > 
> > > I've got a simple socket filter program that seems to interrupt
> > > when
> > > calling the load_word construct. I'm seeing the first message but
> > > never
> > > the second one.
> > > 
> > > The code is the following
> > > 
> > > int SEC("filter") hashfilter(struct __sk_buff *skb) {
> > >     __u32 nhoff = BPF_LL_OFF + ETH_HLEN;
> > 
> > So it seems the problem was coming from this line. Removing
> > BPF_LL_OFF
> > fixes the problem for kernel starting 4.18.
> 
> Maybe removing BPF_LL_OFF should work for all kernels?

OK, you are right. I really don't understand how it is possible but
same eBPF file without BPF_LL_OFF work on 4.17 at 4.19. Looks like
BPF_LL_OFF was just ignored in 4.17 but caused a problem on 4.19.

Thanks a lot.

BR,

> > Is this a known issue ?
> > 
> > Is there something that would allow a BPF file to work
> > independently of
> > the kernel version ?
> > 
> > >     __u32 ip = 0;
> > >     __u32 *value = NULL;
> > > #if 1
> > >     char fmtrei[] = "word load\n";
> > >     bpf_trace_printk(fmtrei, sizeof(fmtrei));
> > > #endif
> > >     ip = load_word(skb, nhoff + offsetof(struct iphdr, saddr));
> > > #if 1
> > >     char fmti[] = "work done\n";
> > >     bpf_trace_printk(fmti, sizeof(fmti));
> > > #endif
> > > In 4.18 and above this is not working but older kernel were ok.
> > > 
> > > Any suggestion will be appreciated.
> > > 
> > > Best regards,
> > 
> > BR,
> > --
> > Eric Leblond <eric@xxxxxxxxx>
> > 
-- 
Eric Leblond <eric@xxxxxxxxx>




[Index of Archives]     [Linux Networking Development]     [Fedora Linux Users]     [Linux SCTP]     [DCCP]     [Gimp]     [Yosemite Campsites]

  Powered by Linux