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

The AF_PACKET code has a bunch of calls to synchronize_net() while in a
syscall from userland.  These become very visible in some applications
(e.g. just plain starting wireshark when the system has a lot of
interfaces.)

Add a "synchronize_net_expedited()" for cases like these.

Signed-off-by: David Lamparter <equinox@...c24.net>
---
 include/linux/netdevice.h |  2 ++
 net/core/dev.c            | 13 +++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 0d994710b335..fcc8cfe5e4d8 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -74,6 +74,8 @@ struct bpf_prog;
 struct xdp_buff;
 
 void synchronize_net(void);
+void synchronize_net_expedited(void);
+
 void netdev_set_default_ethtool_ops(struct net_device *dev,
 				    const struct ethtool_ops *ops);
 
diff --git a/net/core/dev.c b/net/core/dev.c
index 8d25ec5b3af7..d53c171040c6 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -10633,6 +10633,19 @@ void synchronize_net(void)
 }
 EXPORT_SYMBOL(synchronize_net);
 
+/**
+ *	synchronize_net_expedited - synchronize_net, but always expedited
+ *
+ *	Some callers may have reasons other than "RTNL held" to want expedited
+ *	RCU sync.  A prominent example is if the RCU delay is user visible.
+ */
+void synchronize_net_expedited(void)
+{
+	might_sleep();
+	synchronize_rcu_expedited();
+}
+EXPORT_SYMBOL(synchronize_net_expedited);
+
 /**
  *	unregister_netdevice_queue - remove device from the kernel
  *	@dev: device
-- 
2.35.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ