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;
>