Skip to contentSkip to conversation

selftests/rdma: Add an eBPF-based testcase using netkit for RXE

PATCH Superseded Zhu Yanjun 2 participants 5 messages Oct 26

Subsystems (3)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Zhu Yanjun

author
#0 lore raw

v4 cover selftests/rdma: Add an eBPF-based testcase using netkit for RXE

Add a new self-test case to verify RXE (Soft-RoCE) traffic using netkit virtual interfaces and an eBPF tcx ingress program to dump and parse RDMA transport headers (BTH, etc.).

The test results:

# make -C tools/testing/selftests/ TARGETS=rdma run_tests
make: Entering directory '/root/linux/tools/testing/selftests'
clang -g -O2 -target bpf -D__TARGET_ARCH_x86 -I../../../../usr/include -I../../../../include/uapi -I../bpf -I/root/linux/tools/testing/selftests/rdma -c rxe_pkg_kernel_dump.c -o /root/linux/tools/testing/selftests/rdma/rxe_pkg_kernel_dump.o
bpftool gen skeleton /root/linux/tools/testing/selftests/rdma/rxe_pkg_kernel_dump.o > /root/linux/tools/testing/selftests/rdma/rxe_pkg_kernel.skel.h
gcc -D_GNU_SOURCE= -I/root/linux/tools/testing/selftests/../../../tools/testing/selftests  -g -Wall -I../../../../usr/include -I../../../../include/uapi -I../bpf -I/root/linux/tools/testing/selftests/rdma rxe_pkg_user_dump.c  -lbpf -lelf -lz -o /root/linux/tools/testing/selftests/rdma/rxe_netkit_dump
# timeout set to 45
# selftests: rdma: rxe_rping_between_netns.sh
# client DISCONNECT EVENT...
ok 1 selftests: rdma: rxe_rping_between_netns.sh
# timeout set to 45
# selftests: rdma: rxe_ipv6.sh
ok 2 selftests: rdma: rxe_ipv6.sh
# timeout set to 45
# selftests: rdma: rxe_socket_with_netns.sh
ok 3 selftests: rdma: rxe_socket_with_netns.sh
# timeout set to 45
# selftests: rdma: rxe_test_NETDEV_UNREGISTER.sh
ok 4 selftests: rdma: rxe_test_NETDEV_UNREGISTER.sh
# timeout set to 45
# selftests: rdma: rxe_sent_rcvd_bytes.sh
# server DISCONNECT EVENT...
# wait for RDMA_READ_ADV state 10
# client DISCONNECT EVENT...
ok 5 selftests: rdma: rxe_sent_rcvd_bytes.sh
# timeout set to 45
# selftests: rdma: rxe_netns_names.sh
# 1..0 # SKIP rdma netns exclusive mode is not supported
ok 6 selftests: rdma: rxe_netns_names.sh # SKIP
# timeout set to 45
# selftests: rdma: rxe_pkg_netkit.sh
# server DISCONNECT EVENT...
# wait for RDMA_READ_ADV state 10
# ./rxe_pkg_netkit.sh: line 28:  9866 Killed                  "$CUR_WD/rxe_netkit_dump"
ok 7 selftests: rdma: rxe_pkg_netkit.sh
make: Leaving directory '/root/linux/tools/testing/selftests'

---
V3 - > V4: Fix problems in user space app
V2 - > V3: Fix problems in user space application
V1 - > V2: Fix problems from sashiko
---

Zhu Yanjun (2):
selftests/rdma: Introduce eBPF kernel and user dump utilities for RXE selftests/rdma: Add netkit-based automated test script for RXE

 tools/testing/selftests/rdma/Makefile         |   23 +-
 tools/testing/selftests/rdma/config           |    3 +
 .../selftests/rdma/rxe_pkg_kernel_dump.c      |   62 +
 .../testing/selftests/rdma/rxe_pkg_netkit.sh  |   63 +
 .../selftests/rdma/rxe_pkg_user_dump.c        | 1275 +++++++++++++++++
 5 files changed, 1425 insertions(+), 1 deletion(-)
 create mode 100644 tools/testing/selftests/rdma/rxe_pkg_kernel_dump.c
 create mode 100755 tools/testing/selftests/rdma/rxe_pkg_netkit.sh
 create mode 100644 tools/testing/selftests/rdma/rxe_pkg_user_dump.c
Signature · 1 line
2.54.0
author
#1 lore raw

PATCH v4 1/2 selftests/rdma: Introduce eBPF kernel and user dump utilities for RXE

Add eBPF-based kernel and user-space packet dump utilities along with a netkit test script (rxe_pkg_netkit.sh) to tools/testing/selftests/rdma/. This enables capturing and parsing Soft-RoCE (RXE) traffic over netkit devices for testing purposes.

---
 tools/testing/selftests/rdma/Makefile         |   24 +-
 tools/testing/selftests/rdma/config           |    3 +
 tools/testing/selftests/rdma/rxe_pkg_common.h |   17 +
 .../selftests/rdma/rxe_pkg_kernel_dump.c      |   78 +
 .../selftests/rdma/rxe_pkg_user_dump.c        | 1365 +++++++++++++++++
 5 files changed, 1486 insertions(+), 1 deletion(-)
 create mode 100644 tools/testing/selftests/rdma/rxe_pkg_common.h
 create mode 100644 tools/testing/selftests/rdma/rxe_pkg_kernel_dump.c
 create mode 100644 tools/testing/selftests/rdma/rxe_pkg_user_dump.c
tools/testing/selftests/rdma/Makefile +23 -1
index a91c14c45006..f7783c20f40d 100644
@@ -4,6 +4,28 @@ TEST_PROGS := rxe_rping_between_netns.sh \
 		rxe_socket_with_netns.sh \
 		rxe_test_NETDEV_UNREGISTER.sh \
 		rxe_sent_rcvd_bytes.sh \
-		rxe_netns_names.sh
+		rxe_netns_names.sh \
+		rxe_pkg_netkit.sh
 
+TEST_GEN_PROGS_EXTENDED := rxe_netkit_dump
 include ../lib.mk
+
+CLANG	?= clang
+LLC	?= llc
+BPFTOOL	?= bpftool
+ARCH ?= $(shell uname -m | sed 's/x86_64/x86/' | sed 's/aarch64/arm64/' | sed 's/ppc64le/powerpc/')
+
+INCLUDES	:= -I../../../../usr/include -I../../../../include/uapi -I../bpf -I$(OUTPUT)
+CFLAGS		+= -g -Wall $(INCLUDES)
+LDFLAGS		+= -lbpf -lelf -lz
+
+$(OUTPUT)/rxe_netkit_dump: rxe_pkg_user_dump.c $(OUTPUT)/rxe_pkg_kernel.skel.h
+	$(CC) $(CFLAGS) $< $(LDFLAGS) -o $@
+
+$(OUTPUT)/rxe_pkg_kernel_dump.o: rxe_pkg_kernel_dump.c rxe_pkg_common.h
+	$(CLANG) -g -O2 -target bpf -D__TARGET_ARCH_$(ARCH) $(INCLUDES) -c $< -o $@
+
+$(OUTPUT)/rxe_pkg_kernel.skel.h: $(OUTPUT)/rxe_pkg_kernel_dump.o
+	$(BPFTOOL) gen skeleton $< > $@
+
+EXTRA_CLEAN := $(OUTPUT)/rxe_pkg_kernel_dump.o $(OUTPUT)/rxe_pkg_kernel.skel.h $(OUTPUT)/rxe_pkg_kernel.skel.h.tmp
tools/testing/selftests/rdma/config +3 -0
index e1ff54ec0f57..a98ffa95b0b7 100644
@@ -3,3 +3,6 @@ CONFIG_VETH
 CONFIG_DUMMY
 CONFIG_NET_NS
 CONFIG_RDMA_RXE
+CONFIG_BPF=y
+CONFIG_BPF_SYSCALL=y
+CONFIG_NETKIT=y
tools/testing/selftests/rdma/rxe_pkg_common.h new file +17 -0
new file mode 100644
index 000000000000..0dca4147d5f9
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
+/*
+ * Copyright (c) 2026 Zhu Yanjun <[email protected]>
+ */
+
+// rxe_pkg_common.h
+#ifndef RXE_PKG_COMMON_H
+#define RXE_PKG_COMMON_H
+
+#define MAX_PKT_LEN 512
+
+struct pkg_event {
+	__u32 len;
+	__u8 data[MAX_PKT_LEN];
+};
+
+#endif
tools/testing/selftests/rdma/rxe_pkg_kernel_dump.c new file +78 -0

78 lines not on this page · raw message

tools/testing/selftests/rdma/rxe_pkg_user_dump.c new file +1365 -0

1,365 lines not on this page · raw message

Signature · 1 line
2.54.0
author
#3 lore raw

PATCH v4 2/2 selftests/rdma: Add netkit-based automated test script for RXE

In reply to Zhu Yanjun

Add a shell script to automate functional and tracing tests for the Soft-RoCE (RXE) driver over netkit network interfaces. The script creates an isolated network namespace, sets up a netkit link pair (nk0/nk1), attaches RXE links, and runs an rping client/server verification test along with kernel tracing output collection.

---
 .../testing/selftests/rdma/rxe_pkg_netkit.sh  | 81 +++++++++++++++++++
 1 file changed, 81 insertions(+)
 create mode 100755 tools/testing/selftests/rdma/rxe_pkg_netkit.sh
tools/testing/selftests/rdma/rxe_pkg_netkit.sh new file +81 -0
new file mode 100755
index 000000000000..181e2d85eed7
@@ -0,0 +1,81 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
+# Copyright (c) 2026 Zhu Yanjun <[email protected]>
+if [ "$(id -u)" -ne 0 ]; then
+    echo "SKIP: This test must be run as root"
+    exit 4
+fi
+
+for cmd in ip rdma rping; do
+    if ! command -v "$cmd" >/dev/null 2>&1; then
+        echo "SKIP: Required tool '$cmd' not found"
+        exit 4
+    fi
+done
+
+if ! modprobe -n netkit >/dev/null 2>&1 || ! modprobe -n rdma_rxe >/dev/null 2>&1; then
+    echo "SKIP: Required kernel modules (netkit or rdma_rxe) are not available"
+    exit 4
+fi
+
+exec > /dev/null
+
+set -e
+
+CUR_WD="$(dirname "$0")"
+[ "$CUR_WD" = "." ] && CUR_WD="$(pwd)"
+
+cleanup() {
+    set +e
+    [ -n "$DUMP_PID" ] && kill -9 "$DUMP_PID" 2>/dev/null
+    unset DUMP_PID
+
+    rdma link del rxe1 2>/dev/null
+    ip link del nk0 2>/dev/null
+    ip netns delete ns0 2>/dev/null
+}
+
+trap cleanup EXIT INT TERM
+
+# Clear tracing buffer
+echo > /sys/kernel/debug/tracing/trace
+
+# Create network namespace and netkit peer links
+ip netns add ns0
+ip link add nk0 type netkit mode l2 peer name nk1
+ip link set nk0 up
+ip link set nk1 up
+
+# Configure namespace interface
+ip link set nk1 netns ns0
+ip netns exec ns0 ip addr add 10.0.0.1/24 dev nk1
+ip netns exec ns0 ip link set nk1 up
+
+# Configure host interface
+ip addr add 10.0.0.2/24 dev nk0
+
+# Start dump utility in background
+"$CUR_WD/rxe_netkit_dump" &
+DUMP_PID=$!
+
+# Add RXE links over netkit devices
+ip netns exec ns0 rdma link add rxe0 type rxe netdev nk1
+rdma link add rxe1 type rxe netdev nk0
+
+# Start rping server in namespace
+ip netns exec ns0 rping -s -a 10.0.0.1 -C 3 &
+
+# Add wait time
+sleep 1
+
+# Run rping client on host
+rping -c -a 10.0.0.1 -C 3
+
+# Tear down RDMA links and netkit devices
+ip netns exec ns0 rdma link del rxe0
+rdma link del rxe1
+ip link del nk0
+ip netns delete ns0
+
+# Display kernel trace output
+cat /sys/kernel/debug/tracing/trace
Signature · 1 line
2.54.0
#2 lore raw

Re: [PATCH v4 1/2] selftests/rdma: Introduce eBPF kernel and user dump utilities for RXE

In reply to Zhu Yanjun
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [Medium] selftests/rdma: missing bounds checks on headers in print_bpf_output() - [Medium]…

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] selftests/rdma: missing bounds checks on headers in print_bpf_output()
- [Medium] selftests/rdma: non-zero exit status on signal termination in main() --

commit 4272376de8af3a4ff5f669a42f1584996bddd230
Author: Zhu Yanjun <[email protected]>

selftests/rdma: Introduce eBPF kernel and user dump utilities for RXE

This commit adds eBPF-based kernel and user-space packet dump utilities to tools/testing/selftests/rdma/ to capture and parse Soft-RoCE (RXE) traffic over netkit devices.

Quoted 6 lines
tools/testing/selftests/rdma/rxe_pkg_user_dump.c new file +0 -0
new file mode 100644
index 0000000000000..5d51e7d1af66a
@@ -0,0 +1,1365 @@

[ ... ]

Quoted 2 lines
tools/testing/selftests/rdma/rxe_pkg_user_dump.c new file +2 -0
+static void print_bpf_output(const void *data, __u32 size)
+{

[ ... ]

Quoted 53 lines
tools/testing/selftests/rdma/rxe_pkg_user_dump.c new file +53 -0
+	for (int i = RXE_BTH + 1; i < NUM_HDR_TYPES; i++) {
+		int offset = rxe_opcode[bth->opcode].offset[i];
+
+		if (offset && (size >= sizeof(struct iphdr) + sizeof(struct udphdr) + offset)) {
+			const unsigned char *cur_p = (const unsigned char *)bth + offset;
+			size_t remaining_size = size - ((const void *)cur_p - data);
+
+			switch (i) {
+			case	RXE_RETH:
+				if (remaining_size < sizeof(struct rxe_reth))
+					break;
+				printf("RXE_RETH\n");
+				print_reth((const struct rxe_reth *)cur_p);
+				break;
+
+			case	RXE_AETH:
+				printf("RXE_AETH\n");
+				struct rxe_aeth *aeth = (struct rxe_aeth *)cur_p;
+
+				print_aeth(aeth);
+				break;
+
+			case	RXE_ATMETH:
+				printf("RXE_ATMETH\n");
+				struct rxe_atmeth *atmeth = (struct rxe_atmeth *)cur_p;
+
+				print_atmeth(atmeth);
+				break;
+
+			case	RXE_ATMACK:
+				printf("RXE_ATMACK\n");
+				struct rxe_atmack *atmack = (struct rxe_atmack *)cur_p;
+
+				print_atmack(atmack);
+				break;
+
+			case	RXE_IETH:
+				printf("RXE_IETH\n");
+				struct rxe_ieth *ieth = (struct rxe_ieth *)cur_p;
+
+				print_ieth(ieth);
+				break;
+
+			case	RXE_RDETH:
+				printf("RXE_RDETH\n");
+				struct rxe_rdeth *rdeth = (struct rxe_rdeth *)cur_p;
+
+				print_rdeth(rdeth);
+				break;
+
+			case	RXE_DETH:
+				printf("RXE_DETH\n");
+				struct rxe_deth *deth = (struct rxe_deth *)cur_p;

tools/testing/selftests/rdma/rxe_pkg_user_dump.c line 1251

Quoted 10 lines
tools/testing/selftests/rdma/rxe_pkg_user_dump.c new file +10 -0
+
+				print_deth(deth);
+				break;
+
+			case	RXE_IMMDT:
+				printf("RXE_IMMDT\n");
+				struct rxe_immdt *immdt = (struct rxe_immdt *)cur_p;
+
+				print_immdt(immdt);
+				break;

[Severity: Medium]
Can print_bpf_output() read past the captured packet length in e->data[] when parsing extended transport headers?

In handle_netkit_ingress() in tools/testing/selftests/rdma/rxe_pkg_kernel_dump.c, bpf_ringbuf_reserve() allocates an uninitialized struct pkg_event, and bpf_skb_load_bytes() only populates the first e->len bytes of e->data:

	e = bpf_ringbuf_reserve(&rb, sizeof(*e), 0);
	...
	e->len = len;
	if (bpf_skb_load_bytes(skb, 0, e->data, len) < 0) {

In print_bpf_output(), the condition:

	if (offset && (size >= sizeof(struct iphdr) + sizeof(struct udphdr) + offset))

only ensures that cur_p does not start past data + size (meaning remaining_size >= 0), not that remaining_size is large enough to hold the header structure at cur_p.

While the RXE_RETH case checks whether remaining_size < sizeof(struct rxe_reth), the cases for RXE_AETH, RXE_ATMETH, RXE_ATMACK, RXE_IETH, RXE_RDETH, RXE_DETH, and RXE_IMMDT dereference cur_p without checking remaining_size against their respective struct sizes. If a truncated UDP packet arrives on port 4791, won't these cases read uninitialized ring buffer memory past the end of the captured packet (or past the end of e->data[MAX_PKT_LEN] if e->len is near MAX_PKT_LEN)?

[ ... ]

Quoted 2 lines
tools/testing/selftests/rdma/rxe_pkg_user_dump.c new file +2 -0
+int main(void)
+{

[ ... ]

Quoted 7 lines
tools/testing/selftests/rdma/rxe_pkg_user_dump.c new file +7 -0
+	err = 0;
+
+	while (!exiting) {
+		err = ring_buffer__poll(ringbuf, 100 /* timeout */);
+		if (err < 0) {
+			if (err == -EINTR)
+				break;

tools/testing/selftests/rdma/rxe_pkg_user_dump.c line 1365

Quoted 10 lines
tools/testing/selftests/rdma/rxe_pkg_user_dump.c new file +10 -0
+			fprintf(stderr, "poll error: %d\n", err);
+			break;
+		}
+	}
+
+cleanup:
+	ring_buffer__free(ringbuf);
+	rxe_pkg_kernel_dump__destroy(skel);
+	return err;
+}

[Severity: Medium]
Does main() return a non-zero exit code when terminated normally by SIGINT or SIGTERM?

When a signal interrupts epoll_wait() inside ring_buffer__poll(), ring_buffer__poll() returns -EINTR. The loop checks for -EINTR and breaks without resetting err to 0.

Similarly, if the signal arrives while ring_buffer__poll() is processing events, ring_buffer__poll() returns the positive number of consumed records and the while (!exiting) loop terminates with err > 0.

In both cases, main() reaches cleanup and returns err directly instead of 0.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#4 lore raw

Re: [PATCH v4 2/2] selftests/rdma: Add netkit-based automated test script for RXE

In reply to Zhu Yanjun
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider: - [Medium] selftests/rdma: stdout redirected to /dev/null and rxe_netkit_dump unverified - [Medium]…

Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
- [Medium] selftests/rdma: stdout redirected to /dev/null and rxe_netkit_dump unverified
- [Medium] selftests/rdma: rping server and rxe0 leaked in cleanup() of rxe_pkg_netkit.sh
- [Medium] selftests/rdma: unchecked /sys/kernel/debug/tracing/trace access under set -e
- [Medium] selftests/rdma: cleanup() trap on INT/TERM does not exit and disables set -e --

commit 113f4f28482f12566dde8a87cffb811f524f479c
Author: Zhu Yanjun <[email protected]>

selftests/rdma: Add netkit-based automated test script for RXE

This commit adds the rxe_pkg_netkit.sh selftest script to automate functional and tracing tests for the rxe driver over netkit interfaces using an isolated network namespace and rping.

Quoted 9 lines
tools/testing/selftests/rdma/rxe_pkg_netkit.sh new file +3 -0
new file mode 100755
index 0000000000000..181e2d85eed76
@@ -0,0 +1,81 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
+# Copyright (c) 2026 Zhu Yanjun <[email protected]>

[ ... ]

Quoted 8 lines
tools/testing/selftests/rdma/rxe_pkg_netkit.sh new file +8 -0
+exec > /dev/null
+
+set -e
+
+CUR_WD="$(dirname "$0")"
+[ "$CUR_WD" = "." ] && CUR_WD="$(pwd)"
+
+cleanup() {

tools/testing/selftests/rdma/rxe_pkg_netkit.sh line 38

Quoted 10 lines
tools/testing/selftests/rdma/rxe_pkg_netkit.sh new file +10 -0
+    set +e
+    [ -n "$DUMP_PID" ] && kill -9 "$DUMP_PID" 2>/dev/null
+    unset DUMP_PID
+
+    rdma link del rxe1 2>/dev/null
+    ip link del nk0 2>/dev/null
+    ip netns delete ns0 2>/dev/null
+}
+
+trap cleanup EXIT INT TERM

[Severity: Medium]
When rxe_pkg_netkit.sh receives an interrupt or termination signal via the INT or TERM trap, cleanup() runs set +e, tears down the test devices and ns0 namespace, and then returns without exiting the shell.

In standard sh, returning from an INT or TERM trap handler resumes execution at the command following the interrupted one. Will this cause the remainder of the script to continue running with set -e disabled against already deleted devices and namespaces, before running cleanup() a second time on EXIT?

tools/testing/selftests/rdma/rxe_pkg_netkit.sh line 41

Quoted 3 lines
tools/testing/selftests/rdma/rxe_pkg_netkit.sh new file +3 -0
+
+# Clear tracing buffer
+echo > /sys/kernel/debug/tracing/trace

[Severity: Medium]
What happens if /sys/kernel/debug/tracing/trace is not available on the test system, for instance when tracing is not enabled in the kernel, debugfs is not mounted, or tracefs is mounted standalone at /sys/kernel/tracing?

Because set -e is active here and there is no prerequisite check for /sys/kernel/debug/tracing/trace, this redirection will abort the test with a failure exit code of 1 instead of skipping with exit code 4. Additionally, truncating /sys/kernel/debug/tracing/trace clears the host's global trace buffer rather than using an isolated trace instance. Should the script check that the trace file is accessible (and skip if not) before writing to it?

Quoted 24 lines
tools/testing/selftests/rdma/rxe_pkg_netkit.sh new file +24 -0
+
+# Create network namespace and netkit peer links
+ip netns add ns0
+ip link add nk0 type netkit mode l2 peer name nk1
+ip link set nk0 up
+ip link set nk1 up
+
+# Configure namespace interface
+ip link set nk1 netns ns0
+ip netns exec ns0 ip addr add 10.0.0.1/24 dev nk1
+ip netns exec ns0 ip link set nk1 up
+
+# Configure host interface
+ip addr add 10.0.0.2/24 dev nk0
+
+# Start dump utility in background
+"$CUR_WD/rxe_netkit_dump" &
+DUMP_PID=$!
+
+# Add RXE links over netkit devices
+ip netns exec ns0 rdma link add rxe0 type rxe netdev nk1
+rdma link add rxe1 type rxe netdev nk0
+
+# Start rping server in namespace

tools/testing/selftests/rdma/rxe_pkg_netkit.sh line 75

Quoted 10 lines
tools/testing/selftests/rdma/rxe_pkg_netkit.sh new file +10 -0
+ip netns exec ns0 rping -s -a 10.0.0.1 -C 3 &
+
+# Add wait time
+sleep 1
+
+# Run rping client on host
+rping -c -a 10.0.0.1 -C 3
+
+# Tear down RDMA links and netkit devices
+ip netns exec ns0 rdma link del rxe0

[Severity: Medium]
Does cleanup() leak the background rping -s server process and the rxe0 link inside ns0 if rping -c fails or the script exits early?

When ip netns exec ns0 rping -s -a 10.0.0.1 -C 3 & is started in the background, its process id is not saved, and cleanup() neither kills that server process nor runs ip netns exec ns0 rdma link del rxe0:

cleanup() {
set +e
[ -n "$DUMP_PID" ] && kill -9 "$DUMP_PID" 2>/dev/null unset DUMP_PID

rdma link del rxe1 2>/dev/null
ip link del nk0 2>/dev/null
ip netns delete ns0 2>/dev/null
}

Because ip netns delete ns0 only unmounts the namespace bind mount without terminating processes running inside it, an early exit leaves the rping -s process running in the background holding rxe0, the ns0 namespace, and inherited file descriptors open (which can also cause the kselftest runner to hang waiting for file descriptors to close). Even on the normal path, ip netns exec ns0 rdma link del rxe0 runs immediately after rping -c finishes without waiting for the background rping -s server to finish tearing down its resources and exit.

tools/testing/selftests/rdma/rxe_pkg_netkit.sh line 81

Quoted 6 lines
tools/testing/selftests/rdma/rxe_pkg_netkit.sh new file +6 -0
+rdma link del rxe1
+ip link del nk0
+ip netns delete ns0
+
+# Display kernel trace output
+cat /sys/kernel/debug/tracing/trace

[Severity: Medium]
Earlier in the script, stdout is redirected for the entire process and its children:

exec > /dev/null

Because of this redirection, both the output of "$CUR_WD/rxe_netkit_dump" & and the final cat /sys/kernel/debug/tracing/trace at the end of the script are discarded to /dev/null and never inspected.

Furthermore, "$CUR_WD/rxe_netkit_dump" & is launched asynchronously without checking whether the binary exists, waiting for it to finish loading and attaching its program to nk0 before traffic starts, or checking its exit status and captured packet output. Can this cause the test to silently pass even when rxe_netkit_dump fails to start, attach, or capture any packets?

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2