[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <906045d5-206d-09a4-9de9-97789adbe701@gmail.com>
Date: Thu, 27 Sep 2018 05:58:54 -0700
From: Eric Dumazet <eric.dumazet@...il.com>
To: Song Liu <songliubraving@...com>, netdev@...r.kernel.org
Cc: daniel@...earbox.net, kernel-team@...com,
Willem de Bruijn <willemb@...gle.com>,
Petar Penkov <ppenkov@...gle.com>
Subject: Re: [PATCH bpf-next] bpf: test_bpf: add dummy dev->net for
flow_dissector
On 09/27/2018 12:15 AM, Song Liu wrote:
> Latest changes in __skb_flow_dissect() assume skb->dev has valid nd_net.
> However, this is not true for test_bpf. As a result, test_bpf.ko crashes
> the system with the following stack trace:
>
> + dev_net_set(&dev, &net);
This is yet another fake stuff that will break some day, so many other things would
need to be setup properly in a real "struct net"
What about using the current net_ns ?
dev_net_set(&dev, current->nsproxy->net_ns);
This might be &init_net in the context of test_bpf(), so maybe simply use &init_net
to clearly state that test_bpf is not net ns fully ready.
> + RCU_INIT_POINTER(net.flow_dissector_prog, NULL);
This really was not needed. Everything is already zero.
> skb->dev = &dev;
> skb->dev->ifindex = SKB_DEV_IFINDEX;
> skb->dev->type = SKB_DEV_TYPE;
>
Powered by blists - more mailing lists