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: <20241218144530.2963326-9-ap420073@gmail.com>
Date: Wed, 18 Dec 2024 14:45:29 +0000
From: Taehee Yoo <ap420073@...il.com>
To: davem@...emloft.net,
	kuba@...nel.org,
	pabeni@...hat.com,
	edumazet@...gle.com,
	almasrymina@...gle.com,
	donald.hunter@...il.com,
	corbet@....net,
	michael.chan@...adcom.com,
	andrew+netdev@...n.ch,
	hawk@...nel.org,
	ilias.apalodimas@...aro.org,
	ast@...nel.org,
	daniel@...earbox.net,
	john.fastabend@...il.com,
	dw@...idwei.uk,
	sdf@...ichev.me,
	asml.silence@...il.com,
	brett.creeley@....com,
	linux-doc@...r.kernel.org,
	netdev@...r.kernel.org
Cc: kory.maincent@...tlin.com,
	maxime.chevallier@...tlin.com,
	danieller@...dia.com,
	hengqi@...ux.alibaba.com,
	ecree.xilinx@...il.com,
	przemyslaw.kitszel@...el.com,
	hkallweit1@...il.com,
	ahmed.zaki@...el.com,
	rrameshbabu@...dia.com,
	idosch@...dia.com,
	jiri@...nulli.us,
	bigeasy@...utronix.de,
	lorenzo@...nel.org,
	jdamato@...tly.com,
	aleksander.lobakin@...el.com,
	kaiyuanz@...gle.com,
	willemb@...gle.com,
	daniel.zahka@...il.com,
	ap420073@...il.com
Subject: [PATCH net-next v6 8/9] net: disallow setup single buffer XDP when tcp-data-split is enabled.

When a single buffer XDP is attached, NIC should guarantee only single
page packets will be received.
tcp-data-split feature splits packets into header and payload. single
buffer XDP can't handle it properly.
So attaching single buffer XDP should be disallowed when tcp-data-split
is enabled.

Signed-off-by: Taehee Yoo <ap420073@...il.com>
---

v6:
 - Patch added.

 net/core/dev.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/net/core/dev.c b/net/core/dev.c
index 6a68db95de76..da4a34bfb675 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -92,6 +92,7 @@
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/ethtool.h>
+#include <linux/ethtool_netlink.h>
 #include <linux/skbuff.h>
 #include <linux/kthread.h>
 #include <linux/bpf.h>
@@ -9498,6 +9499,15 @@ int dev_xdp_propagate(struct net_device *dev, struct netdev_bpf *bpf)
 	if (!dev->netdev_ops->ndo_bpf)
 		return -EOPNOTSUPP;
 
+	if (dev->ethtool->hds_config == ETHTOOL_TCP_DATA_SPLIT_ENABLED &&
+	    (bpf->command == XDP_SETUP_PROG ||
+	     bpf->command == XDP_SETUP_PROG_HW) &&
+	    bpf->prog && !bpf->prog->aux->xdp_has_frags) {
+		NL_SET_ERR_MSG(bpf->extack,
+			       "unable to propagate XDP to device using tcp-data-split");
+		return -EBUSY;
+	}
+
 	if (dev_get_min_mp_channel_count(dev)) {
 		NL_SET_ERR_MSG(bpf->extack, "unable to propagate XDP to device using memory provider");
 		return -EBUSY;
@@ -9535,6 +9545,12 @@ static int dev_xdp_install(struct net_device *dev, enum bpf_xdp_mode mode,
 	struct netdev_bpf xdp;
 	int err;
 
+	if (dev->ethtool->hds_config == ETHTOOL_TCP_DATA_SPLIT_ENABLED &&
+	    prog && !prog->aux->xdp_has_frags) {
+		NL_SET_ERR_MSG(extack, "unable to install XDP to device using tcp-data-split");
+		return -EBUSY;
+	}
+
 	if (dev_get_min_mp_channel_count(dev)) {
 		NL_SET_ERR_MSG(extack, "unable to install XDP to device using memory provider");
 		return -EBUSY;
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ