lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6bf46527-e4d9-41d0-9213-94af1394add9@redhat.com>
Date: Tue, 18 Mar 2025 21:39:52 +0100
From: Paolo Abeni <pabeni@...hat.com>
To: Eric Dumazet <edumazet@...gle.com>
Cc: netdev@...r.kernel.org, Andrew Lunn <andrew+netdev@...n.ch>,
 "David S. Miller" <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>,
 Simon Horman <horms@...nel.org>, Sabrina Dubroca <sd@...asysnail.net>
Subject: Re: [PATCH v2] net: introduce per netns packet chains

on 3/18/25 7:55 PM, Eric Dumazet wrote:
> On Tue, Mar 18, 2025 at 7:03 PM Paolo Abeni <pabeni@...hat.com> wrote:
>> @@ -2529,7 +2546,7 @@ void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev)
>>                 pt_prev = ptype;
>>         }
>>
>> -       if (ptype_list == &net_hotdata.ptype_all) {
>> +       if (ptype_list == &dev_net_rcu(dev)->ptype_all) {
> 
> Using the following should be faster, generated code will be shorter.

Right. I can do that in the next revision.

>> @@ -5830,6 +5848,14 @@ static int __netif_receive_skb_core(struct sk_buff **pskb, bool pfmemalloc,
>>                 deliver_ptype_list_skb(skb, &pt_prev, orig_dev, type,
>>                                        &ptype_base[ntohs(type) &
>>                                                    PTYPE_HASH_MASK]);
>> +
>> +               /* The only per net ptype user - packet socket - matches
>> +                * the target netns vs dev_net(skb->dev); we need to
>> +                * process only such netns even when orig_dev lays in a
>> +                * different one.
>> +                */
>> +               deliver_ptype_list_skb(skb, &pt_prev, orig_dev, type,
>> +                                      &dev_net_rcu(skb->dev)->ptype_specific);
> 
> I am banging my head here.  I probably need some sleep :)

Let me rephrase. I think `skb->dev` and `orig_dev` potentially can be
located in different netns; prior to this patch all the netns
ptype_specific ptype for a given type were placed in the same ptype_base
slot, and traversed by the first deliver_ptype_list_skb() call.

Now we don't need to traverse the lists on both netns, as the ptype rcv
function (packet_rcv) will ignore packets with dev_net(skb->dev) !=
ptype->pf_packet_net.

Does the above help?

Thanks,

Paolo


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ