| Seq | Timestamp | Type | Name | Duration |
|---|---|---|---|---|
| 0/0 | 2026/09/23 02:27 | flow | patch-triage |
0mArgs:null Results: {
"EnableConfigs": null,
"FocusSymbols": [],
"KMSANReasoning": "",
"NeedsKMSAN": false,
"Reasoning": "The patch series only touches user-space selftests, Makefiles, and test scripts under tools/testing/selftests/ (migrating xdp_features from bpf selftests to drivers/net/hw). No executable kernel code or modules are modified.",
"WorthFuzzing": false
} |
| 1/1 | 2026/09/23 02:27 | action | read-patch-diff |
0mArgs:null Results: {
"PatchDiff": "commit 399251728766d5b4ecfa6bd7fb584c92aa89d8a4\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate: Wed Sep 23 02:27:50 2026 +0000\n\n syz-cluster: applied patch under review\n\ndiff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile\nindex 93c707116fad0..cb76b68c97dbb 100644\n--- a/tools/testing/selftests/bpf/Makefile\n+++ b/tools/testing/selftests/bpf/Makefile\n@@ -126,7 +126,7 @@ TEST_PROGS := test_kmod.sh \\\n \ttest_bpftool_build.sh \\\n \ttest_doc_build.sh \\\n \ttest_xsk.sh \\\n-\ttest_xdp_features.sh\n+\t#\n \n TEST_PROGS_EXTENDED := \\\n \tima_setup.sh verify_sig_setup.sh\n@@ -142,7 +142,6 @@ TEST_GEN_PROGS_EXTENDED = \\\n \ttest_cpp \\\n \ttest_lirc_mode2_user \\\n \tveristat \\\n-\txdp_features \\\n \txdp_hw_metadata \\\n \txdp_synproxy \\\n \txskxceiver\n@@ -544,7 +543,6 @@ test_subskeleton_lib.skel.h-deps := test_subskeleton_lib2.bpf.o test_subskeleton\n test_usdt.skel.h-deps := test_usdt.bpf.o test_usdt_multispec.bpf.o\n xsk_xdp_progs.skel.h-deps := xsk_xdp_progs.bpf.o\n xdp_hw_metadata.skel.h-deps := xdp_hw_metadata.bpf.o\n-xdp_features.skel.h-deps := xdp_features.bpf.o\n tracing_multi.skel.h-deps := tracing_multi_attach.bpf.o tracing_multi_check.bpf.o\n tracing_multi_module.skel.h-deps := tracing_multi_attach_module.bpf.o tracing_multi_check.bpf.o\n tracing_multi_intersect.skel.h-deps := tracing_multi_intersect_attach.bpf.o tracing_multi_check.bpf.o\n@@ -947,13 +945,6 @@ $(OUTPUT)/xdp_hw_metadata: xdp_hw_metadata.c xsk.c network_helpers.c \\\n \t$(call msg,BINARY,,$@)\n \t$(Q)$(CC) $(CFLAGS) $(filter %.a %.o %.c,$^) $(LDLIBS) -o $@\n \n-$(OUTPUT)/xdp_features: xdp_features.c network_helpers.c xdp_features.h \\\n-\t\t\t network_helpers.h \\\n-\t\t\t test_progs.h bpf_util.h $(OUTPUT)/xdp_features.skel.h \\\n-\t\t\t $(BPFOBJ) | $(OUTPUT)\n-\t$(call msg,BINARY,,$@)\n-\t$(Q)$(CC) $(CFLAGS) $(filter %.a %.o %.c,$^) $(LDLIBS) -o $@\n-\n # Make sure we are able to include and link libbpf against c++.\n CXXFLAGS += $(CFLAGS)\n CXXFLAGS := $(subst -D_GNU_SOURCE=,,$(CXXFLAGS))\ndiff --git a/tools/testing/selftests/bpf/test_xdp_features.sh b/tools/testing/selftests/bpf/test_xdp_features.sh\ndeleted file mode 100755\nindex 0aa71c4455c05..0000000000000\n--- a/tools/testing/selftests/bpf/test_xdp_features.sh\n+++ /dev/null\n@@ -1,107 +0,0 @@\n-#!/bin/bash\n-# SPDX-License-Identifier: GPL-2.0\n-\n-readonly NS=\"ns1-$(mktemp -u XXXXXX)\"\n-readonly V0_IP4=10.10.0.11\n-readonly V1_IP4=10.10.0.1\n-readonly V0_IP6=2001:db8::11\n-readonly V1_IP6=2001:db8::1\n-\n-ret=1\n-\n-setup() {\n-\t{\n-\t\tip netns add ${NS}\n-\n-\t\tip link add v1 type veth peer name v0 netns ${NS}\n-\n-\t\tip link set v1 up\n-\t\tip addr add $V1_IP4/24 dev v1\n-\t\tip addr add $V1_IP6/64 nodad dev v1\n-\t\tip -n ${NS} link set dev v0 up\n-\t\tip -n ${NS} addr add $V0_IP4/24 dev v0\n-\t\tip -n ${NS} addr add $V0_IP6/64 nodad dev v0\n-\n-\t\t# Enable XDP mode and disable checksum offload\n-\t\tethtool -K v1 gro on\n-\t\tethtool -K v1 tx-checksumming off\n-\t\tip netns exec ${NS} ethtool -K v0 gro on\n-\t\tip netns exec ${NS} ethtool -K v0 tx-checksumming off\n-\t} \u003e /dev/null 2\u003e\u00261\n-}\n-\n-cleanup() {\n-\tip link del v1 2\u003e /dev/null\n-\tip netns del ${NS} 2\u003e /dev/null\n-\t[ \"$(pidof xdp_features)\" = \"\" ] || kill $(pidof xdp_features) 2\u003e /dev/null\n-}\n-\n-wait_for_dut_server() {\n-\twhile sleep 1; do\n-\t\tss -tlp | grep -q xdp_features\n-\t\t[ $? -eq 0 ] \u0026\u0026 break\n-\tdone\n-}\n-\n-test_xdp_features() {\n-\tsetup\n-\n-\t## XDP_PASS\n-\t./xdp_features -f XDP_PASS -D $V1_IP6 -T $V0_IP6 v1 \u0026\n-\twait_for_dut_server\n-\tip netns exec ${NS} ./xdp_features -t -f XDP_PASS \\\n-\t\t\t\t\t -D $V1_IP6 -C $V1_IP6 \\\n-\t\t\t\t\t -T $V0_IP6 v0\n-\t[ $? -ne 0 ] \u0026\u0026 exit\n-\n-\t## XDP_DROP\n-\t./xdp_features -f XDP_DROP -D ::ffff:$V1_IP4 -T ::ffff:$V0_IP4 v1 \u0026\n-\twait_for_dut_server\n-\tip netns exec ${NS} ./xdp_features -t -f XDP_DROP \\\n-\t\t\t\t\t -D ::ffff:$V1_IP4 \\\n-\t\t\t\t\t -C ::ffff:$V1_IP4 \\\n-\t\t\t\t\t -T ::ffff:$V0_IP4 v0\n-\t[ $? -ne 0 ] \u0026\u0026 exit\n-\n-\t## XDP_ABORTED\n-\t./xdp_features -f XDP_ABORTED -D $V1_IP6 -T $V0_IP6 v1 \u0026\n-\twait_for_dut_server\n-\tip netns exec ${NS} ./xdp_features -t -f XDP_ABORTED \\\n-\t\t\t\t\t -D $V1_IP6 -C $V1_IP6 \\\n-\t\t\t\t\t -T $V0_IP6 v0\n-\t[ $? -ne 0 ] \u0026\u0026 exit\n-\n-\t## XDP_TX\n-\t./xdp_features -f XDP_TX -D ::ffff:$V1_IP4 -T ::ffff:$V0_IP4 v1 \u0026\n-\twait_for_dut_server\n-\tip netns exec ${NS} ./xdp_features -t -f XDP_TX \\\n-\t\t\t\t\t -D ::ffff:$V1_IP4 \\\n-\t\t\t\t\t -C ::ffff:$V1_IP4 \\\n-\t\t\t\t\t -T ::ffff:$V0_IP4 v0\n-\t[ $? -ne 0 ] \u0026\u0026 exit\n-\n-\t## XDP_REDIRECT\n-\t./xdp_features -f XDP_REDIRECT -D $V1_IP6 -T $V0_IP6 v1 \u0026\n-\twait_for_dut_server\n-\tip netns exec ${NS} ./xdp_features -t -f XDP_REDIRECT \\\n-\t\t\t\t\t -D $V1_IP6 -C $V1_IP6 \\\n-\t\t\t\t\t -T $V0_IP6 v0\n-\t[ $? -ne 0 ] \u0026\u0026 exit\n-\n-\t## XDP_NDO_XMIT\n-\t./xdp_features -f XDP_NDO_XMIT -D ::ffff:$V1_IP4 -T ::ffff:$V0_IP4 v1 \u0026\n-\twait_for_dut_server\n-\tip netns exec ${NS} ./xdp_features -t -f XDP_NDO_XMIT \\\n-\t\t\t\t\t -D ::ffff:$V1_IP4 \\\n-\t\t\t\t\t -C ::ffff:$V1_IP4 \\\n-\t\t\t\t\t -T ::ffff:$V0_IP4 v0\n-\tret=$?\n-\tcleanup\n-}\n-\n-set -e\n-trap cleanup 2 3 6 9\n-\n-test_xdp_features\n-\n-exit $ret\ndiff --git a/tools/testing/selftests/drivers/net/hw/.gitignore b/tools/testing/selftests/drivers/net/hw/.gitignore\nindex 46540468a7753..a0cd8bc3739d8 100644\n--- a/tools/testing/selftests/drivers/net/hw/.gitignore\n+++ b/tools/testing/selftests/drivers/net/hw/.gitignore\n@@ -2,3 +2,6 @@\n iou-zcrx\n ncdevmem\n toeplitz\n+tools/\n+xdp_features\n+xdp_features.skel.h\ndiff --git a/tools/testing/selftests/drivers/net/hw/Makefile b/tools/testing/selftests/drivers/net/hw/Makefile\nindex 8aebdc6feb177..a5dea02ee476d 100644\n--- a/tools/testing/selftests/drivers/net/hw/Makefile\n+++ b/tools/testing/selftests/drivers/net/hw/Makefile\n@@ -50,6 +50,7 @@ TEST_PROGS = \\\n \ttso.py \\\n \tuserns_devmem.py \\\n \tuso.py \\\n+\txdp_features.py \\\n \txdp_metadata.py \\\n \txsk_reconfig.py \\\n \t#\n@@ -80,6 +81,7 @@ YNL_GEN_FILES := \\\n # end of YNL_GEN_FILES\n TEST_GEN_FILES += $(YNL_GEN_FILES)\n TEST_GEN_FILES += $(patsubst %.c,%.o,$(wildcard *.bpf.c))\n+TEST_GEN_PROGS += xdp_features\n \n include ../../../lib.mk\n \n@@ -93,6 +95,26 @@ include ../../../net/ynl.mk\n \n include ../../../net/bpf.mk\n \n+BPFTOOL ?= bpftool\n+\n+CFLAGS += -I$(OUTPUT) -I$(SCRATCH_DIR)/include\n+CFLAGS += -I$(top_srcdir)/tools/include\n+CFLAGS += -I$(top_srcdir)/tools/arch/$(SRCARCH)/include\n+CFLAGS += -I$(top_srcdir)/tools/include/uapi\n+CFLAGS += -I../../../net/lib\n+\n+$(OUTPUT)/xdp_features.skel.h: $(OUTPUT)/xdp_features.bpf.o\n+\t$(call msg,GEN-SKEL,,$@)\n+\t$(Q)$(BPFTOOL) gen skeleton $\u003c name xdp_features \u003e $@\n+\n+$(OUTPUT)/xdp_features: xdp_features.c xdp_features.h \\\n+\t\t\t $(OUTPUT)/xdp_features.skel.h $(BPFOBJ)\n+\t$(call msg,BINARY,,$@)\n+\t$(Q)$(CC) $(CFLAGS) $(filter %.a %.o %.c,$^) \\\n+\t\t$(LDLIBS) -lelf -lz -lpthread -o $@\n+\n+EXTRA_CLEAN += $(OUTPUT)/xdp_features.skel.h\n+\n ifeq ($(HAS_IOURING_ZCRX),y)\n $(OUTPUT)/iou-zcrx: LDLIBS += -luring -lpthread\n endif\ndiff --git a/tools/testing/selftests/bpf/progs/xdp_features.c b/tools/testing/selftests/drivers/net/hw/xdp_features.bpf.c\nsimilarity index 100%\nrename from tools/testing/selftests/bpf/progs/xdp_features.c\nrename to tools/testing/selftests/drivers/net/hw/xdp_features.bpf.c\ndiff --git a/tools/testing/selftests/bpf/xdp_features.c b/tools/testing/selftests/drivers/net/hw/xdp_features.c\nsimilarity index 86%\nrename from tools/testing/selftests/bpf/xdp_features.c\nrename to tools/testing/selftests/drivers/net/hw/xdp_features.c\nindex a27ed663967c4..ccc0630bb6cff 100644\n--- a/tools/testing/selftests/bpf/xdp_features.c\n+++ b/tools/testing/selftests/drivers/net/hw/xdp_features.c\n@@ -1,22 +1,26 @@\n // SPDX-License-Identifier: GPL-2.0\n-#include \u003cuapi/linux/bpf.h\u003e\n-#include \u003cuapi/linux/netdev.h\u003e\n+#include \u003clinux/bpf.h\u003e\n+#include \u003clinux/netdev.h\u003e\n #include \u003clinux/if_link.h\u003e\n-#include \u003csignal.h\u003e\n #include \u003cargp.h\u003e\n+#include \u003cerrno.h\u003e\n #include \u003cnet/if.h\u003e\n+#include \u003cpthread.h\u003e\n+#include \u003csignal.h\u003e\n+#include \u003cstdbool.h\u003e\n+#include \u003cstdio.h\u003e\n+#include \u003cstdlib.h\u003e\n+#include \u003cstring.h\u003e\n #include \u003csys/socket.h\u003e\n+#include \u003csys/time.h\u003e\n #include \u003cnetinet/in.h\u003e\n #include \u003cnetinet/tcp.h\u003e\n #include \u003cunistd.h\u003e\n #include \u003carpa/inet.h\u003e\n #include \u003cbpf/bpf.h\u003e\n #include \u003cbpf/libbpf.h\u003e\n-#include \u003cpthread.h\u003e\n \n-#include \u003cnetwork_helpers.h\u003e\n-\n-#include \"bpf_util.h\"\n+#include \"ksft.h\"\n #include \"xdp_features.skel.h\"\n #include \"xdp_features.h\"\n \n@@ -40,7 +44,63 @@ static struct env {\n \n #define BUFSIZE\t\t128\n \n-void test__fail(void) { /* for network_helpers.c */ }\n+static int make_sockaddr(const char *addr_str, __u16 port,\n+\t\t\t struct sockaddr_storage *addr)\n+{\n+\tstruct sockaddr_in6 *sin6 = (void *)addr;\n+\n+\tmemset(addr, 0, sizeof(*addr));\n+\tsin6-\u003esin6_family = AF_INET6;\n+\tsin6-\u003esin6_port = htons(port);\n+\tif (addr_str \u0026\u0026 inet_pton(AF_INET6, addr_str, \u0026sin6-\u003esin6_addr) != 1)\n+\t\treturn -1;\n+\n+\treturn 0;\n+}\n+\n+static int settimeo(int fd, int timeout_ms)\n+{\n+\tstruct timeval timeout = { .tv_sec = 3 };\n+\n+\tif (timeout_ms \u003e 0) {\n+\t\ttimeout.tv_sec = timeout_ms / 1000;\n+\t\ttimeout.tv_usec = (timeout_ms % 1000) * 1000;\n+\t}\n+\n+\tif (setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, \u0026timeout,\n+\t\t sizeof(timeout)) ||\n+\t setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, \u0026timeout,\n+\t\t sizeof(timeout)))\n+\t\treturn -1;\n+\n+\treturn 0;\n+}\n+\n+static int start_server(int type, __u16 port)\n+{\n+\tstruct sockaddr_storage addr;\n+\tint fd, on = 1;\n+\n+\tfd = socket(AF_INET6, type, 0);\n+\tif (fd \u003c 0)\n+\t\treturn -1;\n+\n+\tif (settimeo(fd, 0) ||\n+\t setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, \u0026on, sizeof(on)) ||\n+\t (type == SOCK_STREAM \u0026\u0026\n+\t setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, \u0026on, sizeof(on))) ||\n+\t make_sockaddr(NULL, port, \u0026addr) ||\n+\t bind(fd, (struct sockaddr *)\u0026addr, sizeof(struct sockaddr_in6)) ||\n+\t (type == SOCK_STREAM \u0026\u0026 listen(fd, 1))) {\n+\t\tint err = errno;\n+\n+\t\tclose(fd);\n+\t\terrno = err;\n+\t\treturn -1;\n+\t}\n+\n+\treturn fd;\n+}\n \n static int libbpf_print_fn(enum libbpf_print_level level,\n \t\t\t const char *format, va_list args)\n@@ -151,8 +211,7 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)\n \t\t}\n \t\tbreak;\n \tcase 'D':\n-\t\tif (make_sockaddr(AF_INET6, arg, DUT_ECHO_PORT,\n-\t\t\t\t \u0026env.dut_addr, NULL)) {\n+\t\tif (make_sockaddr(arg, DUT_ECHO_PORT, \u0026env.dut_addr)) {\n \t\t\tfprintf(stderr,\n \t\t\t\t\"Invalid address assigned to the Device Under Test: %s\\n\",\n \t\t\t\targ);\n@@ -160,8 +219,7 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)\n \t\t}\n \t\tbreak;\n \tcase 'C':\n-\t\tif (make_sockaddr(AF_INET6, arg, DUT_CTRL_PORT,\n-\t\t\t\t \u0026env.dut_ctrl_addr, NULL)) {\n+\t\tif (make_sockaddr(arg, DUT_CTRL_PORT, \u0026env.dut_ctrl_addr)) {\n \t\t\tfprintf(stderr,\n \t\t\t\t\"Invalid address assigned to the Device Under Test: %s\\n\",\n \t\t\t\targ);\n@@ -169,7 +227,7 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)\n \t\t}\n \t\tbreak;\n \tcase 'T':\n-\t\tif (make_sockaddr(AF_INET6, arg, 0, \u0026env.tester_addr, NULL)) {\n+\t\tif (make_sockaddr(arg, 0, \u0026env.tester_addr)) {\n \t\t\tfprintf(stderr,\n \t\t\t\t\"Invalid address assigned to the Tester device: %s\\n\",\n \t\t\t\targ);\n@@ -213,12 +271,11 @@ static void set_env_default(void)\n \tenv.feature.drv_feature = NETDEV_XDP_ACT_NDO_XMIT;\n \tenv.feature.action = -EINVAL;\n \tenv.ifindex = -ENODEV;\n-\tstrscpy(env.ifname, \"unknown\");\n-\tmake_sockaddr(AF_INET6, \"::ffff:127.0.0.1\", DUT_CTRL_PORT,\n-\t\t \u0026env.dut_ctrl_addr, NULL);\n-\tmake_sockaddr(AF_INET6, \"::ffff:127.0.0.1\", DUT_ECHO_PORT,\n-\t\t \u0026env.dut_addr, NULL);\n-\tmake_sockaddr(AF_INET6, \"::ffff:127.0.0.1\", 0, \u0026env.tester_addr, NULL);\n+\tsnprintf(env.ifname, sizeof(env.ifname), \"unknown\");\n+\tmake_sockaddr(\"::ffff:127.0.0.1\", DUT_CTRL_PORT,\n+\t\t \u0026env.dut_ctrl_addr);\n+\tmake_sockaddr(\"::ffff:127.0.0.1\", DUT_ECHO_PORT, \u0026env.dut_addr);\n+\tmake_sockaddr(\"::ffff:127.0.0.1\", 0, \u0026env.tester_addr);\n }\n \n static void *dut_echo_thread(void *arg)\n@@ -229,7 +286,7 @@ static void *dut_echo_thread(void *arg)\n \twhile (!exiting) {\n \t\tstruct tlv_hdr *tlv = (struct tlv_hdr *)buf;\n \t\tstruct sockaddr_storage addr;\n-\t\tsocklen_t addrlen;\n+\t\tsocklen_t addrlen = sizeof(addr);\n \t\tsize_t n;\n \n \t\tn = recvfrom(sockfd, buf, sizeof(buf), MSG_WAITALL,\n@@ -244,7 +301,6 @@ static void *dut_echo_thread(void *arg)\n \t\t (struct sockaddr *)\u0026addr, addrlen);\n \t}\n \n-\tpthread_exit((void *)0);\n \tclose(sockfd);\n \n \treturn NULL;\n@@ -254,9 +310,8 @@ static int dut_run_echo_thread(pthread_t *t, int *sockfd)\n {\n \tint err;\n \n-\tsockfd = start_reuseport_server(AF_INET6, SOCK_DGRAM, NULL,\n-\t\t\t\t\tDUT_ECHO_PORT, 0, 1);\n-\tif (!sockfd) {\n+\t*sockfd = start_server(SOCK_DGRAM, DUT_ECHO_PORT);\n+\tif (*sockfd \u003c 0) {\n \t\tfprintf(stderr,\n \t\t\t\"Failed creating data UDP socket on device %s\\n\",\n \t\t\tenv.ifname);\n@@ -269,7 +324,7 @@ static int dut_run_echo_thread(pthread_t *t, int *sockfd)\n \t\tfprintf(stderr,\n \t\t\t\"Failed creating data UDP thread on device %s: %s\\n\",\n \t\t\tenv.ifname, strerror(-err));\n-\t\tfree_fds(sockfd, 1);\n+\t\tclose(*sockfd);\n \t\treturn -EINVAL;\n \t}\n \n@@ -361,25 +416,25 @@ static int recv_msg(int sockfd, void *buf, size_t bufsize, void *val,\n static int dut_run(struct xdp_features *skel)\n {\n \tint flags = XDP_FLAGS_UPDATE_IF_NOEXIST | XDP_FLAGS_DRV_MODE;\n-\tint state, err = 0, *sockfd, ctrl_sockfd, echo_sockfd;\n+\tint state = CMD_STOP, err = 0, sockfd, ctrl_sockfd, echo_sockfd;\n \tstruct sockaddr_storage ctrl_addr;\n \tpthread_t dut_thread = 0;\n-\tsocklen_t addrlen;\n+\tsocklen_t addrlen = sizeof(ctrl_addr);\n \n-\tsockfd = start_reuseport_server(AF_INET6, SOCK_STREAM, NULL,\n-\t\t\t\t\tDUT_CTRL_PORT, 0, 1);\n-\tif (!sockfd) {\n+\tsockfd = start_server(SOCK_STREAM, DUT_CTRL_PORT);\n+\tif (sockfd \u003c 0) {\n \t\tfprintf(stderr,\n \t\t\t\"Failed creating control socket on device %s\\n\", env.ifname);\n \t\treturn -errno;\n \t}\n+\tksft_ready();\n \n-\tctrl_sockfd = accept(*sockfd, (struct sockaddr *)\u0026ctrl_addr, \u0026addrlen);\n+\tctrl_sockfd = accept(sockfd, (struct sockaddr *)\u0026ctrl_addr, \u0026addrlen);\n \tif (ctrl_sockfd \u003c 0) {\n \t\tfprintf(stderr,\n \t\t\t\"Failed accepting connections on device %s control socket\\n\",\n \t\t\tenv.ifname);\n-\t\tfree_fds(sockfd, 1);\n+\t\tclose(sockfd);\n \t\treturn -errno;\n \t}\n \n@@ -488,7 +543,7 @@ static int dut_run(struct xdp_features *skel)\n out:\n \tbpf_xdp_detach(env.ifindex, flags, NULL);\n \tclose(ctrl_sockfd);\n-\tfree_fds(sockfd, 1);\n+\tclose(sockfd);\n \n \treturn err;\n }\n@@ -636,13 +691,14 @@ static int tester_run(struct xdp_features *skel)\n \tif (err)\n \t\tgoto out;\n \n+\t/* Collect results before cleanup traffic can reach the tester. */\n+\tdetected_cap = tester_collect_detected_cap(skel, ntohl(stats));\n+\n \t/* stop the test */\n \terr = send_and_recv_msg(sockfd, CMD_STOP, NULL, 0);\n \t/* send a new echo message to wake echo thread of the dut */\n \tsend_echo_msg();\n \n-\tdetected_cap = tester_collect_detected_cap(skel, ntohl(stats));\n-\n \tfprintf(stdout, \"Feature %s: [%s][%s]\\n\", get_xdp_feature_str(),\n \t\tdetected_cap ? GREEN(\"DETECTED\") : RED(\"NOT DETECTED\"),\n \t\tenv.feature.drv_feature \u0026 advertised_feature ? GREEN(\"ADVERTISED\")\ndiff --git a/tools/testing/selftests/bpf/xdp_features.h b/tools/testing/selftests/drivers/net/hw/xdp_features.h\nsimilarity index 100%\nrename from tools/testing/selftests/bpf/xdp_features.h\nrename to tools/testing/selftests/drivers/net/hw/xdp_features.h\ndiff --git a/tools/testing/selftests/drivers/net/hw/xdp_features.py b/tools/testing/selftests/drivers/net/hw/xdp_features.py\nnew file mode 100755\nindex 0000000000000..5eeadf8033d8f\n--- /dev/null\n+++ b/tools/testing/selftests/drivers/net/hw/xdp_features.py\n@@ -0,0 +1,109 @@\n+#!/usr/bin/env python3\n+# SPDX-License-Identifier: GPL-2.0\n+\n+\"\"\"Check that a device's advertised XDP features match its behavior.\"\"\"\n+\n+import ipaddress\n+from pathlib import Path\n+import re\n+import shlex\n+\n+from lib.py import bkg, cmd, ksft_eq, ksft_exit, ksft_run, NetDrvEpEnv\n+\n+\n+ANSI_ESCAPE = re.compile(r\"\\x1b\\[[0-9;]*m\")\n+RESULT = re.compile(\n+ r\"Feature .*: \\[(NOT )?DETECTED\\]\\[(NOT )?ADVERTISED\\]\"\n+)\n+\n+\n+def mapped_address(address):\n+ \"\"\"Return an IPv6 or IPv4-mapped IPv6 address for xdp_features.\"\"\"\n+ address = ipaddress.ip_address(address)\n+ if address.version == 4:\n+ return f\"::ffff:{address}\"\n+ return str(address)\n+\n+\n+def feature_command(binary, feature, dut_addr, tester_addr, ifname,\n+ tester=False):\n+ args = [str(binary)]\n+ if tester:\n+ args.append(\"-t\")\n+ args += [\"-f\", feature, \"-D\", dut_addr]\n+ if tester:\n+ args += [\"-C\", dut_addr]\n+ args += [\"-T\", tester_addr, ifname]\n+ return shlex.join(args)\n+\n+\n+def run_feature(cfg, feature, ipver):\n+ if not cfg.addr_v[ipver]:\n+ ipver = \"4\" if ipver == \"6\" else \"6\"\n+ cfg.require_ipver(ipver)\n+ dut_addr = mapped_address(cfg.addr_v[ipver])\n+ tester_addr = mapped_address(cfg.remote_addr_v[ipver])\n+\n+ dut_cmd = feature_command(cfg.xdp_features, feature, dut_addr,\n+ tester_addr, cfg.ifname)\n+ tester_cmd = feature_command(cfg.remote_xdp_features, feature, dut_addr,\n+ tester_addr, cfg.remote_ifname, tester=True)\n+\n+ with bkg(dut_cmd, exit_wait=True, ksft_ready=True):\n+ result = cmd(tester_cmd, host=cfg.remote)\n+\n+ output = ANSI_ESCAPE.sub(\"\", result.stdout)\n+ match = RESULT.search(output)\n+ if not match:\n+ raise Exception(f\"Unable to parse xdp_features output: {output}\")\n+\n+ detected = match.group(1) is None\n+ advertised = match.group(2) is None\n+ ksft_eq(detected, advertised,\n+ comment=f\"{feature}: detected and advertised support\")\n+\n+\n+def test_xdp_pass(cfg):\n+ run_feature(cfg, \"XDP_PASS\", \"6\")\n+\n+\n+def test_xdp_drop(cfg):\n+ run_feature(cfg, \"XDP_DROP\", \"4\")\n+\n+\n+def test_xdp_aborted(cfg):\n+ run_feature(cfg, \"XDP_ABORTED\", \"6\")\n+\n+\n+def test_xdp_tx(cfg):\n+ run_feature(cfg, \"XDP_TX\", \"4\")\n+\n+\n+def test_xdp_redirect(cfg):\n+ run_feature(cfg, \"XDP_REDIRECT\", \"6\")\n+\n+\n+def test_xdp_ndo_xmit(cfg):\n+ run_feature(cfg, \"XDP_NDO_XMIT\", \"4\")\n+\n+\n+def main():\n+ with NetDrvEpEnv(__file__, nsim_test=False) as cfg:\n+ cfg.xdp_features = (Path(__file__).parent / \"xdp_features\").resolve()\n+ cfg.remote_xdp_features = cfg.remote.deploy(\n+ cfg.xdp_features.as_posix()\n+ )\n+\n+ ksft_run([\n+ test_xdp_pass,\n+ test_xdp_drop,\n+ test_xdp_aborted,\n+ test_xdp_tx,\n+ test_xdp_redirect,\n+ test_xdp_ndo_xmit,\n+ ], args=(cfg,))\n+ ksft_exit()\n+\n+\n+if __name__ == \"__main__\":\n+ main()\n"
} |
| 2/1 | 2026/09/23 02:27 | agent | patch-evaluator |
0mModel:core Args: null Results: {
"EnableConfigs": null,
"FocusSymbols": [],
"Reasoning": "The patch series only touches user-space selftests, Makefiles, and test scripts under tools/testing/selftests/ (migrating xdp_features from bpf selftests to drivers/net/hw). No executable kernel code or modules are modified.",
"WorthFuzzing": false
}Instruction: You are an expert Linux kernel maintainer and security engineer.
Your job is to review a provided patch series and evaluate whether it warrants fuzzing with syzkaller.
IMPORTANT: The changes have ALREADY been applied and committed as the HEAD commit in
your workspace. Do NOT rely on internal assumptions. You must actively use your code access
tools to inspect the actual source code, callers, and surrounding context.
================================================================================
1. CORE TRIAGE PHILOSOPHY
================================================================================
The goal of patch fuzzing is to discover crashes, regressions, exposed latent bugs,
and newly triggered assertions introduced by the patch series.
- REACHABILITY IS THE PRIMARY GATE:
Fuzzing can only discover bugs in code that can actually execute in standard virtualized
environments (GCE or QEMU, utilizing software-emulated devices like USB gadgets, netdev, tun/tap).
If the modified code is structurally unreachable (see Section 2), it MUST NOT be fuzzed,
regardless of whether it adds assertions or complex logic.
- DO NOT BLINDLY TRUST "NO FUNCTIONAL CHANGE" (NFCI) OR "REFACTORING" CLAIMS:
Patch authors routinely label changes as "cleanups", "refactorings", or state
"No functional change intended". Do NOT take these claims at face value.
Code refactorings that rearrange logic, introduce helper functions, or alter state management
in core subsystems frequently introduce subtle semantic shifts or uncover latent kernel bugs.
If reachable executable code is modified or refactored, it MUST be fuzzed.
- NEW OR MODIFIED ASSERTIONS IN REACHABLE CODE MUST BE FUZZED:
When a patch introduces or modifies runtime checks or assertions (e.g., WARN_ON*, VM_WARN_ON*,
BUG_ON*, lockdep_assert*) in reachable code paths, it enforces new or stricter invariants.
Even if the author believes the invariant always holds, fuzzing is essential to verify whether
an unusual sequence of operations can violate it.
================================================================================
2. WHEN TO RETURN WorthFuzzing=false (NEGATIVE CRITERIA)
================================================================================
Return WorthFuzzing=false ONLY IF all modified code falls strictly into one or more of these categories:
- Non-kernel and non-executable changes:
* Modifications to Documentation/, comments, or spelling fixes.
* User-space directories, self-tests, samples, or scripts (e.g., tools/, samples/, scripts/, usr/)
that do not affect the compiled kernel image (vmlinux) or kernel modules.
* Purely decorative logging (e.g., message strings in pr_err, printk, dev_info) or tracepoints
that do not alter control flow or data structures.
* Build system or Kconfig changes that do not alter compiled C logic.
- Structurally unreachable hardware:
* Vendor-specific PCIe switches, SmartNICs, or GPU drivers (e.g., mlxsw, pds_core, qed,
ionic, amdgpu) requiring physical ASIC/PCIe cards not emulated in standard QEMU.
- Unreachable execution paths:
* Driver teardown callbacks (.remove, .shutdown, pci_unregister_driver) executed only during
physical PCI hot-unplug or manual sysfs driver unbinding.
* Code paths exclusive to architectures other than the target architecture.
================================================================================
3. WHEN TO RETURN WorthFuzzing=true (POSITIVE CRITERIA)
================================================================================
Return WorthFuzzing=true whenever the patch touches reachable executable code, including:
- Core Subsystems:
* Any logic modifications in memory management (mm/), synchronization/locking (kernel/locking/),
BPF, scheduler, core networking, VFS, or syscall handling.
- Refactorings and Code Cleanups:
* Any restructuring of reachable data structures, helper abstractions, or algorithm flows.
- Runtime Assertions and Defensive Checks:
* Any introduction or alteration of assertions (WARN_ON*, VM_WARN_ON*, BUG_ON*, etc.) in reachable paths.
- Reachable Drivers and Protocols:
* Drivers accessible via virtual buses (virtio, USB gadget, loopback, netlink, binder, sockets, etc.).
================================================================================
4. EXTRACTING FocusSymbols (PREVENTING DILUTION)
================================================================================
When WorthFuzzing=true, you must extract specific kernel functions into FocusSymbols to guide the fuzzer:
- AVOID UBIQUITOUS LIFECYCLE HOT-PATHS:
Do NOT list generic, ubiquitous functions called by almost every program in the corpus
(including, but not limited to: general memory allocators and deallocators, page fault
and trap handlers, or core synchronization primitives; this is not an exhaustive list).
Listing ubiquitous functions causes the fuzzer to classify thousands of unrelated tests as "focused",
which severely dilutes fuzzing effort away from the actual changes.
- TARGET SPECIFIC FEATURE LOGIC AND ENTRYPOINTS:
List functions that specifically implement the logic being added or altered, or direct API entrypoints
for the subsystem feature under review.
- HANDLING STATIC INLINE FUNCTIONS IN HEADERS (.h):
Compiler-inlined static functions (such as static inlines in mm/*.h or include/linux/*.h) lack
distinct symbol addresses in vmlinux and cannot be targeted directly by symbol coverage filters.
If the changes are primarily in static inline helpers, identify non-static, feature-specific caller
functions in .c files that exercise them (avoiding ubiquitous lifecycle wrappers).
================================================================================
5. IDENTIFYING EnableConfigs
================================================================================
Identify any specific CONFIG_ options required to properly compile and reach the modified code:
- Inspect Kconfig files and #ifdef guards; do not make assumptions.
- Check "depends on" lines in Kconfig to include any non-standard parent subsystem configs needed.
- Strip any 'CONFIG_' prefix (e.g., return "NET_IPV4" instead of "CONFIG_NET_IPV4").
Prefer calling several tools at the same time to save round-trips.
Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.
Prompt: Target architecture: amd64
For your convenience, here is the diff of the changes:
commit 399251728766d5b4ecfa6bd7fb584c92aa89d8a4
Author: syz-cluster <triage@syzkaller.com>
Date: Wed Sep 23 02:27:50 2026 +0000
syz-cluster: applied patch under review
diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index 93c707116fad0..cb76b68c97dbb 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -126,7 +126,7 @@ TEST_PROGS := test_kmod.sh \
test_bpftool_build.sh \
test_doc_build.sh \
test_xsk.sh \
- test_xdp_features.sh
+ #
TEST_PROGS_EXTENDED := \
ima_setup.sh verify_sig_setup.sh
@@ -142,7 +142,6 @@ TEST_GEN_PROGS_EXTENDED = \
test_cpp \
test_lirc_mode2_user \
veristat \
- xdp_features \
xdp_hw_metadata \
xdp_synproxy \
xskxceiver
@@ -544,7 +543,6 @@ test_subskeleton_lib.skel.h-deps := test_subskeleton_lib2.bpf.o test_subskeleton
test_usdt.skel.h-deps := test_usdt.bpf.o test_usdt_multispec.bpf.o
xsk_xdp_progs.skel.h-deps := xsk_xdp_progs.bpf.o
xdp_hw_metadata.skel.h-deps := xdp_hw_metadata.bpf.o
-xdp_features.skel.h-deps := xdp_features.bpf.o
tracing_multi.skel.h-deps := tracing_multi_attach.bpf.o tracing_multi_check.bpf.o
tracing_multi_module.skel.h-deps := tracing_multi_attach_module.bpf.o tracing_multi_check.bpf.o
tracing_multi_intersect.skel.h-deps := tracing_multi_intersect_attach.bpf.o tracing_multi_check.bpf.o
@@ -947,13 +945,6 @@ $(OUTPUT)/xdp_hw_metadata: xdp_hw_metadata.c xsk.c network_helpers.c \
$(call msg,BINARY,,$@)
$(Q)$(CC) $(CFLAGS) $(filter %.a %.o %.c,$^) $(LDLIBS) -o $@
-$(OUTPUT)/xdp_features: xdp_features.c network_helpers.c xdp_features.h \
- network_helpers.h \
- test_progs.h bpf_util.h $(OUTPUT)/xdp_features.skel.h \
- $(BPFOBJ) | $(OUTPUT)
- $(call msg,BINARY,,$@)
- $(Q)$(CC) $(CFLAGS) $(filter %.a %.o %.c,$^) $(LDLIBS) -o $@
-
# Make sure we are able to include and link libbpf against c++.
CXXFLAGS += $(CFLAGS)
CXXFLAGS := $(subst -D_GNU_SOURCE=,,$(CXXFLAGS))
diff --git a/tools/testing/selftests/bpf/test_xdp_features.sh b/tools/testing/selftests/bpf/test_xdp_features.sh
deleted file mode 100755
index 0aa71c4455c05..0000000000000
--- a/tools/testing/selftests/bpf/test_xdp_features.sh
+++ /dev/null
@@ -1,107 +0,0 @@
-#!/bin/bash
-# SPDX-License-Identifier: GPL-2.0
-
-readonly NS="ns1-$(mktemp -u XXXXXX)"
-readonly V0_IP4=10.10.0.11
-readonly V1_IP4=10.10.0.1
-readonly V0_IP6=2001:db8::11
-readonly V1_IP6=2001:db8::1
-
-ret=1
-
-setup() {
- {
- ip netns add ${NS}
-
- ip link add v1 type veth peer name v0 netns ${NS}
-
- ip link set v1 up
- ip addr add $V1_IP4/24 dev v1
- ip addr add $V1_IP6/64 nodad dev v1
- ip -n ${NS} link set dev v0 up
- ip -n ${NS} addr add $V0_IP4/24 dev v0
- ip -n ${NS} addr add $V0_IP6/64 nodad dev v0
-
- # Enable XDP mode and disable checksum offload
- ethtool -K v1 gro on
- ethtool -K v1 tx-checksumming off
- ip netns exec ${NS} ethtool -K v0 gro on
- ip netns exec ${NS} ethtool -K v0 tx-checksumming off
- } > /dev/null 2>&1
-}
-
-cleanup() {
- ip link del v1 2> /dev/null
- ip netns del ${NS} 2> /dev/null
- [ "$(pidof xdp_features)" = "" ] || kill $(pidof xdp_features) 2> /dev/null
-}
-
-wait_for_dut_server() {
- while sleep 1; do
- ss -tlp | grep -q xdp_features
- [ $? -eq 0 ] && break
- done
-}
-
-test_xdp_features() {
- setup
-
- ## XDP_PASS
- ./xdp_features -f XDP_PASS -D $V1_IP6 -T $V0_IP6 v1 &
- wait_for_dut_server
- ip netns exec ${NS} ./xdp_features -t -f XDP_PASS \
- -D $V1_IP6 -C $V1_IP6 \
- -T $V0_IP6 v0
- [ $? -ne 0 ] && exit
-
- ## XDP_DROP
- ./xdp_features -f XDP_DROP -D ::ffff:$V1_IP4 -T ::ffff:$V0_IP4 v1 &
- wait_for_dut_server
- ip netns exec ${NS} ./xdp_features -t -f XDP_DROP \
- -D ::ffff:$V1_IP4 \
- -C ::ffff:$V1_IP4 \
- -T ::ffff:$V0_IP4 v0
- [ $? -ne 0 ] && exit
-
- ## XDP_ABORTED
- ./xdp_features -f XDP_ABORTED -D $V1_IP6 -T $V0_IP6 v1 &
- wait_for_dut_server
- ip netns exec ${NS} ./xdp_features -t -f XDP_ABORTED \
- -D $V1_IP6 -C $V1_IP6 \
- -T $V0_IP6 v0
- [ $? -ne 0 ] && exit
-
- ## XDP_TX
- ./xdp_features -f XDP_TX -D ::ffff:$V1_IP4 -T ::ffff:$V0_IP4 v1 &
- wait_for_dut_server
- ip netns exec ${NS} ./xdp_features -t -f XDP_TX \
- -D ::ffff:$V1_IP4 \
- -C ::ffff:$V1_IP4 \
- -T ::ffff:$V0_IP4 v0
- [ $? -ne 0 ] && exit
-
- ## XDP_REDIRECT
- ./xdp_features -f XDP_REDIRECT -D $V1_IP6 -T $V0_IP6 v1 &
- wait_for_dut_server
- ip netns exec ${NS} ./xdp_features -t -f XDP_REDIRECT \
- -D $V1_IP6 -C $V1_IP6 \
- -T $V0_IP6 v0
- [ $? -ne 0 ] && exit
-
- ## XDP_NDO_XMIT
- ./xdp_features -f XDP_NDO_XMIT -D ::ffff:$V1_IP4 -T ::ffff:$V0_IP4 v1 &
- wait_for_dut_server
- ip netns exec ${NS} ./xdp_features -t -f XDP_NDO_XMIT \
- -D ::ffff:$V1_IP4 \
- -C ::ffff:$V1_IP4 \
- -T ::ffff:$V0_IP4 v0
- ret=$?
- cleanup
-}
-
-set -e
-trap cleanup 2 3 6 9
-
-test_xdp_features
-
-exit $ret
diff --git a/tools/testing/selftests/drivers/net/hw/.gitignore b/tools/testing/selftests/drivers/net/hw/.gitignore
index 46540468a7753..a0cd8bc3739d8 100644
--- a/tools/testing/selftests/drivers/net/hw/.gitignore
+++ b/tools/testing/selftests/drivers/net/hw/.gitignore
@@ -2,3 +2,6 @@
iou-zcrx
ncdevmem
toeplitz
+tools/
+xdp_features
+xdp_features.skel.h
diff --git a/tools/testing/selftests/drivers/net/hw/Makefile b/tools/testing/selftests/drivers/net/hw/Makefile
index 8aebdc6feb177..a5dea02ee476d 100644
--- a/tools/testing/selftests/drivers/net/hw/Makefile
+++ b/tools/testing/selftests/drivers/net/hw/Makefile
@@ -50,6 +50,7 @@ TEST_PROGS = \
tso.py \
userns_devmem.py \
uso.py \
+ xdp_features.py \
xdp_metadata.py \
xsk_reconfig.py \
#
@@ -80,6 +81,7 @@ YNL_GEN_FILES := \
# end of YNL_GEN_FILES
TEST_GEN_FILES += $(YNL_GEN_FILES)
TEST_GEN_FILES += $(patsubst %.c,%.o,$(wildcard *.bpf.c))
+TEST_GEN_PROGS += xdp_features
include ../../../lib.mk
@@ -93,6 +95,26 @@ include ../../../net/ynl.mk
include ../../../net/bpf.mk
+BPFTOOL ?= bpftool
+
+CFLAGS += -I$(OUTPUT) -I$(SCRATCH_DIR)/include
+CFLAGS += -I$(top_srcdir)/tools/include
+CFLAGS += -I$(top_srcdir)/tools/arch/$(SRCARCH)/include
+CFLAGS += -I$(top_srcdir)/tools/include/uapi
+CFLAGS += -I../../../net/lib
+
+$(OUTPUT)/xdp_features.skel.h: $(OUTPUT)/xdp_features.bpf.o
+ $(call msg,GEN-SKEL,,$@)
+ $(Q)$(BPFTOOL) gen skeleton $< name xdp_features > $@
+
+$(OUTPUT)/xdp_features: xdp_features.c xdp_features.h \
+ $(OUTPUT)/xdp_features.skel.h $(BPFOBJ)
+ $(call msg,BINARY,,$@)
+ $(Q)$(CC) $(CFLAGS) $(filter %.a %.o %.c,$^) \
+ $(LDLIBS) -lelf -lz -lpthread -o $@
+
+EXTRA_CLEAN += $(OUTPUT)/xdp_features.skel.h
+
ifeq ($(HAS_IOURING_ZCRX),y)
$(OUTPUT)/iou-zcrx: LDLIBS += -luring -lpthread
endif
diff --git a/tools/testing/selftests/bpf/progs/xdp_features.c b/tools/testing/selftests/drivers/net/hw/xdp_features.bpf.c
similarity index 100%
rename from tools/testing/selftests/bpf/progs/xdp_features.c
rename to tools/testing/selftests/drivers/net/hw/xdp_features.bpf.c
diff --git a/tools/testing/selftests/bpf/xdp_features.c b/tools/testing/selftests/drivers/net/hw/xdp_features.c
similarity index 86%
rename from tools/testing/selftests/bpf/xdp_features.c
rename to tools/testing/selftests/drivers/net/hw/xdp_features.c
index a27ed663967c4..ccc0630bb6cff 100644
--- a/tools/testing/selftests/bpf/xdp_features.c
+++ b/tools/testing/selftests/drivers/net/hw/xdp_features.c
@@ -1,22 +1,26 @@
// SPDX-License-Identifier: GPL-2.0
-#include <uapi/linux/bpf.h>
-#include <uapi/linux/netdev.h>
+#include <linux/bpf.h>
+#include <linux/netdev.h>
#include <linux/if_link.h>
-#include <signal.h>
#include <argp.h>
+#include <errno.h>
#include <net/if.h>
+#include <pthread.h>
+#include <signal.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#include <sys/socket.h>
+#include <sys/time.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <bpf/bpf.h>
#include <bpf/libbpf.h>
-#include <pthread.h>
-#include <network_helpers.h>
-
-#include "bpf_util.h"
+#include "ksft.h"
#include "xdp_features.skel.h"
#include "xdp_features.h"
@@ -40,7 +44,63 @@ static struct env {
#define BUFSIZE 128
-void test__fail(void) { /* for network_helpers.c */ }
+static int make_sockaddr(const char *addr_str, __u16 port,
+ struct sockaddr_storage *addr)
+{
+ struct sockaddr_in6 *sin6 = (void *)addr;
+
+ memset(addr, 0, sizeof(*addr));
+ sin6->sin6_family = AF_INET6;
+ sin6->sin6_port = htons(port);
+ if (addr_str && inet_pton(AF_INET6, addr_str, &sin6->sin6_addr) != 1)
+ return -1;
+
+ return 0;
+}
+
+static int settimeo(int fd, int timeout_ms)
+{
+ struct timeval timeout = { .tv_sec = 3 };
+
+ if (timeout_ms > 0) {
+ timeout.tv_sec = timeout_ms / 1000;
+ timeout.tv_usec = (timeout_ms % 1000) * 1000;
+ }
+
+ if (setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &timeout,
+ sizeof(timeout)) ||
+ setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &timeout,
+ sizeof(timeout)))
+ return -1;
+
+ return 0;
+}
+
+static int start_server(int type, __u16 port)
+{
+ struct sockaddr_storage addr;
+ int fd, on = 1;
+
+ fd = socket(AF_INET6, type, 0);
+ if (fd < 0)
+ return -1;
+
+ if (settimeo(fd, 0) ||
+ setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &on, sizeof(on)) ||
+ (type == SOCK_STREAM &&
+ setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on))) ||
+ make_sockaddr(NULL, port, &addr) ||
+ bind(fd, (struct sockaddr *)&addr, sizeof(struct sockaddr_in6)) ||
+ (type == SOCK_STREAM && listen(fd, 1))) {
+ int err = errno;
+
+ close(fd);
+ errno = err;
+ return -1;
+ }
+
+ return fd;
+}
static int libbpf_print_fn(enum libbpf_print_level level,
const char *format, va_list args)
@@ -151,8 +211,7 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)
}
break;
case 'D':
- if (make_sockaddr(AF_INET6, arg, DUT_ECHO_PORT,
- &env.dut_addr, NULL)) {
+ if (make_sockaddr(arg, DUT_ECHO_PORT, &env.dut_addr)) {
fprintf(stderr,
"Invalid address assigned to the Device Under Test: %s\n",
arg);
@@ -160,8 +219,7 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)
}
break;
case 'C':
- if (make_sockaddr(AF_INET6, arg, DUT_CTRL_PORT,
- &env.dut_ctrl_addr, NULL)) {
+ if (make_sockaddr(arg, DUT_CTRL_PORT, &env.dut_ctrl_addr)) {
fprintf(stderr,
"Invalid address assigned to the Device Under Test: %s\n",
arg);
@@ -169,7 +227,7 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)
}
break;
case 'T':
- if (make_sockaddr(AF_INET6, arg, 0, &env.tester_addr, NULL)) {
+ if (make_sockaddr(arg, 0, &env.tester_addr)) {
fprintf(stderr,
"Invalid address assigned to the Tester device: %s\n",
arg);
@@ -213,12 +271,11 @@ static void set_env_default(void)
env.feature.drv_feature = NETDEV_XDP_ACT_NDO_XMIT;
env.feature.action = -EINVAL;
env.ifindex = -ENODEV;
- strscpy(env.ifname, "unknown");
- make_sockaddr(AF_INET6, "::ffff:127.0.0.1", DUT_CTRL_PORT,
- &env.dut_ctrl_addr, NULL);
- make_sockaddr(AF_INET6, "::ffff:127.0.0.1", DUT_ECHO_PORT,
- &env.dut_addr, NULL);
- make_sockaddr(AF_INET6, "::ffff:127.0.0.1", 0, &env.tester_addr, NULL);
+ snprintf(env.ifname, sizeof(env.ifname), "unknown");
+ make_sockaddr("::ffff:127.0.0.1", DUT_CTRL_PORT,
+ &env.dut_ctrl_addr);
+ make_sockaddr("::ffff:127.0.0.1", DUT_ECHO_PORT, &env.dut_addr);
+ make_sockaddr("::ffff:127.0.0.1", 0, &env.tester_addr);
}
static void *dut_echo_thread(void *arg)
@@ -229,7 +286,7 @@ static void *dut_echo_thread(void *arg)
while (!exiting) {
struct tlv_hdr *tlv = (struct tlv_hdr *)buf;
struct sockaddr_storage addr;
- socklen_t addrlen;
+ socklen_t addrlen = sizeof(addr);
size_t n;
n = recvfrom(sockfd, buf, sizeof(buf), MSG_WAITALL,
@@ -244,7 +301,6 @@ static void *dut_echo_thread(void *arg)
(struct sockaddr *)&addr, addrlen);
}
- pthread_exit((void *)0);
close(sockfd);
return NULL;
@@ -254,9 +310,8 @@ static int dut_run_echo_thread(pthread_t *t, int *sockfd)
{
int err;
- sockfd = start_reuseport_server(AF_INET6, SOCK_DGRAM, NULL,
- DUT_ECHO_PORT, 0, 1);
- if (!sockfd) {
+ *sockfd = start_server(SOCK_DGRAM, DUT_ECHO_PORT);
+ if (*sockfd < 0) {
fprintf(stderr,
"Failed creating data UDP socket on device %s\n",
env.ifname);
@@ -269,7 +324,7 @@ static int dut_run_echo_thread(pthread_t *t, int *sockfd)
fprintf(stderr,
"Failed creating data UDP thread on device %s: %s\n",
env.ifname, strerror(-err));
- free_fds(sockfd, 1);
+ close(*sockfd);
return -EINVAL;
}
@@ -361,25 +416,25 @@ static int recv_msg(int sockfd, void *buf, size_t bufsize, void *val,
static int dut_run(struct xdp_features *skel)
{
int flags = XDP_FLAGS_UPDATE_IF_NOEXIST | XDP_FLAGS_DRV_MODE;
- int state, err = 0, *sockfd, ctrl_sockfd, echo_sockfd;
+ int state = CMD_STOP, err = 0, sockfd, ctrl_sockfd, echo_sockfd;
struct sockaddr_storage ctrl_addr;
pthread_t dut_thread = 0;
- socklen_t addrlen;
+ socklen_t addrlen = sizeof(ctrl_addr);
- sockfd = start_reuseport_server(AF_INET6, SOCK_STREAM, NULL,
- DUT_CTRL_PORT, 0, 1);
- if (!sockfd) {
+ sockfd = start_server(SOCK_STREAM, DUT_CTRL_PORT);
+ if (sockfd < 0) {
fprintf(stderr,
"Failed creating control socket on device %s\n", env.ifname);
return -errno;
}
+ ksft_ready();
- ctrl_sockfd = accept(*sockfd, (struct sockaddr *)&ctrl_addr, &addrlen);
+ ctrl_sockfd = accept(sockfd, (struct sockaddr *)&ctrl_addr, &addrlen);
if (ctrl_sockfd < 0) {
fprintf(stderr,
"Failed accepting connections on device %s control socket\n",
env.ifname);
- free_fds(sockfd, 1);
+ close(sockfd);
return -errno;
}
@@ -488,7 +543,7 @@ static int dut_run(struct xdp_features *skel)
out:
bpf_xdp_detach(env.ifindex, flags, NULL);
close(ctrl_sockfd);
- free_fds(sockfd, 1);
+ close(sockfd);
return err;
}
@@ -636,13 +691,14 @@ static int tester_run(struct xdp_features *skel)
if (err)
goto out;
+ /* Collect results before cleanup traffic can reach the tester. */
+ detected_cap = tester_collect_detected_cap(skel, ntohl(stats));
+
/* stop the test */
err = send_and_recv_msg(sockfd, CMD_STOP, NULL, 0);
/* send a new echo message to wake echo thread of the dut */
send_echo_msg();
- detected_cap = tester_collect_detected_cap(skel, ntohl(stats));
-
fprintf(stdout, "Feature %s: [%s][%s]\n", get_xdp_feature_str(),
detected_cap ? GREEN("DETECTED") : RED("NOT DETECTED"),
env.feature.drv_feature & advertised_feature ? GREEN("ADVERTISED")
diff --git a/tools/testing/selftests/bpf/xdp_features.h b/tools/testing/selftests/drivers/net/hw/xdp_features.h
similarity index 100%
rename from tools/testing/selftests/bpf/xdp_features.h
rename to tools/testing/selftests/drivers/net/hw/xdp_features.h
diff --git a/tools/testing/selftests/drivers/net/hw/xdp_features.py b/tools/testing/selftests/drivers/net/hw/xdp_features.py
new file mode 100755
index 0000000000000..5eeadf8033d8f
--- /dev/null
+++ b/tools/testing/selftests/drivers/net/hw/xdp_features.py
@@ -0,0 +1,109 @@
+#!/usr/bin/env python3
+# SPDX-License-Identifier: GPL-2.0
+
+"""Check that a device's advertised XDP features match its behavior."""
+
+import ipaddress
+from pathlib import Path
+import re
+import shlex
+
+from lib.py import bkg, cmd, ksft_eq, ksft_exit, ksft_run, NetDrvEpEnv
+
+
+ANSI_ESCAPE = re.compile(r"\x1b\[[0-9;]*m")
+RESULT = re.compile(
+ r"Feature .*: \[(NOT )?DETECTED\]\[(NOT )?ADVERTISED\]"
+)
+
+
+def mapped_address(address):
+ """Return an IPv6 or IPv4-mapped IPv6 address for xdp_features."""
+ address = ipaddress.ip_address(address)
+ if address.version == 4:
+ return f"::ffff:{address}"
+ return str(address)
+
+
+def feature_command(binary, feature, dut_addr, tester_addr, ifname,
+ tester=False):
+ args = [str(binary)]
+ if tester:
+ args.append("-t")
+ args += ["-f", feature, "-D", dut_addr]
+ if tester:
+ args += ["-C", dut_addr]
+ args += ["-T", tester_addr, ifname]
+ return shlex.join(args)
+
+
+def run_feature(cfg, feature, ipver):
+ if not cfg.addr_v[ipver]:
+ ipver = "4" if ipver == "6" else "6"
+ cfg.require_ipver(ipver)
+ dut_addr = mapped_address(cfg.addr_v[ipver])
+ tester_addr = mapped_address(cfg.remote_addr_v[ipver])
+
+ dut_cmd = feature_command(cfg.xdp_features, feature, dut_addr,
+ tester_addr, cfg.ifname)
+ tester_cmd = feature_command(cfg.remote_xdp_features, feature, dut_addr,
+ tester_addr, cfg.remote_ifname, tester=True)
+
+ with bkg(dut_cmd, exit_wait=True, ksft_ready=True):
+ result = cmd(tester_cmd, host=cfg.remote)
+
+ output = ANSI_ESCAPE.sub("", result.stdout)
+ match = RESULT.search(output)
+ if not match:
+ raise Exception(f"Unable to parse xdp_features output: {output}")
+
+ detected = match.group(1) is None
+ advertised = match.group(2) is None
+ ksft_eq(detected, advertised,
+ comment=f"{feature}: detected and advertised support")
+
+
+def test_xdp_pass(cfg):
+ run_feature(cfg, "XDP_PASS", "6")
+
+
+def test_xdp_drop(cfg):
+ run_feature(cfg, "XDP_DROP", "4")
+
+
+def test_xdp_aborted(cfg):
+ run_feature(cfg, "XDP_ABORTED", "6")
+
+
+def test_xdp_tx(cfg):
+ run_feature(cfg, "XDP_TX", "4")
+
+
+def test_xdp_redirect(cfg):
+ run_feature(cfg, "XDP_REDIRECT", "6")
+
+
+def test_xdp_ndo_xmit(cfg):
+ run_feature(cfg, "XDP_NDO_XMIT", "4")
+
+
+def main():
+ with NetDrvEpEnv(__file__, nsim_test=False) as cfg:
+ cfg.xdp_features = (Path(__file__).parent / "xdp_features").resolve()
+ cfg.remote_xdp_features = cfg.remote.deploy(
+ cfg.xdp_features.as_posix()
+ )
+
+ ksft_run([
+ test_xdp_pass,
+ test_xdp_drop,
+ test_xdp_aborted,
+ test_xdp_tx,
+ test_xdp_redirect,
+ test_xdp_ndo_xmit,
+ ], args=(cfg,))
+ ksft_exit()
+
+
+if __name__ == "__main__":
+ main()
|
| 3/2 | 2026/09/23 02:27 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 10435 output: 26 thoughts: 670 Thoughts: **WorthFuzzing=false: A Thorough Review** Okay, let's break this down systematically. The patch I'm reviewing modifies files exclusively within `tools/testing/selftests/`. I see a variety of files: Makefiles, shell scripts, C code, and a Python script, all relating to selftests, specifically around XDP features. I'm noting the refactoring of several files from `tools/testing/selftests/bpf/` to `tools/testing/selftests/drivers/net/hw/`, but it's still contained within the test infrastructure. Since I'm being thorough, I quickly confirmed that, according to the provided information, everything is confined within the testing directory. I'm now referencing the "WHEN TO RETURN WorthFuzzing=false (NEGATIVE CRITERIA)" section. Here's the key: all these modifications fall squarely under "User-space directories, self-tests, samples, or scripts (e.g., tools/, samples/, scripts/, usr/) that do not affect the compiled kernel image (vmlinux) or kernel modules." These are user-space tests; they don't touch the kernel's core logic. The patch is about testing and not functionality. Therefore, applying the "NEGATIVE CRITERIA," there's no reason to consider this patch for fuzzing. `WorthFuzzing` is definitively `false`. I'm double-checking just to eliminate any chance of overlook. |
| 4/2 | 2026/09/23 02:27 | tool | grepper |
0mArgs:{
"Expression": "xdp_features",
"PathPrefix": "net/"
}Results: {
"Output": "net/core/netdev-genl.c=51=XDP_METADATA_KFUNC_xxx\n--\nnet/core/netdev-genl.c-64-\t nla_put_u64_64bit(rsp, NETDEV_A_DEV_XDP_FEATURES,\nnet/core/netdev-genl.c:65:\t\t\t netdev-\u003exdp_features, NETDEV_A_DEV_PAD) ||\nnet/core/netdev-genl.c-66-\t nla_put_u64_64bit(rsp, NETDEV_A_DEV_XDP_RX_METADATA_FEATURES,\n--\nnet/core/netdev-genl.c-71-\nnet/core/netdev-genl.c:72:\tif (netdev-\u003exdp_features \u0026 NETDEV_XDP_ACT_XSK_ZEROCOPY) {\nnet/core/netdev-genl.c-73-\t\tif (nla_put_u32(rsp, NETDEV_A_DEV_XDP_ZC_MAX_SEGS,\n--\nnet/core/xdp.c=997=late_initcall(xdp_metadata_init);\nnet/core/xdp.c-998-\nnet/core/xdp.c:999:void xdp_set_features_flag_locked(struct net_device *dev, xdp_features_t val)\nnet/core/xdp.c-1000-{\nnet/core/xdp.c-1001-\tval \u0026= NETDEV_XDP_ACT_MASK;\nnet/core/xdp.c:1002:\tif (dev-\u003exdp_features == val)\nnet/core/xdp.c-1003-\t\treturn;\n--\nnet/core/xdp.c-1005-\tnetdev_assert_locked_or_invisible(dev);\nnet/core/xdp.c:1006:\tdev-\u003exdp_features = val;\nnet/core/xdp.c-1007-\n--\nnet/core/xdp.c=1011=EXPORT_SYMBOL_GPL(xdp_set_features_flag_locked);\nnet/core/xdp.c-1012-\nnet/core/xdp.c:1013:void xdp_set_features_flag(struct net_device *dev, xdp_features_t val)\nnet/core/xdp.c-1014-{\n--\nnet/core/xdp.c=1019=EXPORT_SYMBOL_GPL(xdp_set_features_flag);\nnet/core/xdp.c-1020-\nnet/core/xdp.c:1021:void xdp_features_set_redirect_target_locked(struct net_device *dev,\nnet/core/xdp.c-1022-\t\t\t\t\t bool support_sg)\nnet/core/xdp.c-1023-{\nnet/core/xdp.c:1024:\txdp_features_t val = (dev-\u003exdp_features | NETDEV_XDP_ACT_NDO_XMIT);\nnet/core/xdp.c-1025-\n--\nnet/core/xdp.c-1029-}\nnet/core/xdp.c:1030:EXPORT_SYMBOL_GPL(xdp_features_set_redirect_target_locked);\nnet/core/xdp.c-1031-\nnet/core/xdp.c:1032:void xdp_features_set_redirect_target(struct net_device *dev, bool support_sg)\nnet/core/xdp.c-1033-{\nnet/core/xdp.c-1034-\tnetdev_lock(dev);\nnet/core/xdp.c:1035:\txdp_features_set_redirect_target_locked(dev, support_sg);\nnet/core/xdp.c-1036-\tnetdev_unlock(dev);\nnet/core/xdp.c-1037-}\nnet/core/xdp.c:1038:EXPORT_SYMBOL_GPL(xdp_features_set_redirect_target);\nnet/core/xdp.c-1039-\nnet/core/xdp.c:1040:void xdp_features_clear_redirect_target_locked(struct net_device *dev)\nnet/core/xdp.c-1041-{\nnet/core/xdp.c:1042:\txdp_features_t val = dev-\u003exdp_features;\nnet/core/xdp.c-1043-\n--\nnet/core/xdp.c-1046-}\nnet/core/xdp.c:1047:EXPORT_SYMBOL_GPL(xdp_features_clear_redirect_target_locked);\nnet/core/xdp.c-1048-\nnet/core/xdp.c:1049:void xdp_features_clear_redirect_target(struct net_device *dev)\nnet/core/xdp.c-1050-{\nnet/core/xdp.c-1051-\tnetdev_lock(dev);\nnet/core/xdp.c:1052:\txdp_features_clear_redirect_target_locked(dev);\nnet/core/xdp.c-1053-\tnetdev_unlock(dev);\nnet/core/xdp.c-1054-}\nnet/core/xdp.c:1055:EXPORT_SYMBOL_GPL(xdp_features_clear_redirect_target);\n--\nnet/xdp/xsk_buff_pool.c=164=int xp_assign_dev(struct xsk_buff_pool *pool,\n--\nnet/xdp/xsk_buff_pool.c-211-\nnet/xdp/xsk_buff_pool.c:212:\tif ((netdev-\u003exdp_features \u0026 NETDEV_XDP_ACT_XSK) != NETDEV_XDP_ACT_XSK) {\nnet/xdp/xsk_buff_pool.c-213-\t\terr = -EOPNOTSUPP;\n"
} |
| 5/2 | 2026/09/23 02:27 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 13000 output: 87 thoughts: 221 Thoughts: **Analyzing the Scope of These Changes** Okay, so I'm looking at this patch and the key changes are all within `tools/testing/selftests/`. Specifically, it seems like we're moving the `xdp_features` test, which was in `tools/testing/selftests/bpf/`, over to `tools/testing/selftests/drivers/net/hw/`. My understanding is that, according to Section 2 of the relevant guidelines, modifications in user-space directories like this—self-tests, samples, or scripts that *don't* impact the compiled kernel image (`vmlinux`) or kernel modules—should be marked as not needing fuzzing. Makes sense. Therefore, let's configure the fuzzing parameters. Based on the analysis, I'm setting `WorthFuzzing` to `false`. Since this is isolated to the test infrastructure and doesn't introduce any kernel-level code changes, no symbols warranting focused fuzzing are present, so `FocusSymbols` will be an empty array (`[]`). Also, there's no requirement to enable any specific configurations as a result of these changes, and so `EnableConfigs` will likewise be an empty array (`[]`). Finally, the `Reasoning` should clearly state the rationale for these settings: "The patch only modifies user-space selftests and test build scripts under tools/testing/selftests/ (moving xdp_features tests to selftests/drivers/net/hw/), with no changes to the compiled kernel image (vmlinux) or kernel modules." Alright, with that established, let's get this set up. |
| 6/2 | 2026/09/23 02:28 | tool | set-results |
0mArgs:{
"EnableConfigs": [],
"FocusSymbols": [],
"Reasoning": "The patch series only touches user-space selftests, Makefiles, and test scripts under tools/testing/selftests/ (migrating xdp_features from bpf selftests to drivers/net/hw). No executable kernel code or modules are modified.",
"WorthFuzzing": false
}Results: {
"EnableConfigs": null,
"FocusSymbols": [],
"Reasoning": "The patch series only touches user-space selftests, Makefiles, and test scripts under tools/testing/selftests/ (migrating xdp_features from bpf selftests to drivers/net/hw). No executable kernel code or modules are modified.",
"WorthFuzzing": false
} |
| 7/1 | 2026/09/23 02:28 | action | If |
0mArgs:{
"WorthFuzzing": false
}Results: null |
| Total Calls | Total Tokens | Avg Tokens | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|
| Total Calls | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|