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]
Date:   Sun, 13 Mar 2022 11:00:33 +0100
From:   David Lamparter <equinox@...c24.net>
To:     netdev@...r.kernel.org
Cc:     David Lamparter <equinox@...c24.net>
Subject: [PATCH net-next 2/2] net/packet: use synchronize_net_expedited()

Since these locations don't have RTNL held, synchronize_net() uses
synchronize_rcu(), which takes its time.  Unfortunately, this is user
visible on bind() and close() calls from userspace.  With a good amount
of network interfaces, this sums up to Wireshark (dumpcap) taking
several seconds to start for no good reason.

Signed-off-by: David Lamparter <equinox@...c24.net>
---
 net/packet/af_packet.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 1b93ce1a5600..559e72149110 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -379,7 +379,7 @@ static void __unregister_prot_hook(struct sock *sk, bool sync)
 
 	if (sync) {
 		spin_unlock(&po->bind_lock);
-		synchronize_net();
+		synchronize_net_expedited();
 		spin_lock(&po->bind_lock);
 	}
 }
@@ -1578,7 +1578,7 @@ static void __fanout_set_data_bpf(struct packet_fanout *f, struct bpf_prog *new)
 	spin_unlock(&f->lock);
 
 	if (old) {
-		synchronize_net();
+		synchronize_net_expedited();
 		bpf_prog_destroy(old);
 	}
 }
@@ -3137,7 +3137,7 @@ static int packet_release(struct socket *sock)
 
 	f = fanout_release(sk);
 
-	synchronize_net();
+	synchronize_net_expedited();
 
 	kfree(po->rollover);
 	if (f) {
@@ -4453,7 +4453,7 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u,
 	}
 	spin_unlock(&po->bind_lock);
 
-	synchronize_net();
+	synchronize_net_expedited();
 
 	err = -EBUSY;
 	mutex_lock(&po->pg_vec_lock);
-- 
2.35.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ