summaryrefslogtreecommitdiff
path: root/tools/testing
AgeCommit message (Collapse)Author
2026-08-12selftests/bpf: Add --no-error-summary to skip end-of-run error log dumpVineet Gupta
By default test_progs re-prints the aggregated error logs of all failed tests at the end of the run (when not in verbose mode), starting with "All error logs:". With bpf-gcc the current failures and a couple runaway 1M fails cause a huge print overhead/delay at the end. Add a subtractive --no-error-summary flag, gated on a new env.error_summary field which defaults to true, so the default behavior is unchanged. Passing --no-error-summary suppresses the final "All error logs:" dump. Only the human readable output is elided. dump_test_log() also emits the per-test and per-subtest entries of the --json-summary "results" array, so it keeps being called (via a new @quiet argument) and the JSON report is bit for bit what it was before. Signed-off-by: Vineet Gupta <vineet.gupta@linux.dev> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20260807204434.1036279-3-vineet.gupta@linux.dev
2026-08-12selftests/bpf: map_kptr: Expect BPF_ST reject msg on cpuv4 toolchainsVineet Gupta
reject_scalar_store_to_kptr stores a scalar constant to a kptr field: *(volatile u64 *)&v->unref_ptr = 0xBADC0DE; Compilers generate one of two encodings for that: 1. Materialize the constant into a register and emit BPF_STX: r1 = 0xbadc0de *(u64 *)(r0 + 0x8) = r1 2. Or fold it into a single BPF_ST (store immediate): *(u64 *)(r0 + 0x8) = 0xbadc0de These go through different rejection paths and output different messages. - BPF_STX goes through map_kptr_match_type(), which prints "invalid kptr access, R...". - BPF_ST only gets the immediate check printing "BPF_ST imm must be 0 when storing to kptr" The test only expects the BPF_STX message, so it fails on a toolchain that folds the constant - bpf-gcc, and clang -mcpu=v4: 7: (7a) *(u64 *)(r0 +8) = 195936478 BPF_ST imm must be 0 when storing to kptr at off=8 ... EXPECTED SUBSTR: 'invalid kptr access, R' Pick the expected message with __BPF_FEATURE_ST, which clang and bpf-gcc both define exactly when BPF_ST codegen is available - cpuv4 for clang, and by default for bpf-gcc, whose default cpu is v4. bpf-gcc, before: #229/20 map_kptr/reject_scalar_store_to_kptr:FAIL bpf-gcc, after : #229/20 map_kptr/reject_scalar_store_to_kptr:OK Two caveats worth noting: - On a BPF_ST toolchain the test now only exercises the imm != 0 check and never reaches map_kptr_match_type(), so the scalar-vs-PTR_TO_BTF_ID rejection the test is named for is only covered by the non-ST builds. The imm path itself is already covered compiler-independently by verifier/map_kptr.c ("map_kptr: BPF_ST imm != 0"). - __BPF_FEATURE_ST says the compiler *can* emit BPF_ST, not that it will. The encoding also depends on the optimization level: clang -mcpu=v4 -O0 still emits BPF_STX, which would send the #ifdef down the wrong branch and fail the test. Selftests always build BPF objects at -O2 so this does not bite today, but it is a latent failure mode if that changes. Signed-off-by: Vineet Gupta <vineet.gupta@linux.dev> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Yonghong Song <yonghong.song@linux.dev> Link: https://lore.kernel.org/bpf/20260807204434.1036279-2-vineet.gupta@linux.dev
2026-08-12selftests: harness: Mark test fixture objects __maybe_unusedDavid Matlack
Mark _##fixture_name##_##test_name##_object __maybe_unused since it may not ever be read. This pointer is only read in XFAIL_ADD(), which tests are not required to use. clang made a change to -Wunused-but-set-variable (split out into its own subwarning, -Wunused-but-set-global) that causes this warning to be emitted for various selftests and can be upgraded to an error in selftest that set -Werror. VFIO selftests have been broken since commit ff556bd98348 ("vfio: selftests: Add -Wall and -Werror to the Makefile"), and the net selftests builds have been noisy due to -Wall. Fixes: 24cf65a62266 ("selftests/harness: Share _metadata between forked processes") Reported-by: Kuniyuki Iwashima <kuniyu@google.com> Reported-by: Aaron Lewis <aaronlewis@google.com> Reviewed-by: Alex Williamson <alex@shazbot.org> Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com> Signed-off-by: David Matlack <dmatlack@google.com> Reviewed-by: Nathan Chancellor <nathan@kernel.org> Link: https://lore.kernel.org/r/20260706183154.2660394-1-dmatlack@google.com Signed-off-by: Alex Williamson <alex@shazbot.org>
2026-08-12selftests/bpf: Add arena fault tests for atomics with fetchDaniel Borkmann
Add stream_arena_xchg_fault and stream_arena_cmpxchg_fault next to the existing read, write and load-acquire fault tests, covering the two places a read-modify-write can deposit the old value: src_reg for a BPF_XCHG and r0 for a BPF_CMPXCHG. Both cover both halves of the JIT bug that left the fetch destination alone when a RMW on an arena pointer faulted: - the fault has to be reported as a WRITE, and at the address held by the destination register, which __stderr() and test_address() check - the register receiving the fetched value has to be cleared by the fault handler, which the programs check by poisoning it before the atomic and returning it, so __retval(0) fails if it is left untouched The __stderr() annotation can only wildcard the faulting address since the arena base is not known until runtime, hence the two test_address() subtests on top, which pin it to the address held by dst_reg rather than src_reg. Note, the atomics are open coded since linux/filter.h cannot be included alongside vmlinux.h. # LDLIBS=-static PKG_CONFIG='pkg-config --static' ./vmtest.sh -- ./test_progs -t stream [...] #464/1 stream_arena_fault_address/read_fault:OK #464/2 stream_arena_fault_address/write_fault:OK #464/3 stream_arena_fault_address/load_acquire_fault:OK #464/4 stream_arena_fault_address/xchg_fault:OK #464/5 stream_arena_fault_address/cmpxchg_fault:OK #464 stream_arena_fault_address:OK [...] #466/5 stream_success/stream_arena_write_fault:OK #466/6 stream_success/stream_arena_read_fault:OK #466/7 stream_success/stream_arena_load_acquire_fault:OK #466/8 stream_success/stream_arena_xchg_fault:OK #466/9 stream_success/stream_arena_cmpxchg_fault:OK [...] Summary: 4/22 PASSED, 0 SKIPPED, 0 FAILED Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Eduard Zingerman <eddyz87@gmail.com> Acked-by: Puranjay Mohan <puranjay@kernel.org> Link: https://patch.msgid.link/20260811131600.506721-6-daniel@iogearbox.net Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
2026-08-12sched_ext: Merge branch 'for-7.2-fixes' into for-7.3Tejun Heo
Pull to receive: c10b216a072f ("sched/core: Handle pick_task() releasing the rq lock") f3629c63a4af ("sched/core: Make core-sched flips wait for in-flight selections") ffaab58d2175 ("sched_ext: Replace SCX_RQ_BAL_KEEP with a dispatch verdict return") 3dd52416e44a ("sched_ext: Fix this_rq() assumptions in dispatch kfuncs") f2da9587118d ("sched_ext: Count rq lock releases in rq->scx.lock_drop_seq") d954004205c1 ("sched_ext: Fix rq->core_pick corruption under core scheduling") for the pending core scheduling follow-ups and to resolve the conflicts with the code reorganization and cap gate work on for-7.3. ffaab58d2175 converts scx_dispatch_sched() to a dispatch verdict return which for-7.3 moved from ext.c into inlines.h. Resolved by applying the conversion to the relocated copy and combining balance_one()'s verdict returns with the scx_task_can_stay_on_cpu() gate from the cap work. ffaab58d2175 and 3dd52416e44a update scx_bpf_sub_dispatch() which for-7.3 moved into sub.c. Resolved by applying the scx_locked_rq() switch and the verdict test to the sub.c copy. f2da9587118d instruments the open-coded lock releases in consume_remote_task() which for-7.3 folded into switch_rq_lock(). Resolved by keeping the accounting in switch_rq_lock() which covers all its callers. d954004205c1 widens the put_prev_task_scx() WARN suppression to all core-sched rqs on the same condition that for-7.3 gated with scx_task_can_stay_on_cpu(). Resolved by combining both. Signed-off-by: Tejun Heo <tj@kernel.org>
2026-08-12kunit: tool: fix _list_tests filtering wrong variable when list has TAP prefixMohammad Abu-Khader
`_list_tests()` runs the kernel to list tests, strips printk timestamp lines via `extract_tap_lines()`, then drops the dummy TAP header from the cleaned `lines`. However the subsequent regex filter mistakenly operates on the original `output` instead of the cleaned `lines`. When the kernel output includes timestamp prefixes (common with UML or slower setups), e.g.: [ 0.100000] suite.test1 [ 0.100000] suite.test2 the anchored regex `^[^\s.]+\.[^\s.]+$` rejects them and `--list_tests` returns an empty list. Filter `lines` instead of `output`, matching the behavior of the adjacent `_list_tests_attr()` which already returns the cleaned list. Add a regression test with timestamp-prefixed input to verify the fix. Link: https://lore.kernel.org/r/20260803190059.36491-1-mohammad.abukhader@hotmail.com Fixes: 723c8258c8fe ("kunit: tool: Add command line interface to filter and report attributes") Signed-off-by: Mohammad Abu-Khader <mohammad.abukhader@hotmail.com> Reviewed-by: David Gow <david@davidgow.net> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2026-08-11cgroup/cpuset: Add test for partition root invalidation returning wrong CPUsShaojie Sun
Add a test case to REMOTE_TEST_MATRIX covering the bug fixed by commit 345f40166694 ("cgroup/cpuset: Return only actually allocated CPUs during partition invalidation"). The test verifies that when a sibling partition root changes its cpuset.cpus to overlap with another partition root, only actually allocated CPUs (effective_xcpus) are returned to the parent, not all CPUs in cpus_allowed. Signed-off-by: Shaojie Sun <sunshaojie@kylinos.cn> Reviewed-by: Waiman Long <longman@redhat.com> Signed-off-by: Tejun Heo <tj@kernel.org>
2026-08-11selftests: drv-net: hide the devlink port_split testJakub Kicinski
The devlink port_split test has limited applicability. NICs (as opposed to switches) require at least a re-probe to apply the split configuration. On top of that the test is not compatible with our driver env, it just splits all ports on the system, not only what NETIF points at. Long term we may want to add some indication in devlink whether the port splitting is runtime (cmode of sorts), and fix the test to follow driver env. But since no (known) NIC driver can support runtime anyway let's just hide the test from the selftest framework by moving it to extra files. Having this test randomly break unrelated NICs within the DUT makes people implement allow-lists for ksft, which then means their setups don't run new tests. It's very useful during test review to see whether the test works across all the runners. Reviewed-by: Petr Machata <petrm@nvidia.com> Link: https://patch.msgid.link/20260811004645.1072124-1-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-11selftests: net: adopt harness for flow label mgrMarcelo Mendes Spessoto Junior
The kselftest_harness.h file contains modern helpers to build tests for kselftest. Dropping the custom test helpers in ipv6_flowlabel_mgr in favor of the harness makes tests more legible and conforms to the structure of the latest selftests. It also enforces the TAP standard. Another change made to the structure of the ipv6_flowlabel_mgr test file was the removal of parse_opts. The supported opts were already unused: the binary is listed in TEST_GEN_FILES, and is driven solely by ipv6_flowlabel.sh via "./ipv6_flowlabel_mgr", which never passed -l or -v. Dropping the -l gate means the two checks it previously guarded (each with a 13-second sleep, ~26 seconds total) are now unconditionally enabled on every run instead of never running at all. The TH_LOG calls and code comments now cover the information that the removed, custom -v flag used to print. Finally, FIXTURE_SETUP(flowlabel) ensures each test gets its own isolated network namespace. The previously added setup() helper was dropped to conform to the netns setup pattern used in icmp_rfc4884.c. disable_flowlabel_consistency() was moved next to reflect_flag, the only test that calls it, and now uses SKIP() instead of an ad hoc [INFO] message when the sysctl cannot be disabled. Signed-off-by: Marcelo Mendes Spessoto Junior <marcelomspessoto@gmail.com> Link: https://patch.msgid.link/20260807220942.421382-6-marcelomspessoto@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-11selftests: net: test IPV6_FL_F_REFLECTMarcelo Mendes Spessoto Junior
According to the source code, flowlabel_consistency must be deactivated for the IPV6_FL_F_REFLECT flag to work. Since ipv6_flowlabel_mgr now runs in its own network namespace, do this directly from the test binary. Attempt to disable net.ipv6.flowlabel_consistency and skip the reflect test if that fails. A disabled flowlabel_consistency does not affect the remaining features being tested on the file, and failing to disable is not fatal and skips the reflect test only. The previously defined tcp_listen and tcp_connect helpers were reused, since the connection flow required for REFLECT validation is very similar to REMOTE. Signed-off-by: Marcelo Mendes Spessoto Junior <marcelomspessoto@gmail.com> Link: https://patch.msgid.link/20260807220942.421382-5-marcelomspessoto@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-11selftests: net: create own netns in ipv6_flowlabel_mgrMarcelo Mendes Spessoto Junior
Have ipv6_flowlabel_mgr create and configure its own network namespace (unshare(CLONE_NEWNET) + bring up lo), the same way ipv6_fragmentation.c and icmp_rfc4884.c already do, instead of relying on the in_netns.sh wrapper script. The setup can then be reused across tests through fixtures and provide isolated network environments for each test in the case of a future adoption of kselftest_harness. It also avoids the leak of modifications to the netns in case the user runs the test file directly, outside the wrapper and without the in_netns.sh file. Signed-off-by: Marcelo Mendes Spessoto Junior <marcelomspessoto@gmail.com> Link: https://patch.msgid.link/20260807220942.421382-4-marcelomspessoto@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-11selftests: net: test IPV6_FL_F_REMOTEMarcelo Mendes Spessoto Junior
This flag retrieves the flow label seen by the socket at connection setup via a getsockopt query. Therefore, the validation of this flag requires a brief connection setup (source code for flow label shows it must be TCP). The simple TCP connection logic was wrapped inside two simple helpers, because there are other uncovered features of flow label mgr that could benefit from it (such as IPV6_FL_F_REFLECT). Signed-off-by: Marcelo Mendes Spessoto Junior <marcelomspessoto@gmail.com> Link: https://patch.msgid.link/20260807220942.421382-3-marcelomspessoto@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-11selftests: net: test IPV6_FL_A_RENEWMarcelo Mendes Spessoto Junior
RENEW was the only flow label action without selftests coverage. Assert renew returns no error on correct usage and fails for labels that do not exist. This test is based on the previously implemented EXCL share test, which demonstrates that a new flow label with the same value can be created after the linger period. Renew is used here to show that a flow label can last longer and block a new flow label creation after the previous linger time. This test, however, demands sleep during execution, and should be placed as a conditional test under the -l option. The addition of the expect_fail_errno helper is necessary to assert the corresponding error when a function can fail in multiple ways. Signed-off-by: Marcelo Mendes Spessoto Junior <marcelomspessoto@gmail.com> Link: https://patch.msgid.link/20260807220942.421382-2-marcelomspessoto@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-11selftests/bpf: Test RCU iterator state pruningNing Ding
Add a path where RCU protection reaches zero and then starts again. The iterator is untrusted after this gap and must be rejected. Signed-off-by: Ning Ding <dingning04@gmail.com> Link: https://patch.msgid.link/20260811035955.132989-3-dingning04@gmail.com Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
2026-08-11selftests: timers: nsleep-lat: Check all calls to clock_nanosleep() and ↵Thomas Weißschuh (Schneider Electric)
clock_gettime() Both these functions can fail. The first calls to those functions are already checked and result in KSFT_SKIP. If they start failing afterwards unexpectedly, report a hard error. Signed-off-by: Thomas Weißschuh (Schneider Electric) <thomas.weissschuh@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Acked-by: John Stultz <jstultz@google.com> Link: https://patch.msgid.link/20260803-auxclock-nanosleep-prep-v2-17-910cbd485390@linutronix.de
2026-08-11selftests: timers: nsleep-lat: Reuse kselftest error numbersThomas Weißschuh (Schneider Electric)
The test currently defines its own custom error numbers. These mirror the semantics from the standard KFST_* constants. To make the code easier to read, use the standard result constants. Signed-off-by: Thomas Weißschuh (Schneider Electric) <thomas.weissschuh@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Acked-by: John Stultz <jstultz@google.com> Link: https://patch.msgid.link/20260803-auxclock-nanosleep-prep-v2-16-910cbd485390@linutronix.de
2026-08-11selftests: timers: nsleep-lat: Explicitly list the tested clocksThomas Weißschuh (Schneider Electric)
The test relies on the numeric values of the clockids. As not all clocks are meant to be tested, this requires skipping some clocks unconditionally, cluttering the result. Use an equivalent, explicit list instead. In addition to CLOCK_PROCESS_CPUTIME_ID, CLOCK_THREAD_CPUTIME_ID and CLOCK_HWSPECIFIC which were unconditionally skipped before, this also unconditionally skips CLOCK_MONOTONIC_RAW, CLOCK_MONOTONIC_COARSE and CLOCK_REALTIME_COARSE. clock_nanosleep() is not supported for those. Signed-off-by: Thomas Weißschuh (Schneider Electric) <thomas.weissschuh@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Acked-by: John Stultz <jstultz@google.com> Link: https://patch.msgid.link/20260803-auxclock-nanosleep-prep-v2-15-910cbd485390@linutronix.de
2026-08-11selftests: timers: nsleep-lat: Use NSEC_PER_MSEC define for unreasonable latencyThomas Weißschuh (Schneider Electric)
Use the predefined symbol to make the code easier to understand. Signed-off-by: Thomas Weißschuh (Schneider Electric) <thomas.weissschuh@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Acked-by: John Stultz <jstultz@google.com> Link: https://patch.msgid.link/20260803-auxclock-nanosleep-prep-v2-14-910cbd485390@linutronix.de
2026-08-11selftests: timers: nanosleep: Report each test separatelyThomas Weißschuh (Schneider Electric)
Currently the test for the sleep functionality itself and the one for the remaining time are reported together. This makes the test output a bit confusing, especially as the upcoming tests for auxiliary clocks will have different results between the two parts. Report each test part on its own. This also allows continuing testing other clocks after a single one has failed. Signed-off-by: Thomas Weißschuh (Schneider Electric) <thomas.weissschuh@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Link: https://patch.msgid.link/20260803-auxclock-nanosleep-prep-v2-13-910cbd485390@linutronix.de
2026-08-11selftests: timers: nanosleep: Explicitly handle timer_delete() failureThomas Weißschuh (Schneider Electric)
An upcoming patch will remove the early exit on failure of a single testcase. If a test fails because a timeout timer could not be deleted, then that timeout timer might interfere with the following tettcases. Exit the whole test case with a clear error message in this case. Other failures are not problematic: * If timer_settime() fails, a harmless unarmed timer is left around. * The SIGALRM handler reconfigured for each call to nanosleep_test_remaining() anyways. Signed-off-by: Thomas Weißschuh (Schneider Electric) <thomas.weissschuh@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Link: https://patch.msgid.link/20260803-auxclock-nanosleep-prep-v2-12-910cbd485390@linutronix.de
2026-08-11selftests: timers: nanosleep: Move all single clock tests out of the loop in ↵Thomas Weißschuh (Schneider Electric)
main() Make the code easier to read by avoiding a goto. Signed-off-by: Thomas Weißschuh (Schneider Electric) <thomas.weissschuh@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Acked-by: John Stultz <jstultz@google.com> Link: https://patch.msgid.link/20260803-auxclock-nanosleep-prep-v2-11-910cbd485390@linutronix.de
2026-08-11selftests: timers: nanosleep: Reuse kselftest error numbersThomas Weißschuh (Schneider Electric)
The test currently defines its own custom error numbers. These mirror the semantics from the standard KFST_* constants. To make the code easier to read, use the standard result constants. Signed-off-by: Thomas Weißschuh (Schneider Electric) <thomas.weissschuh@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Acked-by: John Stultz <jstultz@google.com> Link: https://patch.msgid.link/20260803-auxclock-nanosleep-prep-v2-10-910cbd485390@linutronix.de
2026-08-11selftests: timers: nanosleep: Explicitly list the tested clocksThomas Weißschuh (Schneider Electric)
The test relies on the numeric values of the clockids. As not all clocks are meant to be tested, this requires skipping some clocks unconditionally, cluttering the result. Use an equivalent, explicit list instead. In addition to CLOCK_PROCESS_CPUTIME_ID, CLOCK_THREAD_CPUTIME_ID and CLOCK_HWSPECIFIC which were unconditionally skipped before, this also unconditionally skips CLOCK_MONOTONIC_RAW, CLOCK_MONOTONIC_COARSE and CLOCK_REALTIME_COARSE. clock_nanosleep() is not supported for those. Signed-off-by: Thomas Weißschuh (Schneider Electric) <thomas.weissschuh@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Acked-by: John Stultz <jstultz@google.com> Link: https://patch.msgid.link/20260803-auxclock-nanosleep-prep-v2-9-910cbd485390@linutronix.de
2026-08-11selftests: timers: nanosleep: Drop output alignmentThomas Weißschuh (Schneider Electric)
The padding of the clock name is pointless as nothing else is printed. Signed-off-by: Thomas Weißschuh (Schneider Electric) <thomas.weissschuh@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Link: https://patch.msgid.link/20260803-auxclock-nanosleep-prep-v2-8-910cbd485390@linutronix.de
2026-08-11selftests: timers: Use clock_name() and constants from clock-helpers.hThomas Weißschuh (Schneider Electric)
Replace the many repetitions of custom clockid_t to string translation with the clock_name() helper from clock-helpers.h. Also drop the custom ?SEC_PER_?SEC definitions. Signed-off-by: Thomas Weißschuh (Schneider Electric) <thomas.weissschuh@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Acked-by: John Stultz <jstultz@google.com> Link: https://patch.msgid.link/20260803-auxclock-nanosleep-prep-v2-7-910cbd485390@linutronix.de
2026-08-11selftests: Add clock-helpers.hThomas Weißschuh (Schneider Electric)
Multiple selftests duplicate various clock-related functionality. Add a new header to collect and deduplicate those. Signed-off-by: Thomas Weißschuh (Schneider Electric) <thomas.weissschuh@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Acked-by: John Stultz <jstultz@google.com> Link: https://patch.msgid.link/20260803-auxclock-nanosleep-prep-v2-6-910cbd485390@linutronix.de
2026-08-11Merge tag 'probes-fixes-v7.2-rc7' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace Pull probes fix from Masami Hiramatsu: - Convert ELF entry point to file offset in uprobe test Convert the ELF entry point address (e_entry) to a file offset using LOAD segment headers in add_remove_uprobe test. This fixes uprobe registration failures (-EINVAL) on non-PIE executables where vaddr exceeds file size. * tag 'probes-fixes-v7.2-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace: selftests/ftrace: Convert ELF entry point to file offset in uprobe test
2026-08-11selftests: tls: cover splice after a failed decryptChuck Lever
Nothing in this file splices a socket whose last decrypt failed, so the check that fails tls_sw_splice_read() on a broken connection can be removed without a test noticing. Such a splice hands the application plaintext that recvmsg() and read_sock() already refuse to return. Extend the bad_auth pattern. Corrupt an authenticated record, confirm recvmsg() reports EBADMSG, then splice the same socket and require EBADMSG again. A synchronous decrypt fails again on the still-queued record, so only an async decrypt reaches EBADMSG through the recorded-failure check alone. bad_auth builds the same corrupted record, so its construction moves into a helper the two tests share. Signed-off-by: Chuck Lever <cel@kernel.org> Reviewed-by: Sabrina Dubroca <sd@queasysnail.net> Link: https://patch.msgid.link/20260806-tls-splice-crypto-fix-v1-2-a2624005a286@kernel.org Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-08-11selftests: net: reuseport_bpf_numa: consider cpuless numa nodeFeng Tang
reuseport_bpf_numa case failed when testing on a platform with CXL memory: #./reuseport_bpf_numa ---- IPv4 UDP ---- send node 0, receive socket 0 ./reuseport_bpf_numa: failed to pin to node: Invalid argument The root cause is that the platform has 2 numa nodes: node 0 has both cpu and memory, while node 1 is a CXL node which only has memory, and caused numa_run_on_node() to fail. Add sanity check to skip cpuless numa node for the numa binding test. Signed-off-by: Feng Tang <feng.tang@linux.alibaba.com> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/20260807002436.43991-1-feng.tang@linux.alibaba.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-08-10selftests/livepatch: update test-ftrace.sh for deprecated ftrace_enabledAndrey Grodzovsky
kernel.ftrace_enabled=0 is now refused on kernels that deprecate the knob, so the old disable/reload flow no longer applies there. Probe for this with ftrace_disable_supported() and keep the full original scenario (disable, fail to load a livepatch, re-enable, load, confirm disable is refused while loaded) on kernels where it still works; otherwise just confirm the write is refused. Link: https://patch.msgid.link/20260806153000.4184871-3-andrey.grodzovsky@crowdstrike.com Suggested-by: Steven Rostedt <rostedt@goodmis.org> Suggested-by: Joe Lawrence <joe.lawrence@redhat.com> Assisted-by: Claude:claude-sonnet-5 Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@crowdstrike.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2026-08-10selftests: bonding: disable DAD for IPv6 addressesJakub Kicinski
bond_reset() waits up to 2 seconds for IPv6 connectivity. With default settings DAD itself may take almost 2 seconds, causing flakes on debug builds. It used to flake once or twice a week, recently it started failing once a day. Probably some downstream changes to scheduler, or our machines go busier. A lot of selftests already use nodad, let's use nodad in bonding, too. I don't see an obvious reason why DAD would be important to the test. Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn> Link: https://patch.msgid.link/20260808162345.2442594-1-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-10selftests: drv-net: so_txtime: only send test traffic to sch_etfWillem de Bruijn
The ETF qdiscs drops traffic without a socket or txtime. Even with parameter skip_sock_check regular traffic is affected by ETF. This test ran fine when run manually in a pure software environment. But with drv-net across two hosts tests fail as early as when calling cfg.remote.deploy due to effectively losing connectivity. Isolate the intended test traffic: - mark that with SO_MARK 100 - install a regular permissive root prio qdisc for background traffic - install the ETF qdisc as leaf - install a filter that only directs SO_MARK 100 traffic to this leaf Technically other high prio traffic will map onto this leaf based on ToS band mapping too. But that is immaterial in practice. Fixes: 5c6baef3885c ("selftests: drv-net: convert so_txtime to drv-net") Signed-off-by: Willem de Bruijn <willemb@google.com> Link: https://patch.msgid.link/20260808160129.890119-1-willemdebruijn.kernel@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-10selftests: drv-net: let ethtool stats settle before readingJakub Kicinski
Some devices refresh the statistics exposed via ethtool only periodically, every stats-block-usecs (as reported by ethtool -c). ethtool_std_stats and ethtool_rmon sample the counters immediately after generating traffic, so on such devices they can read stale values and fail with a delta short of the packets just sent. Add a hw_stats_settle() helper which sleeps for 1.25x the configured stats-block-usecs (defaulting to 20ms when the device reports no, or a zero, period). Use it for ethtool std stats and RMON. The 1.25x/20msec heuristic matches what the Python tests do. Reviewed-by: Petr Machata <petrm@nvidia.com> Link: https://patch.msgid.link/20260808163653.2460381-2-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-10selftests: drv-net: pace ethtool_std_stats packet generationJakub Kicinski
mausezahn defaults to sending packets back to back at the maximum rate, which can cause packet loss, especially if receiver is running a debug kernel. Space the generated packets out (-d 10usec), like ethtool_rmon already does. Reviewed-by: Petr Machata <petrm@nvidia.com> Link: https://patch.msgid.link/20260808163653.2460381-1-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-10selftests: netdevsim: fix SIGPIPE flake in ethtool-coalesceJakub Kicinski
The adaptive-rx and adaptive-tx checks use 'ethtool -c | grep -q' under 'set -o pipefail'. grep -q exits as soon as it finds a match, which can happen before ethtool finishes writing its output. When that occurs, ethtool receives SIGPIPE causing (uninformative): # selftests: drivers/net/netdevsim: ethtool-coalesce.sh # FAILED 1/22 checks not ok 1 selftests: drivers/net/netdevsim: ethtool-coalesce.sh # exit=1 This happens on debug kernels in NIPA, ~4% of the time. Link: https://patch.msgid.link/20260808163416.2456810-1-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-10selftests: tc-testing: add act_ct test for malformed header handlingHyunjung Ko
Add a tdc case covering the leak fixed by the previous patch. The test attaches "action ct" to a clsact ingress chain and injects ten IPv6 frames whose nexthdr says hop-by-hop but which carry nothing after the 40-byte header, so ipv6_find_hdr() fails and tcf_ct_ipv6_is_fragment() returns -EPROTO. Before the fix act_ct returned TC_ACT_CONSUMED for these packets, so tc_run() never reached its TC_ACT_SHOT arm and the clsact drop counter stayed at zero while the skbs leaked. After the fix the packets are dropped properly and the counter reflects them, which is what the test matches on: before: Sent 476 bytes 11 pkt (dropped 0, overlimits 0 requeues 0) after: Sent 400 bytes 10 pkt (dropped 10, overlimits 0 requeues 0) Signed-off-by: Hyunjung Ko <hj351016@gmail.com> Reviewed-by: Victor Nogueira <victor@mojatatu.com> Acked-by: Jamal Hadi Salim <jhs@mojatatu.com> Link: https://patch.msgid.link/20260806101235.809370-2-hj351016@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-10Merge branch 'master' of ↵Tejun Heo
git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next into for-7.3-arena-args Pull bpf-next d114bb989367 ("Merge branch 'add-arena-argument-support-to-kfuncs-and-struct_ops'") to make the __arena and __arena__nullable kfunc and struct_ops argument suffixes available. The suffixed arguments will be used to convert sched_ext kfuncs and struct_ops callbacks that currently pass arena pointers as scalars and rebase them by hand.
2026-08-10selftests/net: fin_ack_lat: fix latency threshold typoBrian Grech
The commit message for af8c8a450bf4 ("selftests: net: Add FIN_ACK processing order related latency spike test") states: "if the latency is larger than 1 second (spike), print a message". However the code uses a threshold of 100000 us (100 ms), not 1000000 us (1 s). The lower threshold causes false positives on slower hardware where normal connection latency occasionally exceeds 100 ms but never approaches the 1 s spike that indicates the actual FIN/ACK race bug. Fix the threshold to match the documented intent. Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: Brian Grech <bgrech@redhat.com> Link: https://patch.msgid.link/20260806151645.4172900-1-bgrech@redhat.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-10selftests/sched_ext: Check skeleton open failure in exit testLiang Luo
exit.c does not check the return value of exit__open(). If it returns NULL, which happens when the skeleton wrapper fails to allocate the object or open the BPF ELF, the very next line dereferences it via SCX_ENUM_INIT(). That macro expands to SCX_ENUM_SET(), which accesses skel->rodata, causing a NULL pointer dereference. Every other selftest guards this with SCX_FAIL_IF(!skel, ...); exit.c is the only one missing it. Fixes: a5db7817af78 ("sched_ext: Add selftests") Signed-off-by: Liang Luo <luoliang@kylinos.cn> Signed-off-by: Tejun Heo <tj@kernel.org>
2026-08-10selftests/cgroup: Avoid awk -e in cpuset testsRui Qi
The cpuset selftests use awk -e to parse cgroup mount points. This works with gawk, but mawk rejects the option. In test_cpuset_prs.sh, this leaves CGROUP2 empty and causes the test to skip as if cgroup v2 were not mounted. The same non-portable invocation exists in the cpuset v1 hotplug test. The scripts only need to pass a single awk program. Use the standard awk invocation without -e so mount point detection works with awk implementations that do not support the gawk extension. Fixes: a8c52eba880a ("kselftest/cgroup: Add cpuset v2 partition root state test") Fixes: 812c5945bdb8 ("cgroup/cpuset: Add test_cpuset_v1_hp.sh") Signed-off-by: Rui Qi <qirui.001@bytedance.com> Acked-by: Waiman Long <longman@redhat.com> Reviewed-by: Ridong Chen <ridong.chen@linux.dev> Signed-off-by: Tejun Heo <tj@kernel.org>
2026-08-10vfio: selftests: Retry on EAGAIN during device resetJosh Hilke
Add retry logic to vfio_pci_device_reset() to handle the case where PCI resets fail due to lock contention, in which case pci_try_reset_function() returns -EAGAIN. Suggested-by: David Matlack <dmatlack@google.com> Signed-off-by: Josh Hilke <jrhilke@google.com> Acked-by: David Matlack <dmatlack@google.com> Link: https://lore.kernel.org/r/20260805-igb_v3_b4-v10-3-9c86dc849c0d@google.com Signed-off-by: Alex Williamson <alex@shazbot.org>
2026-08-10vfio: selftests: igb: Add driver for Intel 82576 deviceJosh Hilke
Add a VFIO selftest driver for the Intel Gigabit Ethernet controller (IGB), specifically targeting the 82576 device. IGB is fully virtualized in QEMU which makes it easy to run VFIO selftests without needing any specific hardware. Since IGB is an Ethernet device, it cannot support DMA transfers smaller than the minimum Ethernet payload size (60 bytes) without hardware padding corrupting adjacent memory. The driver asserts that the transfer size is at least 60 bytes to prevent this. All VFIO selftest drivers must implement DMA/memcpy operations, but IGB doesn't have a native memcpy feature, so the loopback feature (described in section 3.5.6.3 of IGB specification) is used to implement it. To support testing on both QEMU and physical hardware, the driver uses PHY internal loopback with some QEMU-specific fallbacks. The driver also supports MSI-X routing and interrupt management, and disables PCIe completion timeout retries to ensure clean recovery during invalid-DMA tests. Users can verify the driver works in QEMU by building the kernel, building VFIO selftests, and then running the vfio_pci_driver_test using this command: vng \ --run arch/x86/boot/bzImage \ --user root \ --disable-microvm \ --memory 32G \ --cpus 8 \ --qemu-opts="-M q35,accel=kvm,kernel-irqchip=split" \ --qemu-opts="-device intel-iommu,intremap=on,caching-mode=on,device-iotlb=on" \ --qemu-opts="-netdev user,id=net0 -device igb,netdev=net0,addr=09.0" \ --append "console=ttyS0 earlyprintk=ttyS0 intel_iommu=on iommu=pt" \ --exec "modprobe vfio-pci && \ ./tools/testing/selftests/vfio/scripts/setup.sh 0000:00:09.0 && \ ./tools/testing/selftests/vfio/scripts/run.sh ./tools/testing/selftests/vfio/vfio_pci_driver_test" Assisted-by: Claude:claude-opus-4-7 Assisted-by: Gemini:gemini-3.1-pro-preview Co-developed-by: Alex Williamson <alex.williamson@nvidia.com> Signed-off-by: Alex Williamson <alex.williamson@nvidia.com> Signed-off-by: Josh Hilke <jrhilke@google.com> Acked-by: David Matlack <dmatlack@google.com> Link: https://lore.kernel.org/r/20260805-igb_v3_b4-v10-2-9c86dc849c0d@google.com Signed-off-by: Alex Williamson <alex@shazbot.org>
2026-08-10vfio: selftests: Add helpers to re-enable interruptsAlex Williamson
Selftest drivers that recover from a fault by issuing VFIO_DEVICE_RESET need to re-arm device interrupts afterwards. VFIO_DEVICE_RESET tears down the kernel-side IRQ trigger so a subsequent VFIO_DEVICE_SET_IRQS is required, but the user-side eventfds (and any fd cached in a test fixture) are still valid and must be preserved. vfio_pci_irq_enable() refuses to be called for vectors that already have an eventfd (VFIO_ASSERT_LT), and vfio_pci_irq_disable() closes all eventfds before resetting the trigger, so neither is suitable. Add vfio_pci_irq_reenable(device, index, vector, count) which asserts that the requested range has existing eventfds and re-issues VFIO_DEVICE_SET_IRQS using them. Signature mirrors vfio_pci_irq_enable(). Add vfio_pci_msi{,x}_reenable() wrappers around vfio_pci_irq_reenable() for additional ease of use and readability. Assisted-by: Claude:claude-opus-4-7 Signed-off-by: Alex Williamson <alex.williamson@nvidia.com> Reviewed-by: David Matlack <dmatlack@google.com> Acked-by: David Matlack <dmatlack@google.com> Link: https://lore.kernel.org/r/20260805-igb_v3_b4-v10-1-9c86dc849c0d@google.com Signed-off-by: Alex Williamson <alex@shazbot.org>
2026-08-10selftests: netfilter: conntrack_dump_flush: remove unused variables and fix typoQingshuang Fu
Remove unused 'rplnlh' in conntrack_data_insert(), and remove unused 'rplnlh' and 'nest' variables in conntrack_count_zone() and conntrack_flush_zone(). These variables were declared but never used since their introduction. Also fix typo: rename misspelled conntracK_count_zone() to conntrack_count_zone(). Signed-off-by: Qingshuang Fu <fuqingshuang@kylinos.cn> Reviewed-by: Fernando Fernandez Mancera <fmancera@suse.de> Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2026-08-10KVM: selftests: Create one VM with many vCPUs for each major PMU counters testSean Christopherson
To reduce the runtime of the PMU counters test by an order of magnitude, create one VM per category of test (arch events, GP PMCs, fixed PMCs), with N vCPUs per VM, where 'N' is the number of testscases to run per category. The vast majority of the test's runtime is spent creating VMs, because while creating a VM only takes a few milliseconds, the total time adds up when creating hundreds of VMs. The only reason the test creates so many VMs is because KVM disallows changing the virtual PMU model after a vCPU runs, so rather than create an entirely new VM just to get a "fresh" vCPUs, simply use a different vCPU. On an Emerald Rapids host, this reduces the runtime from 75+ seconds to less than 6 seconds. Opportunistically fix a typo in the comment about unavailable_masks pointed out by Like Xu[1]. Link: https://lore.kernel.org/all/20260625090155.6326-1-likexu@tencent.com[1] Link: https://patch.msgid.link/20260804210046.3413149-3-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
2026-08-10selftests/filesystems: test completing a context from another user namespaceChristian Brauner
fsopen() records the caller's user namespace in fc->user_ns and hands back an ordinary file descriptor, so the task that issues FSCONFIG_CMD_CREATE need not be the one that created the context. mount_capable() authorizes that for a caller holding CAP_SYS_ADMIN in an ancestor of fc->user_ns, which any unprivileged user has over a user namespace it just created. binfmt_misc and overlayfs used to WARN_ON() the mismatch. Add a test for both. Also cover the handover within one user namespace. That is a supported thing to do and has to keep working. Link: https://patch.msgid.link/20260802-work-fill_super-warn-v1-3-4e987911a39a@kernel.org Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
2026-08-10KVM: LoongArch: selftests: Add FPU/LSX/LASX test casesBibo Mao
Add FPU/LSX/LASX test cases and verify FPU register get and set APIs, the FPU width supports 64/128/256 bits. Signed-off-by: Bibo Mao <maobibo@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
2026-08-10KVM: LoongArch: selftests: Enable LSX/LASX by auto detectionBibo Mao
Add LSX and LASX features when VM is created. These features are detected firstly, enable it if it is available on host machine. Signed-off-by: Bibo Mao <maobibo@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
2026-08-08preempt: Introduce HARDIRQ_DISABLE_BITSBoqun Feng
In order to support preempt_disable()-like interrupt disabling, that is, using part of preempt_count() to track interrupt disabling nesting level, change the preempt_count() layout to contain 8-bit HARDIRQ_DISABLE count. Signed-off-by: Boqun Feng <boqun@kernel.org> Signed-off-by: Lyude Paul <lyude@redhat.com> Signed-off-by: Boqun Feng <boqun@kernel.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://patch.msgid.link/20260121223933.1568682-2-lyude@redhat.com Link: https://patch.msgid.link/20260804161447.84806-3-boqun@kernel.org
2026-08-08preempt: Track NMI nesting to separate per-CPU counterJoel Fernandes
Move NMI nesting tracking from the preempt_count bits to a separate per-CPU counter (nmi_nesting). This is to free up the NMI bits in the preempt_count, allowing those bits to be repurposed for other uses. Reduce NMI_BITS from 4 to 1, using it only to detect if we're in an NMI. The per-CPU counter currently caps nesting at 15. [boqun: Address Steven Rostedt's comment on the BUG_ON() condition] [boqun: Use preempt_count_set() in __nmi_exit() to avoid underflow] Suggested-by: Boqun Feng <boqun@kernel.org> Signed-off-by: Joel Fernandes <joelagnelf@nvidia.com> Signed-off-by: Lyude Paul <lyude@redhat.com> Signed-off-by: Boqun Feng <boqun@kernel.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://patch.msgid.link/20260121223933.1568682-3-lyude@redhat.com Link: https://patch.msgid.link/20260804161447.84806-2-boqun@kernel.org