summaryrefslogtreecommitdiff
path: root/tools/testing
AgeCommit message (Collapse)Author
2026-05-10selftests/cgroup: Fix string comparison in write_testHongfu Li
Use string comparison (!=) instead of numeric comparison (-ne) for cpuset values like "0-1". For example: $ [[ "0-1" != "2-3" ]] && echo "true" || echo "false" true $ [[ "0-1" -ne "2-3" ]] && echo "true" || echo "false" false Signed-off-by: Hongfu Li <lihongfu@kylinos.cn> Signed-off-by: Tejun Heo <tj@kernel.org>
2026-05-10selftests/cgroup: Fix cg_read_strcmp() empty string comparisonHongfu Li
cg_read_strcmp() allocated a buffer sized to strlen(expected) + 1, then passed it to read_text() which calls read(fd, buf, size-1). When comparing against an empty string (""), strlen("") = 0 gives a 1-byte buffer, and read() is asked to read 0 bytes. The file content is never actually read, so strcmp("", buf) always returns 0 regardless of the real content. This caused cg_test_proc_killed() to always report the cgroup as empty immediately, making OOM tests pass without verifying that processes were killed. Signed-off-by: Hongfu Li <lihongfu@kylinos.cn> Signed-off-by: Tejun Heo <tj@kernel.org>
2026-05-10Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf 7.1-rc3Alexei Starovoitov
Cross-merge BPF and other fixes after downstream PR. Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2026-05-10selftests: rds: Disarm signal alarm on test completionAllison Henderson
A race in stop_pcaps is possible if the test completes and then times out while waiting for the tcpdump process to exit. The signal handler may fire again and needlessly call stop_pcap a second time. Fix this by disabling the alarm after normal test completion. Also if there are no tcpdump processes to wait on, stop_pcaps can just exit. This avoids misleading prints when there are no procs to collect dumps from. Signed-off-by: Allison Henderson <achender@kernel.org> Link: https://patch.msgid.link/20260507233213.556182-4-achender@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-10selftests: rds: Fix TAP-prefixed prints in check_gcov*Allison Henderson
This patch adds the # prefix to info and warning prints in the check_gcov* routines. Since these routines do not exit, as the other check_* routines do, the output here should be kept TAP compliant. Signed-off-by: Allison Henderson <achender@kernel.org> Link: https://patch.msgid.link/20260507233213.556182-3-achender@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-10selftests: rds: Fix stale log clean upAllison Henderson
Since rds self tests no longer has a default folder, users must specify a log collection folder if they want to collect logs. Currently the log folder is deleted and recreated, but this can be dangerous if the user exports RDS_LOG_DIR=/tmp or /var/log. This patch corrects the clean up to delete only rds log artifacts from the log folder, and further prefixes rds specific logs as rds* Signed-off-by: Allison Henderson <achender@kernel.org> Link: https://patch.msgid.link/20260507233213.556182-2-achender@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-10selftests: net: getsockopt_iter: cleanupBreno Leitao
Apply two cleanups suggested by Stanislav and bobby on the original selftest series: - Reorder local variable declarations into reverse christmas-tree order (longest line first). Because that ordering puts socklen_t optlen before the variable whose size it stores, the "optlen = sizeof(...)" initializer is moved out of the declaration to a plain assignment in the test body, as Stanislav suggested. - Add ASSERT_EQ(optlen, ...) on every error path so the value the kernel writes back to the userspace optlen is pinned down even when the syscall returns -1. With do_sock_getsockopt() now writing opt->optlen back to userspace unconditionally, asserting that the netlink/vsock error paths leave the original input length untouched guards against future regressions. Bobby Eshleman pointed out that SO_VM_SOCKETS_CONNECT_TIMEOUT_NEW/OLD return a sock_timeval-shaped payload (16 bytes on 64-bit), which is wider than the u64 case already covered. Add four tests that exercise this path: - connect_timeout_new_exact exact-size buffer - connect_timeout_new_oversize_clamped oversize buffer, clamped - connect_timeout_new_undersize undersize -> -EINVAL, optlen untouched - connect_timeout_old_exact exact-size buffer for OLD optname Suggested-by: Stanislav Fomichev <sdf@fomichev.me> Suggested-by: Bobby Eshleman <bobbyeshleman@meta.com> Signed-off-by: Breno Leitao <leitao@debian.org> Link: https://patch.msgid.link/20260507-getsock_two-v2-5-5873111d9c12@debian.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-09Merge tag 'bpf-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpfLinus Torvalds
Pull bpf fixes from Alexei Starovoitov: - Fix sk_local_storage diag dump via netlink (Amery Hung) - Fix off-by-one in arena direct-value access (Junyoung Jang) - Reject TCP_NODELAY in bpf-tcp congestion control (KaFai Wan) - Fix type confusion in bpf_*_sock() (Kuniyuki Iwashima) - Reject TX-only AF_XDP sockets (Linpu Yu) - Don't run arg-tracking analysis twice on main subprog (Paul Chaignon) - Fix NULL pointer dereference in bpf_sk_storage_clone and fib lookup (Weiming Shi) * tag 'bpf-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf: bpf: Fix off-by-one boundary validation in arena direct-value access xskmap: reject TX-only AF_XDP sockets bpf: Don't run arg-tracking analysis twice on main subprog bpf: Free reuseport cBPF prog after RCU grace period. bpf: tcp: Fix type confusion in sol_tcp_sockopt(). bpf: tcp: Fix type confusion in bpf_skc_to_tcp6_sock(). bpf: tcp: Fix type confusion in bpf_skc_to_tcp_sock(). mptcp: bpf: Fix type confusion in bpf_mptcp_sock_from_subflow() selftest: bpf: Add test for bpf_tcp_sock() and RAW socket. bpf: tcp: Fix type confusion in bpf_tcp_sock(). tools/headers: Regenerate stddef.h to fix BPF selftests bpf: Fix sk_local_storage diag dumping uninitialized special fields bpf: Fix NULL pointer dereference in bpf_skb_fib_lookup() sockmap: Fix sk_psock_drop() race vs sock_map_{unhash,close,destroy}(). bpf: Fix NULL pointer dereference in bpf_sk_storage_clone and diag paths selftests/bpf: Verify bpf-tcp-cc rejects TCP_NODELAY selftests/bpf: Test TCP_NODELAY in TCP hdr opt callbacks bpf: Reject TCP_NODELAY in bpf-tcp-cc bpf: Reject TCP_NODELAY in TCP header option callbacks
2026-05-08Merge tag 'sched-urgent-2026-05-09' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip Pull scheduler fixes from Ingo Molnar: - Fix spurious failures in rseq self-tests (Mark Brown) - Fix rseq rseq::cpu_id_start ABI regression due to TCMalloc's creative use of the supposedly read-only field The fix is to introduce a new ABI variant based on a new (larger) rseq area registration size, to keep the TCMalloc use of rseq backwards compatible on new kernels (Thomas Gleixner) - Fix wakeup_preempt_fair() for not waking up task (Vincent Guittot) - Fix s64 mult overflow in vruntime_eligible() (Zhan Xusheng) * tag 'sched-urgent-2026-05-09' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: sched/fair: Fix wakeup_preempt_fair() for not waking up task sched/fair: Fix overflow in vruntime_eligible() selftests/rseq: Expand for optimized RSEQ ABI v2 rseq: Reenable performance optimizations conditionally rseq: Implement read only ABI enforcement for optimized RSEQ V2 mode selftests/rseq: Validate legacy behavior selftests/rseq: Make registration flexible for legacy and optimized mode selftests/rseq: Skip tests if time slice extensions are not available rseq: Revert to historical performance killing behaviour rseq: Don't advertise time slice extensions if disabled rseq: Protect rseq_reset() against interrupts rseq: Set rseq::cpu_id_start to 0 on unregistration selftests/rseq: Don't run tests with runner scripts outside of the scripts
2026-05-08selftests: net: Add protodown testsIdo Schimmel
Add a selftest for the protodown mechanism. Five test cases are included: 1. Basic protodown toggling: Verify that setting protodown on macvlan results in DOWN operational state and clearing it restores UP. 2. Same as the previous test case, but with vxlan. 3. Protodown reasons: Verify that protodown cannot be cleared while there are active protodown reasons, but can be cleared once all reasons are removed. 4. Protodown with lower device being toggled: Verify that toggling the lower device's carrier while protodown is on does not cause the macvlan to gain carrier. 5. Protodown with lower device down: Verify that toggling protodown while the lower device has no carrier does not cause the macvlan to gain carrier. Note that the last two test cases fail without "net: Do not turn on carrier when protodown is on" and "net: Do not unconditionally turn on carrier when turning off protodown": # ./protodown.sh TEST: Basic protodown on/off with macvlan [ OK ] TEST: Basic protodown on/off with vxlan [ OK ] TEST: Protodown reasons [ OK ] TEST: Protodown with lower device toggled [FAIL] Macvlan operational state is not DOWN despite protodown TEST: Protodown with lower device down [FAIL] Macvlan is not LOWERLAYERDOWN after clearing protodown Assisted-by: Claude:claude-opus-4-6 Signed-off-by: Ido Schimmel <idosch@nvidia.com> Link: https://patch.msgid.link/20260507105906.891817-5-idosch@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-08selftests: net: add tests for filtered dumps of page poolJakub Kicinski
Add tests for page pool dumps of a specific ifindex. Link: https://patch.msgid.link/20260506034821.1710113-2-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-08selftest: bpf: Add test for bpf_tcp_sock() and RAW socket.Kuniyuki Iwashima
Let's extend sockopt_sk.c to cover bpf_tcp_sock() for the wrong socket type. Before: # ./test_progs -t sockopt_sk [ 151.948613] ================================================================== [ 151.951376] BUG: KASAN: slab-out-of-bounds in sol_tcp_sockopt+0xc7/0x8e0 [ 151.954159] Read of size 8 at addr ffff88801083d760 by task test_progs/1259 ... run_test:FAIL:getsetsockopt unexpected error: -1 (errno 0) #427 sockopt_sk:FAIL After: #427 sockopt_sk:OK While at it, missing free() is fixed up. Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com> Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org> Link: https://patch.msgid.link/20260504210610.180150-3-kuniyu@google.com
2026-05-08selftests/cgroup: Fix incorrect variable check in online_cpus()Hongfu Li
"OFFLINE_CPUS" is a literal string that is always non-empty. It should be "$OFFLINE_CPUS" to check the variable's value instead. Signed-off-by: Hongfu Li <lihongfu@kylinos.cn> Signed-off-by: Tejun Heo <tj@kernel.org>
2026-05-08selftests/sched_ext: Fix select_cpu_dfl link leak on early returnCheng-Yang Chou
If run() exits early via SCX_EQ/SCX_ASSERT (which calls return directly), bpf_link__destroy() is never reached and the BPF scheduler stays loaded. All subsequent tests then fail to attach because SCX is not in the DISABLED state. Move bpf_link into a context struct so cleanup() always destroys it, regardless of how run() exits. Also skip waitpid() for children where fork() returned -1, avoiding waitpid(-1,...) accidentally reaping an unrelated child and triggering the early return path. Signed-off-by: Cheng-Yang Chou <yphbchou0911@gmail.com> Signed-off-by: Tejun Heo <tj@kernel.org> Reviewed-by: Andrea Righi <arighi@nvidia.com>
2026-05-07Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netJakub Kicinski
Cross-merge networking fixes after downstream PR (net-7.1-rc3). Conflicts: net/ipv4/igmp.c 726fa7da2d8c ("ipv4: igmp: get rid of IGMPV3_{QQIC,MRC} and simplify calculation") c6bebaa744f7 ("ipv4: igmp: annotate data-races in igmp_heard_query()") https://lore.kernel.org/a7365e4873340f7a5e30411207de3bf9@kernel.org Adjacent changes: net/psp/psp_main.c 30cb24f97d44 ("psp: strip variable-length PSP header in psp_dev_rcv()") c2b22277ad89 ("psp: validate IPv4 header fields in psp_dev_rcv()") net/sched/sch_fq_codel.c f83e07b29246 ("net/sched: sch_fq_codel: annotate data-races from fq_codel_dump_class_stats()") 3f3aa77ff1c8 ("net/sched: add qstats_cpu_drop_inc() helper") net/wireless/pmsr.c 0f3c0a197309 ("wifi: nl80211: fix NL80211_PMSR_FTM_REQ_ATTR_FTMS_PER_BURST usage") 410aa47fd9d3 ("wifi: cfg80211: allow suppressing FTM result reporting for PD requests") Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-07Merge tag 'net-7.1-rc3' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net Pull networking fixes from Jakub Kicinski: "Including fixes from Netfilter, IPsec, Bluetooth and WiFi. Current release - fix to a fix: - ipmr: add __rcu to netns_ipv4.mrt, make sure we hold the RCU lock in all relevant places Current release - new code bugs: - fixes for the recently added resizable hash tables - ipv6: make sure we default IPv6 tunnel drivers to =m now that IPv6 itself is built in - drv: octeontx2-af: fixes for parser/CAM fixes Previous releases - regressions: - phy: micrel: fix LAN8814 QSGMII soft reset - wifi: - cw1200: revert "Fix locking in error paths" - ath12k: fix crash on WCN7850, due to adding the same queue buffer to a list multiple times Previous releases - always broken: - number of info leak fixes - ipv6: implement limits on extension header parsing - wifi: number of fixes for missing bound checks in the drivers - Bluetooth: fixes for races and locking issues - af_unix: - fix an issue between garbage collection and PEEK - fix yet another issue with OOB data - xfrm: esp: avoid in-place decrypt on shared skb frags - netfilter: replace skb_try_make_writable() by skb_ensure_writable() - openvswitch: vport: fix race between tunnel creation and linking leading to invalid memory accesses (type confusion) - drv: amd-xgbe: fix PTP addend overflow causing frozen clock Misc: - sched/isolation: make HK_TYPE_KTHREAD an alias of HK_TYPE_DOMAIN (for relevant IPVS change)" * tag 'net-7.1-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (190 commits) net: sparx5: configure serdes for 1000BASE-X in sparx5_port_init() net: sparx5: fix wrong chip ids for TSN SKUs net: stmmac: dwmac-nuvoton: fix NULL pointer dereference in nvt_set_phy_intf_sel() tcp: Fix dst leak in tcp_v6_connect(). ipmr: Call ipmr_fib_lookup() under RCU. net: phy: broadcom: Save PHY counters during suspend net/smc: fix missing sk_err when TCP handshake fails af_unix: Reject SIOCATMARK on non-stream sockets veth: fix OOB txq access in veth_poll() with asymmetric queue counts eth: fbnic: fix double-free of PCS on phylink creation failure net: ethernet: cortina: Drop half-assembled SKB selftests: mptcp: pm: restrict 'unknown' check to pm_nl_ctl selftests: mptcp: check output: catch cmd errors mptcp: pm: prio: skip closed subflows mptcp: pm: ADD_ADDR rtx: return early if no retrans mptcp: pm: ADD_ADDR rtx: skip inactive subflows mptcp: pm: ADD_ADDR rtx: resched blocked ADD_ADDR quicker mptcp: pm: ADD_ADDR rtx: free sk if last mptcp: pm: ADD_ADDR rtx: always decrease sk refcount mptcp: pm: ADD_ADDR rtx: fix potential data-race ...
2026-05-07crypto: drbg - Fold include/crypto/drbg.h into crypto/drbg.cEric Biggers
include/crypto/drbg.h no longer contains anything that is used externally to crypto/drbg.c. Therefore, fold it into crypto/drbg.c. Signed-off-by: Eric Biggers <ebiggers@kernel.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2026-05-06selftests: mptcp: pm: restrict 'unknown' check to pm_nl_ctlMatthieu Baerts (NGI0)
When pm_netlink.sh is executed with '-i', 'ip mptcp' is used instead of 'pm_nl_ctl'. IPRoute2 doesn't support the 'unknown' flag, which has only been added to 'pm_nl_ctl' for this specific check: to ensure that the kernel ignores such unsupported flag. No reason to add this flag to 'ip mptcp'. Then, this check should be skipped when 'ip mptcp' is used. Fixes: 0cef6fcac24d ("selftests: mptcp: ip_mptcp option for more scripts") Cc: stable@vger.kernel.org Reviewed-by: Mat Martineau <martineau@kernel.org> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Link: https://patch.msgid.link/20260505-net-mptcp-pm-fixes-7-1-rc3-v1-11-fca8091060a4@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-06selftests: mptcp: check output: catch cmd errorsMatthieu Baerts (NGI0)
Using '${?}' inside the if-statement to check the returned value from the command that was evaluated as part of the if-statement is not correct: here, '${?}' will be linked to the previous instruction, not the one that is expected here (${cmd}). Instead, simply mark the error, except if an error is expected. If that's the case, 1 can be passed as the 4th argument of this helper. Three checks from pm_netlink.sh expect an error. While at it, improve the error message when the command unexpectedly fails or succeeds. Note that we could expect a specific returned value, but the checks currently expecting an error can be used with 'ip mptcp' or 'pm_nl_ctl', and these two tools don't return the same error code. Fixes: 2d0c1d27ea4e ("selftests: mptcp: add mptcp_lib_check_output helper") Cc: stable@vger.kernel.org Reviewed-by: Mat Martineau <martineau@kernel.org> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Link: https://patch.msgid.link/20260505-net-mptcp-pm-fixes-7-1-rc3-v1-10-fca8091060a4@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-06selftests: drv-net: fix sort order of makefile and configJakub Kicinski
Recent changes added configs and tests in the wrong spot. Link: https://lore.kernel.org/20260506170435.34984dfc@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-06Merge tag 'ipsec-2026-05-05' of ↵Jakub Kicinski
git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec Steffen Klassert says: ==================== pull request (net): ipsec 2026-05-05 1. Fix an IPv6 encapsulation error path that leaked route references when UDPv6 ESP decapsulation resolved to an error route. From Yilin Zhu. 2. Fix AH with ESN on async crypto paths by accounting for the extra high-order sequence number when reconstructing the temporary authentication layout in the completion callbacks. From Michael Bomarito. 3. Fix XFRM output so it does not overwrite already-correct inner header pointers when a tunnel layer such as VXLAN has already saved them. The fix comes with new selftests. From Cosmin Ratiu. 4. Add the missing native payload size entry for XFRM_MSG_MAPPING in the compat translation path. From Ruijie Li. 5. Harden __xfrm_state_delete() against repeated or inconsistent unhashing of state list nodes by keying the removal on actual list membership and using delete-and-init helpers. From Michal Kosiorek. 6. Prevent ESP from decrypting shared splice-backed skb fragments in place by marking UDP splice frags as shared and forcing copy-on-write in ESP input when needed. From Kuan-Ting Chen. * tag 'ipsec-2026-05-05' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec: xfrm: esp: avoid in-place decrypt on shared skb frags xfrm: defensively unhash xfrm_state lists in __xfrm_state_delete xfrm: provide message size for XFRM_MSG_MAPPING xfrm: Don't clobber inner headers when already set tools/selftests: Add a VXLAN+IPsec traffic test tools/selftests: Use a sensible timeout value for iperf3 client xfrm: ah: account for ESN high bits in async callbacks ipv6: xfrm6: release dst on error in xfrm6_rcv_encap() ==================== Link: https://patch.msgid.link/20260505132326.1362733-1-steffen.klassert@secunet.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-06Merge tag 'ovpn-net-20260504' of https://github.com/OpenVPN/ovpn-net-nextJakub Kicinski
Antonio Quartulli says: ==================== Includes changes: * ensure MAC header offset is reset before delivering packet * ensure gro_cells_receive() and dstats_dev_add() are called with BH disabled * reduce ping count in selftest to ensure it completes within timeout * tag 'ovpn-net-20260504' of https://github.com/OpenVPN/ovpn-net-next: selftests: ovpn: reduce ping count in test.sh ovpn: ensure packet delivery happens with BH disabled ovpn: reset MAC header before passing skb up ==================== Link: https://patch.msgid.link/20260504230305.2681646-1-antonio@openvpn.net Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-06KVM: selftests: arm64: Fix steal_time test after UAPI refactoringSebastian Ott
Fix the following failure to the steal_time test on arm64 by making the timer address known to the guest. ==== Test Assertion Failure ==== steal_time.c:229: !ret pid=18514 tid=18514 errno=22 - Invalid argument 1 0x000000000040252f: check_steal_time_uapi at steal_time.c:229 (discriminator 20) 2 (inlined by) main at steal_time.c:537 (discriminator 20) 3 0x0000ffffa23d621b: ?? ??:0 4 0x0000ffffa23d62fb: ?? ??:0 5 0x0000000000402b6f: _start at ??:? KVM_SET_DEVICE_ATTR failed, rc: -1 errno: 22 (Invalid argument) Fixes: 40351ed924dd ("KVM: selftests: Refactor UAPI tests into dedicated function") Signed-off-by: Sebastian Ott <sebott@redhat.com> Link: https://patch.msgid.link/20260504112808.21276-1-sebott@redhat.com Signed-off-by: Marc Zyngier <maz@kernel.org>
2026-05-06selftests/rseq: Expand for optimized RSEQ ABI v2Thomas Gleixner
Update the selftests so they are executed for legacy (32 bytes RSEQ region) and optimized RSEQ ABI v2 mode. Fixes: d6200245c75e ("rseq: Allow registering RSEQ with slice extension") Signed-off-by: Thomas Gleixner <tglx@kernel.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Dmitry Vyukov <dvyukov@google.com> Tested-by: Dmitry Vyukov <dvyukov@google.com> Link: https://patch.msgid.link/20260428224428.009121296%40kernel.org Cc: stable@vger.kernel.org
2026-05-06selftests/rseq: Validate legacy behaviorThomas Gleixner
The RSEQ legacy mode behavior requires that the ID fields in the rseq region are unconditionally updated on every context switch and before signal delivery even if not required by the ABI specification. To ensure that this behavior is preserved for legacy users in the future, add a test which validates that with a sleep() and a signal sent to self. Provide a run script which prevents GLIBC from registering a RSEQ region, so that the test can register it's own legacy sized region. Fixes: 566d8015f7ee ("rseq: Avoid CPU/MM CID updates when no event pending") Signed-off-by: Thomas Gleixner <tglx@kernel.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Dmitry Vyukov <dvyukov@google.com> Tested-by: Dmitry Vyukov <dvyukov@google.com> Link: https://patch.msgid.link/20260428224427.764705536%40kernel.org Cc: stable@vger.kernel.org
2026-05-06selftests: livepatch: Check if stack_order sysfs attribute existsMarcos Paulo de Souza
The commit 3dae09de4061 ("livepatch: Add stack_order sysfs attribute"), merged in v6.14, introduced a new sysfs attribute. In order to run the selftests on older kernels, check if given kernel has support for the attribute. If the attribute is not supported, skip the checks. Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com> Reviewed-by: Petr Mladek <pmladek@suse.com> Acked-by: Joe Lawrence <joe.lawrence@redhat.com> Link: https://patch.msgid.link/20260504-lp-tests-old-fixes-v5-6-0be26d94ab9a@suse.com Signed-off-by: Petr Mladek <pmladek@suse.com>
2026-05-06selftests: livepatch: Check if replace sysfs attribute existsMarcos Paulo de Souza
The commit adb68ed26a3e ("livepatch: Add "replace" sysfs attribute"), merged in v6.11, introduced a new sysfs attribute. In order to run the selftests on older kernels, check if given kernel has support for the attribute. If the attribute is not supported, skip the checks. While at it, create a local variable to hold the module name to be tested, instead of overwriting MOD_LIVEPATCH. Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com> Reviewed-by: Petr Mladek <pmladek@suse.com> Acked-by: Joe Lawrence <joe.lawrence@redhat.com> Link: https://patch.msgid.link/20260504-lp-tests-old-fixes-v5-5-0be26d94ab9a@suse.com Signed-off-by: Petr Mladek <pmladek@suse.com>
2026-05-06selftests: livepatch: Check if patched sysfs attribute existsMarcos Paulo de Souza
The commit bb26cfd9e77e ("livepatch: add sysfs entry "patched" for each klp_object") was merged in v6.1, introducing a new sysfs attribute. In order to run the selftests on older kernels, check if given kernel has support for the attribute. If the attribute is not supported, skip the checks. Along with this change, use MOD_LIVEPATCH2 variable instead of reassigning a new value to MOD_LIVEPATCH, and also use the variable names in the check_result, to avoid using the module names. Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com> Reviewed-by: Petr Mladek <pmladek@suse.com> Acked-by: Joe Lawrence <joe.lawrence@redhat.com> Link: https://patch.msgid.link/20260504-lp-tests-old-fixes-v5-4-0be26d94ab9a@suse.com Signed-off-by: Petr Mladek <pmladek@suse.com>
2026-05-06selftests: livepatch: Introduce does_sysfs_exist functionMarcos Paulo de Souza
Returns true if the livepatch sysfs attribute exists, and false otherwise. This new function will be used in the next patches. Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com> Reviewed-by: Petr Mladek <pmladek@suse.com> Acked-by: Joe Lawrence <joe.lawrence@redhat.com> Link: https://patch.msgid.link/20260504-lp-tests-old-fixes-v5-3-0be26d94ab9a@suse.com Signed-off-by: Petr Mladek <pmladek@suse.com>
2026-05-06selftests: livepatch: Replace true/false module parameter by y/nMarcos Paulo de Souza
Older kernels don't support true/false for boolean module parameters because they lack commit 0d6ea3ac94ca ("lib/kstrtox.c: add "false"/"true" support to kstrtobool()"). Replace true/false by y/n so the test module can be loaded on older kernels. No functional changes. Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com> Reviewed-by: Petr Mladek <pmladek@suse.com> Acked-by: Joe Lawrence <joe.lawrence@redhat.com> Link: https://patch.msgid.link/20260504-lp-tests-old-fixes-v5-2-0be26d94ab9a@suse.com Signed-off-by: Petr Mladek <pmladek@suse.com>
2026-05-06selftests: livepatch: Check for ARCH_HAS_SYSCALL_WRAPPER configMarcos Paulo de Souza
Older kernels that lack CONFIG_ARCH_HAS_SYSCALL_WRAPPER config don't have any prefixes for their syscalls. The same applies to current powerpc and loongarch, covering all currently supported architectures that support livepatch. The other supported architectures have specific prefixes, so error out when a new architecture adds livepatch support with wrappers but didn't update the test to include it. Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com> Reviewed-by: Petr Mladek <pmladek@suse.com> Acked-by: Joe Lawrence <joe.lawrence@redhat.com> Link: https://patch.msgid.link/20260504-lp-tests-old-fixes-v5-1-0be26d94ab9a@suse.com Signed-off-by: Petr Mladek <pmladek@suse.com>
2026-05-06selftests/posix_timers: Use CLOCK_THREAD_CPUTIME_ID for ITIMER_PROF measurementsJohn Stultz
It was reported that the posix_timers test was at times seeing failures with ITIMER_PROF timers, specifically in cases where the RCU_SOFTIRQ was taking up significant amounts of time. Analysis showed that as the time in softirq isn't included in the task stime + utime accounting used to trigger the SIGPROF so delays from softirq work could cause it to appear that the signal was incorrectly delayed. Contributing to this is that the test uses gettimeofday() to measure itimers, which also means any scheduling delay can also cause failures (as the task may not be running the entire time). To fix this, convert all the itimer measurements to use clock_gettime(), tweaking the logic to use nsecs instead of usecs. Then for ITIMER_PROF timers, utilize the CLOCK_THREAD_CPUTIME_ID clockid so that it is similarly measuring the time the task was running. Signed-off-by: John Stultz <jstultz@google.com> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Link: https://patch.msgid.link/20260428173957.1394265-1-jstultz@google.com
2026-05-05selftests: rds: Make rds selftests TAP compliantAllison Henderson
This patch updates the rds selftests output to be TAP compliant. Use ksft_pr() to mark debug output with a leading '# ' so that TAP parsers treat it as commentary, and convert all informational print() calls to use ksft_pr(). sys.exit(0) is changed to os._exit(0) to avoid duplicate prints from the buffered TAP output. The console output from the tcpdump subprocess is silenced, and the gcov console output is redirected to a gcovr.log. Finally adjust the exit path so that the hash check loop sets a return code instead exiting directly. Then print the TAP results and totals lines before exiting. Signed-off-by: Allison Henderson <achender@kernel.org> Link: https://patch.msgid.link/20260504054143.4027538-11-achender@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-05selftests: rds: Fix gcov collectionAllison Henderson
debugfs is not mounted automatically in a virtme-ng guest, so the gcov data copy from /sys/kernel/debug/gcov/ silently finds nothing depending on whether debugfs is mounted by default on the host OS. Fix this by mounting debugfs in run.sh before copying the gcda files. Finally when invoked through the kselftest runner, the working directory is the test directory rather than the kernel source root. gcovr defaults --root to the current working directory, which causes it to filter out all coverage data for files under net/rds/ since they are not under the test directory. Fix this by passing --root to gcovr explicitly. Signed-off-by: Allison Henderson <achender@kernel.org> Link: https://patch.msgid.link/20260504054143.4027538-10-achender@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-05selftests: rds: Stop tcpdump on timeoutAllison Henderson
The timeout signal handler for the rds selftests currently just exits when the time limit is exceeded, and forgets to stop the network dumps. Fix this by hoisting the tcpdump terminate commands into a helper function, and call it from the signal handler before exiting Bound proc.wait() with a timeout (and fall back to proc.kill()) so an unresponsive tcpdump cannot hang the timeout path itself. We also pop() tcpdump_procs as we iterate, so stop_pcaps() is safe to call from both the normal cleanup path and the signal handler, since the second invocation simply has nothing to do Signed-off-by: Allison Henderson <achender@kernel.org> Link: https://patch.msgid.link/20260504054143.4027538-9-achender@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-05selftests: rds: Remove tmp pcapsAllison Henderson
This patch removes the initial tmp tcpdumps and instead saves the pcaps directly to the logdir if it is set. Signed-off-by: Allison Henderson <achender@kernel.org> Link: https://patch.msgid.link/20260504054143.4027538-8-achender@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-05selftests: rds: Add SUDO_USER env variableAllison Henderson
This patch modifies rds selftests to use the environment variable SUDO_USER for tcpdumps if it is set. This is needed to avoid chown operations on the vng 9pfs which is not supported. Passing a user listed in sudoers avoids the tcpdump privilege drop which may otherwise create empty pcaps Signed-off-by: Allison Henderson <achender@kernel.org> Link: https://patch.msgid.link/20260504054143.4027538-7-achender@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-05selftests: rds: Add RDS_LOG_DIR env variableAllison Henderson
This patch modifies the rds selftest to look for an env variable RDS_LOG_DIR, and log all traces, pcaps and gcov collections to the folder specified in RDS_LOG_DIR. If RDS_LOG_DIR is unset, logs are not collected. Signed-off-by: Allison Henderson <achender@kernel.org> Link: https://patch.msgid.link/20260504054143.4027538-6-achender@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-05selftests: rds: Add timeout flag to run.shAllison Henderson
Add a -t flag to run.sh to optionally override the default timeout. The --timeout flag is already supported in test.py, so just add the shorthand -t flag Signed-off-by: Allison Henderson <achender@kernel.org> Link: https://patch.msgid.link/20260504054143.4027538-5-achender@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-05selftests: rds: Fix more pylint errorsAllison Henderson
This patch fixes a few pylint errors in test.py. Remove unused exception variables from except blocks, and disable warnings for imports that cannot appear at the start of the module. Also disable warnings for the tcpdump processes. The suggestion to use a with block does not apply here since the process needs to outlive the parent to collect the dumps. Lastly add the module docstring at the top of the module. Signed-off-by: Allison Henderson <achender@kernel.org> Link: https://patch.msgid.link/20260504054143.4027538-4-achender@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-05selftests: rds: Update USAGE string for run.shAllison Henderson
The run.sh script does not have a -g flag. Update USAGE string with correct flags. Also fix typo packet_duplcate -> packet_duplicate Signed-off-by: Allison Henderson <achender@kernel.org> Link: https://patch.msgid.link/20260504054143.4027538-3-achender@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-05selftests: rds: Increase selftest timeoutAllison Henderson
The 400s time out was originally developed under a leaner kernel config that booted much faster than a default config. Boot up is included as part of the over all test runtime, as well as any log collection done when the test is complete. A slower config combined with the gcov enabled test means we'll need more time to accommodate the boot up and log collection. So, bump time out to 800s. Signed-off-by: Allison Henderson <achender@kernel.org> Link: https://patch.msgid.link/20260504054143.4027538-2-achender@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-05selftests: drv-net: convert so_txtime to drv-netWillem de Bruijn
In preparation for extending to pacing hardware offload, convert the so_txtime.sh test to a drv-net test that can be run against netdevsim and real hardware. Also update so_txtime.c to not exit on first failure, but run to completion and report exit code there. This helps with debugging unexpected results, especially when processing multiple packets, as happens in the "reverse_order" testcase. Signed-off-by: Willem de Bruijn <willemb@google.com> ---- v6 -> v7 - update test to use new argument expect_fail - v6 received Reviewed-by, but dropped due to above (minor) change v5 -> v6 - fix order in tools/testing/selftests/drivers/net/config v4 -> v5 - move qdisc setup/restore into each test - add tc to utils.py (separate patch) - test expected failure (separate patch) - fix pylint - convert fail to pass for timing errors if KSFT_MACHINE_SLOW (cmd does not special case KSFT_SKIP process returncode yet) Responses to sashiko review - The test converts per packet failure to errors, to continue testing other packets, but other error() cases are not in scope. - The test starts sender and receiver at an absolute future time, like the original test. This assumes ~msec scale sync'ed clocks. - The tc qdisc replace command works fine with noqueue. Tested manually. v3 -> v4 - restore original qdisc after test - drop unnecessary underscore in tap test names v2 -> v3 - Makefile: so_txtime from YNL_GEN_FILES to TEST_GEN_FILES (Sashiko, NIPA) v1 -> v2 - move so_txtime.c for net/lib to drivers/net (Jakub) - fix drivers/net/config order (Jakub) - detect passing when failure is expected (Jakub, Sashiko) - pass pylint --disable=R (Jakub) - only call ksft_run once (Jakub) - do not sleep if waiting time is negative (Sashiko) - add \n when converting error() to fprintf() (Sashiko) - 4 space indentation, instead of 2 space - increase sync delay from 100 to 200ms, to fix rare vng flakes Link: https://patch.msgid.link/20260504174056.565319-4-willemdebruijn.kernel@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-05selftests: net: py: add tc utilityWillem de Bruijn
Add a wrapper similar to existing ip, ethtool, ... commands. Tc takes a slightly different syntax. Account for that. The first user is the next patch in this series, converting so_txtime to drv-net. Pacing offload is supported by selected qdiscs only. Signed-off-by: Willem de Bruijn <willemb@google.com> Link: https://patch.msgid.link/20260504174056.565319-3-willemdebruijn.kernel@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-05selftests: net: py: support cmd verifying expected failureWillem de Bruijn
Support negative tests, where cmd raises an exception if the command succeeded. Add optional argument expect_fail to cmd and bkg. Where fail fails the test on unexpected error, expect_fail fails it on unexpected success. Both fail on negative return code. Python subprocess may set a negative return code on process crash or timeout. Those are never anticipated failures. Signed-off-by: Willem de Bruijn <willemb@google.com> Link: https://patch.msgid.link/20260504174056.565319-2-willemdebruijn.kernel@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-05kselftest: fix doc for ksft_test_result_report()Woradorn Laodhanadhaworn
Fix documentation to reference ksft_test_result_report() instead of ksft_test_result(). Link: https://lore.kernel.org/r/20260505182213.22924-1-woradorn.laon@gmail.com Signed-off-by: Woradorn Laodhanadhaworn <woradorn.laon@gmail.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2026-05-05selftests/rseq: Make registration flexible for legacy and optimized modeThomas Gleixner
rseq_register_current_thread() either uses the glibc registered RSEQ region or registers it's own region with the legacy size of 32 bytes. That worked so far, but becomes a problem when the kernel implements a distinction between legacy and performance optimized behavior based on the registration size as that does not allow to test both modes with the self test suite. Add two arguments to the function. One to enforce that the registration is not using libc provided mode and one to tell the registration to use the legacy size and not the kernel advertised size. Rename it and make the original one a inline wrapper which preserves the existing behavior. Fixes: 566d8015f7ee ("rseq: Avoid CPU/MM CID updates when no event pending") Signed-off-by: Thomas Gleixner <tglx@kernel.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Dmitry Vyukov <dvyukov@google.com> Tested-by: Dmitry Vyukov <dvyukov@google.com> Link: https://patch.msgid.link/20260428224427.677889423%40kernel.org Cc: stable@vger.kernel.org
2026-05-05selftests/rseq: Skip tests if time slice extensions are not availableThomas Gleixner
Don't fail, skip the test if the extensions are not enabled at compile or runtime. Fixes: 830969e7821a ("selftests/rseq: Implement time slice extension test") Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Dmitry Vyukov <dvyukov@google.com> Tested-by: Dmitry Vyukov <dvyukov@google.com> Link: https://patch.msgid.link/20260428224427.597838491%40kernel.org Cc: stable@vger.kernel.org
2026-05-05selftests: openvswitch: add tests for tunnel vport refcountingIlya Maximets
There were a few issues found with the tunnel vport types around the vport destruction code. Add some basic tests, so at least we know that they can be properly added and removed without obvious issues. The test creates OVS datapath, adds a non-LWT tunnel port, makes sure they are created, and then removes the datapath and waits for all the ports to be gone. The dpctl script had a few bugs in the none-lwt tunnel creation code, so fixing them as well to make the testing possible: - The type of the --lwt option changed in order to properly disable it. - Removed byte order conversion for the port numbers, as the value supposed to be in the host order. - Added missing 'gre' choice for the tunnel type. Signed-off-by: Ilya Maximets <i.maximets@ovn.org> Acked-by: Eelco Chaudron <echaudro@redhat.com> Acked-by: Aaron Conole <aconole@redhat.com> Link: https://patch.msgid.link/20260430233848.440994-3-i.maximets@ovn.org Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-05-05selftests/membarrier: Add rseq stress test for CFS throttle interactionsAniket Gattani
Add a new stress test to exercise the interaction between targeted expedited membarrier commands and CFS bandwidth throttling. The test creates a deep cgroup hierarchy and aggressively hammers the membarrier syscall to expose lock contention and latency issues. This serves as a reliable reproducer for the `membarrier_ipi_mutex` cascade lockup, ensuring future changes to membarrier locking do not regress targeted command latency. Closes: https://lore.kernel.org/r/202604151516.Vc7Ro4LP-lkp@intel.com/ Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Aniket Gattani <aniketgattani@google.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://patch.msgid.link/20260503212205.3714217-4-aniketgattani@google.com