From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Dumazet Subject: Re: [PATCH bpf-next] flow_dissector: lookup netns by skb->sk if skb->dev is NULL Date: Wed, 26 Sep 2018 17:49:07 -0700 Message-ID: <7e189586-4be0-1e2c-ed40-b676f2cf22db@gmail.com> References: <20180924204956.83718-1-willemdebruijn.kernel@gmail.com> <1cc82769-d4c4-2976-d341-0537d2d2eb24@iogearbox.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: ast@kernel.org, davem@davemloft.net, Willem de Bruijn To: Daniel Borkmann , Willem de Bruijn , netdev@vger.kernel.org Return-path: Received: from mail-lf1-f66.google.com ([209.85.167.66]:40244 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726557AbeI0HEs (ORCPT ); Thu, 27 Sep 2018 03:04:48 -0400 Received: by mail-lf1-f66.google.com with SMTP id t22-v6so683122lfb.7 for ; Wed, 26 Sep 2018 17:49:12 -0700 (PDT) In-Reply-To: <1cc82769-d4c4-2976-d341-0537d2d2eb24@iogearbox.net> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 09/25/2018 08:38 AM, Daniel Borkmann wrote: > On 09/24/2018 10:49 PM, Willem de Bruijn wrote: >> From: Willem de Bruijn >> >> BPF flow dissectors are configured per network namespace. >> __skb_flow_dissect looks up the netns through dev_net(skb->dev). >> >> In some dissector paths skb->dev is NULL, such as for Unix sockets. >> In these cases fall back to looking up the netns by socket. >> >> Analyzing the codepaths leading to __skb_flow_dissect I did not find >> a case where both skb->dev and skb->sk are NULL. Warn and fall back to >> standard flow dissector if one is found. >> >> Fixes: d58e468b1112 ("flow_dissector: implements flow dissector BPF hook") >> Reported-by: Eric Dumazet >> Signed-off-by: Willem de Bruijn > > Applied to bpf-next, thanks Willem! > Sadly lib/test_bpf should still cause crashes, because populate_skb() populates an skb attached to a fake device, for which net pointer is NULL.