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] [day] [month] [year] [list]
Message-ID: <CANn89i+rCxZgzoM2qJ5yB1NnJoQpovS6_8xdrX5yrxxcC-x9dg@mail.gmail.com>
Date:   Fri, 17 Feb 2023 16:54:11 +0100
From:   Eric Dumazet <edumazet@...gle.com>
To:     Felix Fietkau <nbd@....name>
Cc:     netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>, linux-kernel@...r.kernel.org
Subject: Re: [RFC v2] net/core: add optional threading for rps backlog processing

On Fri, Feb 17, 2023 at 4:26 PM Felix Fietkau <nbd@....name> wrote:

>
> > Then, process_backlog() has been designed to run only from the cpu
> > tied to the per-cpu data (softnet_data)
> > There are multiple comments about this assumption, and various things
> > that would need to be changed
> > (eg sd_has_rps_ipi_waiting() would be wrong in its current implementation)
> That's why I added the NAPI_STATE_THREADED check in napi_schedule_rps,
> so that sd_has_rps_ipi_waiting would always return false.
> Or are you worried about a race when enabling threading?
>

Please look at all uses of sd->process_queue, without locking. They do
not care about NAPI_STATE_THREADED

flush_backlog() is one instance, but process_backlog() is also using
__skb_dequeue(&sd->process_queue)

I suspect the following patch would work today, and would show
process_queue lock is not used.

diff --git a/net/core/dev.c b/net/core/dev.c
index 5687b528d4c18ef2960edb6bf3161bbad666aece..bed540b417a1b4cd3e384611a4681b8e2a43fd30
100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -11396,7 +11396,7 @@ static int __init net_dev_init(void)
                INIT_WORK(flush, flush_backlog);

                skb_queue_head_init(&sd->input_pkt_queue);
-               skb_queue_head_init(&sd->process_queue);
+               __skb_queue_head_init(&sd->process_queue);
 #ifdef CONFIG_XFRM_OFFLOAD
                skb_queue_head_init(&sd->xfrm_backlog);
 #endif

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ