summaryrefslogtreecommitdiff
path: root/tools/testing
AgeCommit message (Collapse)Author
13 daysMerge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netJakub Kicinski
Cross-merge networking fixes after downstream PR (net-7.3-rc8). No conflicts. Adjacent changes: drivers/net/ethernet/microchip/lan865x/lan865x.c 2a3f6d2a9ac3 ("microchip: lan865x: move setting of netops to fix crash") 15358c2c3dca ("net: ethernet: oa_tc6: return ERR_PTR from oa_tc6_init()") Signed-off-by: Jakub Kicinski <kuba@kernel.org>
13 daysselftests/bpf: Create the vxlan devices of test_tunnel with their MACQiliang Yuan
The vxlan tests of test_tunnel create a tunnel device in the initial netns with "ip link add", and then give it the MAC address that the static neighbor entry at the other end points to with "ip link set". systemd-udevd assigns new devices of the initial netns a MAC address of its own, following its MACAddressPolicy, when it handles their uevent. When it gets to that after the test set the address, the replies sent to the configured MAC are dropped as meant for another host, and the ping of vxlan_tunnel fails after 10 seconds. Pass the address to "ip link add". udevd leaves alone the address of a device that was created with one. Fixes: 1ee7efd40abf ("selftests/bpf: Move vxlan tunnel testcases to test_progs") Signed-off-by: Qiliang Yuan <odys.yuan@gmail.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20261009-selftests-bpf-tunnel-vxlan-mac-v1-1-624dd769c334@gmail.com
13 daysselftests/bpf: Clean up sa_family_t-stringifierMichal Luczaj
Following commit f3de1cf621f7 ("selftests/bpf: sockmap_listen cleanup: Drop af_unix redir tests") and commit 9266e49d608c ("selftests/bpf: sockmap_listen cleanup: Drop af_vsock redir tests"), sockmap_listen.c: family_str() becomes functionally identical to select_reuseport.c: family_str(). Move the logic to socket_helpers.h. Suggested-by: Kuniyuki Iwashima <kuniyu@google.com> Signed-off-by: Michal Luczaj <mhal@rbox.co> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com> Link: https://msgid.link/CAAVpQUDULzZh58oKkRaYqgM9bRToGb7wHrzT+cZNpRmAtM12Ow@mail.gmail.com Link: https://lore.kernel.org/bpf/20261008-selftests-sockmap_listen-cleanup-v1-1-f6d1a4ff540d@rbox.co
13 dayskselftest/arm64: Check for -EPERM not -EBUSY in the locking testMark Brown
The API has been updated to return the more descriptive -EPERM rather than -EBUSY, update the selftest to reflect this. Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
13 daysselftests/ftrace: Add nice dependencyJaewon Jung
The tests use nice but do not list it as a requirement. Add nice to the requirements so the tests are unresolved, not failed, when it is not available. Link: https://lore.kernel.org/r/20261015022416.43534-1-jaewon8868@gmail.com` Signed-off-by: Jaewon Jung <jaewon8868@gmail.com> Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
13 daysselftests: kselftest_deps.sh: Support LLVMMark Brown
The kselftest_deps.sh script currently takes a compiler as the first argument and uses it to check that libraries needed by the selftests are installed. This works well for GCC where a separate binary is provided for each target architecture but is less of a good fit for LLVM where a single compiler binary can target all of the supported architetures. Extend the script to accept "LLVM" as the compiler with an additional optional ARCH= argument so that it can be used when building with LLVM in a similar fashion to how the actual build works. The duplication with the main Makefile isn't ideal here. Link: https://lore.kernel.org/r/20261013-kselftest-deps-llvm-v1-1-f2ee70ae1b79@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org> Acked-by: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
13 daysselftests: lib.mk: Don't fail install if no modules were builtMark Brown
The install rule for TEST_GEN_MODS_DIR copies *.ko from the directory with rsync which fails if there are no modules, for example because the directory's Makefile skipped building them. Only run rsync if there is something to install. This currently affects the livepatch suite but it seems sensible to fix here for added robstness. Link: https://lore.kernel.org/r/20261014-kselftest-lib-no-modules-v1-1-e4f7208dcb56@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
13 daysselftests/ftrace: Avoid unlink error on first runJaewon Jung
On the first run, ftracetest tries to unlink a symlink that does not exist. Use rm -f to avoid the "No such file or directory" error. Link: https://lore.kernel.org/r/20261014114839.6258-1-jaewon8868@gmail.com Fixes: 7dc1e125f07a ("ftrace/selftests: Add softlink to latest log directory") Signed-off-by: Jaewon Jung <jaewon8868@gmail.com> Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
13 daystracing/selftests: Fix incorrect invocation of exit_failWoradorn Laodhanadhaworn
Replace all `exit fail` and `exit_fail;` with exit_fail to keep the usage of exit_fail consistent across the ftrace selftests. This also reduces warning messsege such as 'exit: Illegal number: fail' in test logs. Link: https://lore.kernel.org/linux-trace-kernel/20260918061913.28069-1-woradorn.laon@gmail.com Signed-off-by: Woradorn Laodhanadhaworn <woradorn.laon@gmail.com> Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
13 daysselftests/lib.mk: run_tests: print summary at the endMatthieu Baerts (NGI0)
When there are many tests and/or many log lines, it is difficult to quickly find out how the different tests went when running: make -C tools/testing/selftests run_tests This run_tests target executes 'run_many' from runner.sh, which relies on ktap_helpers.sh. At the end of the execution, the KTAP_CNT_* counters have been populated, and the total can then be simply printed with the ktap_print_totals helper. Now a summary is printed at the end, e.g. here with the two last lines: $ make -sC tools/testing/selftests TARGETS=(...) run_tests # timeout set to (...) # selftests: (...) (...) ok 1 selftests: (...) # timeout set to (...) # selftests: (...) (...) ok 2 selftests: (...) # SKIP # timeout set to (...) # selftests: (...) (...) not ok 3 selftests: (...) # 1 skipped test(s) detected. Consider enabling relevant config options to improve coverage. # Totals: pass:1 fail:1 xfail:0 xpass:0 skip:1 error:0 This summary is printed, using '#' as prefix to be treated as a comment in the TAP format. The summary is also printed when summary=1 is used to redirect log lines in different files because it still looks useful when there are many tests, not to have to check each line. Note that this 'make' command will continue to exit without errors (returned code is 0) when the tests can be executed. I guess it is better not to change this behaviour to be able to continue detecting kselftests failures. Link: https://lore.kernel.org/r/20261005-sft-run-tests-print-totals-v2-1-29c45c0e2fe6@kernel.org Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
13 daysselftests/fuse: add fuse readdir caching testLuis Henriques
This new test will check the caching behaviour using combinations of two opendir flags: FOPEN_KEEP_CACHE and FOPEN_CACHE_DIR. Signed-off-by: Luis Henriques <luis@igalia.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
13 daysselftests/fuse: add fuse symlink caching testLuis Henriques
This patch adds a simple test that allows to verify that, when resolving a symlink, user-space is called only the first time when caching is enabled or, if caching is disabled, every time the symlink resolution is requested. Signed-off-by: Luis Henriques <luis@igalia.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
13 daysselftests/fuse: add some extra ACL caching testsLuis Henriques
This adds some extra tests to ACL caching: - Verify that reading ACLs results in the expected number of requests being sent user-space, depending on whether cache is enabled or disabled - Verify caching behaviour on some caching invalidation scenarios While there, add test binary to .gitignore. Signed-off-by: Luis Henriques <luis@igalia.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
13 daysselftests/fuse: use dynamically allocated memory to store ACLsLuis Henriques
Instead of directly using static arrays for the ACL value, allocate memory for storing it. This will make it easier to implement ACL tests that also set the xattr dynamically. Signed-off-by: Luis Henriques <luis@igalia.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
13 daysselftests/fuse: factor-out test fixture setup/teardownLuis Henriques
In order to reduce new tests setup/teardown code duplication, factor-out these functions from the existing acl_cache test into a new fuse_common.c file that can be reused in other tests. While there, also move some of the FIXTURE members into a fuse_common_ctx structure that can be passed into setup/teardown instead of passing them by reference. Signed-off-by: Luis Henriques <luis@igalia.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
13 daysselftests/fuse: check that fusectlfs is mountedLuis Henriques
The control filesystem for FUSE needs to be mounted for the fusectl_test to be successfully run. Skip the test is that is not the case. Signed-off-by: Luis Henriques <luis@igalia.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
13 daysselftests/fuse: convert fusectl test to fuse3Luis Henriques
Since it is probably not worth adding new fuse kselftests based on fuse2, it is a good idea to convert the single existing test to fuse3. The conversion is trivial, as it only requires some changes to function signatures (the gettattr and truncate fuse operations), and to the filler() helper. Signed-off-by: Luis Henriques <luis@igalia.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
13 daysKVM: s390: selftests: Add IRQ injection selftestsGabriella Seifert
The IRQ injection selftests haven't been added to the selftests yet so let's do that now. We start off with a couple simple error checks for invalid data. Signed-off-by: Gabriella Seifert <gseifert@linux.ibm.com> [frankja@linux.ibm.com: Improved formatting and wording] Signed-off-by: Janosch Frank <frankja@linux.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
13 daysselftests/bpf: Expect at least one tp_recursion miss in missedQiliang Yuan
missed_tp_recursion attaches its tp programs to bpf_trace_printk and expects each of them to miss exactly one run, the one that its kprobe program on bpf_fentry_test1 triggers by calling bpf_printk(). The test is not serial, so tests running in parallel can add misses to the tp programs while they are attached: - The kprobe on bpf_fentry_test1 is global. Any other test that does bpf_prog_test_run() on a fentry/fexit program calls bpf_fentry_test1() and thereby fires the kprobe program, which calls bpf_printk() from kprobe context and makes the tp programs fail the bpf_prog_active check once more. - Any other program that runs under the bpf_prog_active check, such as a kprobe program or the perf event tracepoint program in legacy_printk, and calls bpf_printk() hits bpf_trace_printk the same way. Either way, test2_recursion_misses comes out as 2 instead of 1. Expect at least one miss, as missed_kprobe_recursion does since commit 08a7078feacf ("selftests/bpf: Improve missed_kprobe_recursion test robustness"). Fixes: 85981e0f9e9f ("selftests/bpf: Add test for recursion counts of perf event link tracepoint") Signed-off-by: Qiliang Yuan <odys.yuan@gmail.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20261008-selftests-bpf-missed-tp-recursion-v1-1-0dd60471d655@gmail.com
13 daysMerge tag 'loongarch-kvm-7.4' of ↵Paolo Bonzini
git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson into HEAD LoongArch KVM changes for v7.4 1. Add separate vmid support. 2. Simplify MSI interrupt injection. 3. Add crash hypercall support. 4. Allow to set pv_feature until vCPU run. 5. Enable HW page table walk automatically in selftests.
13 daysselftests/bpf: Report a failure to register the session key in test_progsQiliang Yuan
test_progs adds the key that verifies signed programs to the session keyring before it runs any test, and exits when that fails. It exits with 255 without printing anything. pam_keyinit revokes the session keyring on logout, so a test_progs started in the background from an ssh session that has been closed since leaves nothing but an empty log behind, with no hint of what went wrong. Print the error before exiting. Fixes: b720903e2b14 ("selftests/bpf: Enable signature verification for some lskel tests") Signed-off-by: Qiliang Yuan <odys.yuan@gmail.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20261008-selftests-bpf-test-progs-session-key-v1-1-ec48e793639b@gmail.com
13 daysselftests/bpf: Use its own netns in flow_dissector_skb_less_direct_attachQiliang Yuan
test_flow_dissector_skb_less_direct_attach() and test_flow_dissector_skb_less_indirect_attach() each create a netns to run in, and test_progs may run the two at the same time. Both name their netns flow_dissector_skb_less_indirect_attach_ns. When the two tests overlap, one of them fails to create or open the netns, or loses it to the cleanup of the other one. Name the netns of the direct attach test after that test. Fixes: 2b044dd186f0 ("selftests/bpf: re-split main function into dedicated tests") Signed-off-by: Qiliang Yuan <odys.yuan@gmail.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Reviewed-by: Alexis Lothoré (eBPF Foundation) <alexis.lothore@bootlin.com> Link: https://lore.kernel.org/bpf/20261008-selftests-bpf-flow-dissector-netns-v1-1-5d9889aaad84@gmail.com
13 daysselftests/exec: report the skipped binfmt_misc_bpf test on stderrSasha Levin
The exec Makefile announces that binfmt_misc_bpf is skipped with $(info), which writes to standard output whenever the Makefile is parsed. The selftests install target appends the standard output of "make -s emit_tests" to kselftest-list.txt, so on systems without the BPF toolchain the runlist gains a line that is not a test entry: exec selftests: skipping binfmt_misc_bpf, needs clang, bpftool, ... run_kselftest.sh and CI systems that parse the runlist then treat it as a malformed test entry. Use $(warning) so that the notice still appears in build logs but goes to standard error. Fixes: 277d787feb2e ("selftests/exec: add binfmt_misc bpf-backed handler test") Signed-off-by: Sasha Levin <sashal@kernel.org> Link: https://patch.msgid.link/20261014200135.1364053-1-sashal@kernel.org Signed-off-by: Kees Cook <kees@kernel.org>
14 daysselftests/bpf: Remove the old test_bpf moduleDaniel Borkmann
The instruction tests of the test_bpf module live in the BPF selftests now, as the jit_insns test of test_progs, which BPF CI runs on every architecture it covers, and its skb_segment tests have a KUnit successor in net/core/net_test.c. Remove the module together with its Kconfig entry, the test_kmod.sh and test_bpf.sh wrappers of the bpf and net selftests, the config fragments and defconfigs that enabled it, as well as all other references to it and symbol exports in core kernel. For archs wanting to support BPF JITs, it's time they move over to the BPF selftests for proper coverage. Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20261013171230.523677-19-daniel@iogearbox.net Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
14 daysselftests/bpf: Add JIT instruction testsDaniel Borkmann
Carry only the relevant instruction tests of the test_bpf kernel module over into test_progs, so that BPF CI runs them on every JIT: ALU, atomic, 64-bit immediate load and jump instructions for the power-of-two magnitudes and signs of the operands, all shift counts, all operand register combinations, the division and modulo by constants, jumps with staggered offsets, here in both directions and also for the 32-bit unconditional jump, and the maximal jump over instructions which expand in the JITs. Add sweeps for the instruction patterns a JIT has a shorter or faster native form for, with every register as operand. The families with an immediate run once more with constant blinding. # LDLIBS=-static PKG_CONFIG='pkg-config --static' ./vmtest.sh -- ./test_progs -t jit_insns [...] #191/1 jit_insns/arena access with zero offset:OK #191/2 jit_insns/cast to a user address:OK #191/3 jit_insns/alu_imm:OK #191/4 jit_insns/alu_reg:OK #191/5 jit_insns/alu_imm_regs:OK #191/6 jit_insns/div_const:OK #191/7 jit_insns/alu_reg_pairs:OK #191/8 jit_insns/shifts:OK #191/9 jit_insns/atomics:OK #191/10 jit_insns/atomic_reg_pairs:OK #191/11 jit_insns/xadd_chain:OK #191/12 jit_insns/ld_imm64:OK #191/13 jit_insns/jmp_imm:OK #191/14 jit_insns/jmp_reg:OK #191/15 jit_insns/jmp_reg_pairs:OK #191/16 jit_insns/staggered_jumps:OK #191/17 jit_insns/max_jmp:OK #191/18 jit_insns/ldst_zero_off:OK #191/19 jit_insns/ldst_offsets:OK #191/20 jit_insns/acq_rel:OK #191/21 jit_insns/movsx:OK #191/22 jit_insns/jset_imm:OK #191/23 jit_insns/cmp_imm:OK #191/24 jit_insns/alu_consts:OK #191/25 jit_insns/bswap:OK #191/26 jit_insns/probe_mem:OK #191 jit_insns:OK #192/1 jit_insns_blinded/alu_imm:OK #192/2 jit_insns_blinded/alu_imm_regs:OK #192/3 jit_insns_blinded/div_const:OK #192/4 jit_insns_blinded/shifts:OK #192/5 jit_insns_blinded/xadd_chain:OK #192/6 jit_insns_blinded/ld_imm64:OK #192/7 jit_insns_blinded/jmp_imm:OK #192/8 jit_insns_blinded/ldst_zero_off:OK #192/9 jit_insns_blinded/ldst_offsets:OK #192/10 jit_insns_blinded/jset_imm:OK #192/11 jit_insns_blinded/cmp_imm:OK #192/12 jit_insns_blinded/alu_consts:OK #192 jit_insns_blinded:OK Summary: 2/38 PASSED, 0 SKIPPED, 0/0 FAILED Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20261013171230.523677-18-daniel@iogearbox.net Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
14 daysselftests/bpf: BPF_F_ANY_ALIGNMENT for byte_array_size_spanning()Eduard Zingerman
The test case indexes inside `char bytes[32]` array with unaligned offset. Use BPF_F_ANY_ALIGNMENT flag to avoid the test rejection for unrelated reason. Fixes: e187fac8ac6b ("selftests/bpf: Tests for varying offset access to PTR_TO_BTF_ID") Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20261013-scev-minimal-v3-followups-v2-7-6d9d61965486@gmail.com
14 daysselftests/bpf: Harden __msg patterns for step_movsx_bounds_on_lineEduard Zingerman
The `{{.*}}` in the pattern for R5 below might hide the `step=...` logging from the __no_step annotation. Replace it with full expected log instead. Also drop __no_step for R3 above, where it is unnecessary. Fixes: 2db5837f9ada ("selftests/bpf: Tests for register base/step arithmetic") Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20261013-scev-minimal-v3-followups-v2-6-6d9d61965486@gmail.com
14 daysselftests/bpf: Harden __msg pattern for global_callee_btf_argEduard Zingerman
The original pattern: __msg("3: (85) call pc+{{[0-9]+}}\n") Is ambigous, as this line is printed on the main verification pass as well. Harden the test case by ensuring a __msg_next sequence matching the stack use/def results specifically. Fixes: 063c85f5d8c7 ("selftests/bpf: Tests for BTF-based global subprog stack liveness") Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20261013-scev-minimal-v3-followups-v2-5-6d9d61965486@gmail.com
14 daysselftests/bpf: Stack effects of scalar/dynptr global subprog paramsEduard Zingerman
Verify that a frame pointer derived value does not induce stack liveness effects, when passed as a scalar argument of a global function. Verify that a stack-based dynptr passed to a global function marks live only corresponding 16 bytes. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20261013-scev-minimal-v3-followups-v2-4-6d9d61965486@gmail.com
14 daysselftests/nolibc: use the configured kernel header directorySasha Levin
The freestanding build hardcodes the source tree's usr/include even when selftests exports KHDR_INCLUDES for an output-directory build. Use the exported header location while preserving -nostdlib, -nostdinc and static linkage. GCC 14 and Clang 21 builds then find the generated UAPI headers. Fixes: eb1353110831 ("selftests/nolibc: integrate with kselftests") Signed-off-by: Sasha Levin <sashal@kernel.org> Link: https://patch.msgid.link/20261014200142.1364761-1-sashal@kernel.org Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
14 daysselftests/filesystems: test that a mntns file can't take over a lockChristian Brauner
Add a case to the locked mount test: - a bind of the mount namespace file of a grandchild moved beneath a locked cover must fail with EINVAL - a bind of an ordinary file beneath it takes the lock over, the old cover can go and the new one can't - the file is still covered after unshare(CLONE_NEWNS) Link: https://patch.msgid.link/20261014-work-namei-locked-mnt_ns_file-v1-2-24035bd5d8e9@kernel.org Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
14 daysselftests/sched_ext: Report reload_loop attach failuresTao Cui
reload_loop skips bpf_map__attach_struct_ops() failures silently: measured on a loaded host, 1125-1233 of 2048 iterations failed, all with EBUSY (the single scheduler slot changing hands between the two threads) - the test passed while roughly half of its iterations never ran. Count the failures per thread, recording any errno other than EBUSY separately. Fail the test on an unexpected errno or when a thread failed every attach; a thread that completed at least one attach has exercised the reload path, so ordinary EBUSY no longer prints on every run. Name the iteration and thread counts in an enum. Signed-off-by: Tao Cui <cuitao@kylinos.cn> Signed-off-by: Tejun Heo <tj@kernel.org>
14 daysselftests/sched_ext: Bound exit waitsTao Cui
exit, prog_run and hotplug wait for the scheduler under test to exit with no time bound; a scheduler that never exits hangs the runner instead of failing the test. Bound the waits to ~10s (iteration-based) with the new SCX_TIMED_WAIT_UEI() helper, which stretches on a loaded system instead of failing early. exit.c returns straight from its timeout path, which would leave the link and the skeleton alive and the unexited scheduler attached for the rest of the runner run - every later test would then fail to attach with EBUSY and bury the real failure. Destroy both before failing, like prog_run and hotplug already destroy the link. Signed-off-by: Tao Cui <cuitao@kylinos.cn> Signed-off-by: Tejun Heo <tj@kernel.org>
14 daysselftests/sched_ext: Add SCX_ASSERT_ALIVE and adopt itTao Cui
A scheduler that dies mid-test freezes the state that the test is about to assert on, so the assertions can pass vacuously. Add SCX_ASSERT_ALIVE(), which fails the test with the recorded exit kind, exit code and message, and use it in maximal, create_dsq and init_enable_count. Existing open-coded checks keep their goto-based cleanup and are not converted. init_enable_count also clears the uei between its two attach cycles, since the clean unregister of the first cycle would otherwise trip the check of the second. Signed-off-by: Tao Cui <cuitao@kylinos.cn> Signed-off-by: Tejun Heo <tj@kernel.org>
14 daysselftests/sched_ext: Fail loudly when EXIT_KIND is missing from BTFTao Cui
EXIT_KIND() resolved scx_exit_kind values through __COMPAT_ENUM_OR_ZERO(), which maps a missing enumerator to 0 (== SCX_EXIT_NONE). struct scx_exit_info carries the enum itself, so the BTF of any loaded scheduler always has the type, and every enumerator the tests resolve today exists on all sched_ext kernels: the fallback got the value right, and the single comparison that could pass vacuously was the kick.c error poll. Still, a silently-zeroed lookup is a trap. EXIT_KIND() is now an alias of SCX_KIND_VAL(), which fails the test loudly when the enumerator is missing. Convert the remaining `kind != EXIT_KIND(SCX_EXIT_NONE)` checks (allowed_cpus, cgroup_nr_cpus, cyclic_kick_wait and enq_blocked) to UEI_EXITED() so they keep their semantics without a BTF lookup, and hoist kick.c invalid_one()'s error_kind resolution above the gated-worker spawn so a failing lookup cannot bypass its cleanup path. Signed-off-by: Tao Cui <cuitao@kylinos.cn> Signed-off-by: Tejun Heo <tj@kernel.org>
14 daysselftests/sched_ext: Fix reload_loop error-path use-after-freeTao Cui
If the second pthread_create() fails, run() returns and the runner calls cleanup, which destroys the skeleton while the first reload thread is still running do_reload_loop() and dereferencing its maps - a use-after-free on the error path. Set force_exit and join the first thread before failing. Signed-off-by: Tao Cui <cuitao@kylinos.cn> Signed-off-by: Tejun Heo <tj@kernel.org>
14 daysMerge tag 'kvmarm-7.4' of ↵Paolo Bonzini
git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm into HEAD KVM/arm64 updates for 7.4 * New features - pKVM state isolation: years after pKVM started being enabled upstream, we finally get the basics in the form of state isolation. The vcpu state is now off-limit for the host for protected VMs. - pKVM also grows a hypervisor-private memory allocator, allowing it to deal with sub-page allocation, much like everywhere else. - pKVM also lands a trace_printk() equivalent, which hopefully will make debugging a bit easier. - First shot at annotating portions of the KVM/arm64 code to be extracted and built on s390. The real fun is yet to come. - Allow pre-faulting of stage-2 canonical mappings from userspace, joining x86 and s390 in implementing this feature. - Add a reverse mapping infrastructure for shadow stage-2, significantly improving performance when MMU notifiers kick in, and avoiding full unmap of all shadow tables for this VM. - Next step of GICv5 enablement, adding support for the IRS block, and providing both SPI and LPI support. This is the first point where KVM/arm64 can support an SMP GICv5 guest. * Improvements - As a preliminary to eventually enabling CCA, add a bunch of infrastructure to KVM/arm64, splitting some of the basic operations into individual backends (normal VM, normal pKVM VM, protected pKVM VM). This allows CCA to later slot in without polluting the rest of KVM with its firmware-driven nonsense. - Make ID registers immutable from the point where a vcpu is able to run, even if it fails to run. This prevents KVM from sampling untrusted values. - Restore some type checking to the EL2 object. KVM/arm64 originally had some strong type checking between the kernel and the EL2 object, but lost it along the way when the private hypercall interface was (somewhat pointlessly) converted to SMCCC. Type checking is back, syscall style, and with added sparse goodies. - Expand the FFA support to FFA_NOTIFICATION_*, and add some sanitisation of the protocol that pKVM relays to the "trusted" runtime. * Fixes - Make GICv3 RD assignment more robust to userspace nonsense - Convert the remaining MMU fault handler backends to kvm_s2_fault_vma_info and co, fixing a number of bugs in the process. - Fix the SError/SEA selftests to be both more robust and less braindead. - Fix a smattering of documentation bugs, some of them as a result of our AI friends spitting out credible assertions based on non-existing symbols. - The usual collection of low impact bug fixes (SMCCC, timers, PMU).
2026-10-14selftests: netfilter: nft_queue.sh: only queue icmp echo request/replyJakub Kicinski
The bridge test flakes on debug kernels: FAIL: Expected 10 packets total, but got 24 packets total hook 3 packets 00000008 hook 4 packets 00000010 The surplus are icmp fragment reassembly timeouts. The udp flood in the stress test leaves incomplete datagrams behind in ns2 and ns3, 30 seconds later their reassembly queues expire and both namespaces send icmp time exceeded to ns1's pre-bridge address. ns3 is not reconfigured when the router is turned into a bridge, so its messages arrive via veth2 and are then forwarded out of br0. Such packets are locally originated from the bridge point of view and are queued from the bridge output and postrouting hooks, which is why only those two counters are off. Restrict the ipv4 rule to echo request/reply, the icmpv6 rule already does this. We used to see 1 flake a day in NIPA before locally queuing this change, zero flakes since (over 9 days) Signed-off-by: Jakub Kicinski <kuba@kernel.org> Reviewed-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2026-10-13kselftest/filelock: plan for the five ofdlocks testsDanish Khateeb
ofdlocks reports five results but plans for four, so even when they all pass it ends with # Planned tests != run tests (4 != 5) and exits with KSFT_FAIL, which run_kselftest.sh reports as a failure. Link: https://lore.kernel.org/20260925205502.115327-1-danishkhateeb03@gmail.com Fixes: 33d5b13098fb ("kselftest/filelock: report each test in oftlocks separately") Signed-off-by: Danish Khateeb <danishkhateeb03@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Assisted-by: LLM Cc: Shuah Khan <shuah@kernel.org> Cc: Mark Brown <broonie@kernel.org> Cc: Jeff Layton <jlayton@kernel.org>
2026-10-13KVM: selftests: Enable hardware disable test PPC (without pSeries LPAR)Ritesh Harjani (IBM)
Enable the hardware disable test for PPC, but skip the test when running on pSeries LPAR. The test forks 512 children, each of which does KVM_CREATE_VM and then SIGKILLs without waiting. On a PAPR LPAR, that ioctl is H_GUEST_CREATE and unreaped guests may still occupy L0 Guest Management Space, which means create can fail with -ENOMEM error. Skip the test for now, as making it play nice with pSeries LPAR is non-trivial, while the test provides meaningful coverage for other flavors of PPC. Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com> Reviewed-by: Gautam Menghani <gautam@linux.ibm.com> Tested-by: Gautam Menghani <gautam@linux.ibm.com> Acked-by: Madhavan Srinivasan <maddy@linux.ibm.com> Link: https://patch.msgid.link/23f36aab5e9c849719ffeb796e1a74e69eb5d142.1791280439.git.ritesh.list@gmail.com [sean: massage changelog] Signed-off-by: Sean Christopherson <seanjc@google.com>
2026-10-13KVM: selftests: Enable access tracking perf test for PPC (with LPAR clause)Ritesh Harjani (IBM)
Enable the access tracking perf test for PPC, but skip the idle page count sanity check when running as a pSeries LPAR, which has the same nested TLB/access bit issue as x86. PowerPC nested KVM (pSeries LPAR) can hide accessed/idle, since KVM (L1) doesn't explicitly flush the TLB for access bit update, so L0 keeps translations cached. That also means that the L2 accesses do not refault and L1 thinks that the pages for L2 memory are still idle. Use kvm_is_ppc_pseries_lpar() check to detect when running nested on powerpc pseries LPAR and only warn on the idle-page count. Reported-by: Anushree Mathur <anushree.mathur@linux.ibm.com> Tested-by: Anushree Mathur <anushree.mathur@linux.ibm.com> Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com> Reviewed-by: Gautam Menghani <gautam@linux.ibm.com> Tested-by: Gautam Menghani <gautam@linux.ibm.com> Acked-by: Madhavan Srinivasan <maddy@linux.ibm.com> Link: https://patch.msgid.link/0227000da4e6fe69b278dc971b74b3f65b73ead9.1791280439.git.ritesh.list@gmail.com [sean: massage changelog] Signed-off-by: Sean Christopherson <seanjc@google.com>
2026-10-13KVM: PPC: selftests: add support for powerpcNicholas Piggin
Implement KVM selftests support for powerpc (Book3S-64). ucalls are implemented with an unsupported PAPR hcall number which will always cause KVM to exit to userspace. Virtual memory is implemented for the radix MMU, and only a base page size is supported (both 4K and 64K). Guest interrupts are taken in real-mode, so require a page allocated at gRA 0x0. Interrupt entry is complicated because gVA:gRA is not 1:1 mapped (like the kernel is), so the MMU can not just be switched on and off. This patch series also changes the following types as done in other selftests. These changes are squashed in this main patch as discussed here [1]: - Use u64 instead of uint64_t - Use s64 instead of int64_t - Use u32 instead of uint32_t - Use u8 instead of uint8_t - Replace u64 gpa, u64 gva|vaddr with gpa_t and gva_t - Adopt to the new page table allocator APIs - Start the guest at the entry point and not the descriptor in case of elfv1 [1]: https://lore.kernel.org/linuxppc-dev/cover.1781093720.git.ritesh.list@gmail.com/ [Rebased to latest mainline tree, "cc" to clobber list, fix the size calculation in kvm_arch_vm_post_create()] Co-developed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com> Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Link: https://lore.kernel.org/linuxppc-dev/cover.1781093720.git.ritesh.list@gmail.com/ Tested-by: Anushree Mathur <anushree.mathur@linux.ibm.com> Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com> Reviewed-by: Gautam Menghani <gautam@linux.ibm.com> Tested-by: Gautam Menghani <gautam@linux.ibm.com> Acked-by: Madhavan Srinivasan <maddy@linux.ibm.com> Link: https://patch.msgid.link/062570e96982a9a1a82e95c7ed0a3458321fd569.1791280439.git.ritesh.list@gmail.com Signed-off-by: Sean Christopherson <seanjc@google.com>
2026-10-13KVM: selftests: Skip kvm_create_max_vcpus on powerpc pseries LPARRitesh Harjani (IBM)
On a PAPR LPAR, KVM_CREATE_VCPU is H_GUEST_CREATE_VCPU and KVM_CAP_MAX_VCPUS is only the vcpuId range but is not a guarantee from L0 i.e. because L0 Guest Management Space can be exhausted before that many vCPUs exist, so creating MAX_VCPUS is not a valid assert. So, skip the test when powerpc is pseries LPAR (running nested i.e. ibm,hypertas-functions is present). Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com> Reviewed-by: Gautam Menghani <gautam@linux.ibm.com> Tested-by: Gautam Menghani <gautam@linux.ibm.com> Acked-by: Madhavan Srinivasan <maddy@linux.ibm.com> Link: https://patch.msgid.link/c8856b73b06bd4b44ff31e7454c8fc56dd402428.1791280439.git.ritesh.list@gmail.com Signed-off-by: Sean Christopherson <seanjc@google.com>
2026-10-13KVM: selftests: Add helper for checking if running on powerpc pseries LPARRitesh Harjani (IBM)
PowerPC's PAPR L0 does not guarantee H_GUEST_CREATE/H_GUEST_CREATE_VCPU hcalls to create upto MAX_VCPUS or hundreds of VMs, this is due to limited resouces at L0 for guest management space. This helper allows us to skip such tests which creates a lot of VMs/VCPUs, when we are running nested. Note that there is no easy way to differentiate between running nested on PowerNV v/s kvm-on-powervm case. So we use a common helper to detect any nested case. The helper is added to the common kvm_util header file to avoid sprinkling multiple #ifdef __powerpc64__ everywhere. Suggested-by: Sean Christopherson <seanjc@google.com> Tested-by: Anushree Mathur <anushree.mathur@linux.ibm.com> Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com> Reviewed-by: Gautam Menghani <gautam@linux.ibm.com> Tested-by: Gautam Menghani <gautam@linux.ibm.com> Acked-by: Madhavan Srinivasan <maddy@linux.ibm.com> Link: https://patch.msgid.link/294c0fcd19d6b00626e230985cf9906f98934d1c.1791280439.git.ritesh.list@gmail.com Signed-off-by: Sean Christopherson <seanjc@google.com>
2026-10-13KVM: selftests: Skip the max vCPU ID test when KVM_CAP_PPC_SMT is setRitesh Harjani (IBM)
kvm_create_max_vcpus creates vCPUs from 0..MAX_VCPUS-1, then again with ids at the top of KVM_CAP_MAX_VCPU_ID. On PowerPC the vCPU id is not a flat index: it encodes SMT thread plus core. So on powerpc maximum permitted vCPU ID depends on the VM's SMT mode and the maximum reported by KVM_CAP_MAX_VCPU_ID exceeds a simple non-SMT VM's limit. So, skip that second loop when KVM_CAP_PPC_SMT is non-zero. The cap is 0 on other arches, so they still run it. The 0..MAX_VCPUS pass is unchanged. Suggested-by: Sean Christopherson <seanjc@google.com> Tested-by: Anushree Mathur <anushree.mathur@linux.ibm.com> Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com> Reviewed-by: Gautam Menghani <gautam@linux.ibm.com> Tested-by: Gautam Menghani <gautam@linux.ibm.com> Acked-by: Madhavan Srinivasan <maddy@linux.ibm.com> Link: https://patch.msgid.link/bbfbaa9fb2eca8c92f59dc980546c2587dcfc130.1791280439.git.ritesh.list@gmail.com Signed-off-by: Sean Christopherson <seanjc@google.com>
2026-10-13KVM: selftests: Move memslot_perf_test off the 256M ELF load addressRitesh Harjani (IBM)
KVM selftests are built with -fno-PIE/-no-pie so the binary uses fixed load addresses. On powerpc64, GNU ld default links at 0x10000000 (256M) which is also the MEM_GPA, so the identity map trips with the error: PTE already present at level: 4 gva: 0x10000000 pte:0xc00000000002018f Put the test slots at 512M instead which is past the ELF. e.g. failure w/o this fix: ./memslot_perf_test -s 514 Random seed: 0x423558ef Testing map performance with 1 runs, 5 seconds each ==== Test Assertion Failure ==== lib/powerpc/processor.c:235: !pte pid=371 tid=371 errno=2 - No such file or directory 1 0x0000000010018293: virt_arch_pg_map at processor.c:235 2 0x0000000010008b3f: virt_pg_map at kvm_util.h:1325 3 (inlined by) virt_map at kvm_util.c:1571 4 0x0000000010001cab: prepare_vm at memslot_perf_test.c:353 5 (inlined by) test_execute at memslot_perf_test.c:816 6 (inlined by) test_loop at memslot_perf_test.c:1062 7 (inlined by) main at memslot_perf_test.c:1136 8 0x000000001001d713: __libc_start_call_main at libc-start.o:? 9 0x000000001001db47: __libc_start_main_impl at ??:? PTE already present at level: 4 gva: 0x10000000 pte:0xc00000000002018f Tested-by: Anushree Mathur <anushree.mathur@linux.ibm.com> Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com> Reviewed-by: Gautam Menghani <gautam@linux.ibm.com> Tested-by: Gautam Menghani <gautam@linux.ibm.com> Acked-by: Madhavan Srinivasan <maddy@linux.ibm.com> Link: https://patch.msgid.link/11b5712b213b7359bbf3bad32601e4373dac43bc.1791280439.git.ritesh.list@gmail.com Signed-off-by: Sean Christopherson <seanjc@google.com>
2026-10-13KVM: selftests: Don't limit LE dirty-bitmap bitops to s390xRitesh Harjani (IBM)
dirty_log_test already has BITOP_LE_SWIZZLE helpers, but they were compiled in only for s390x, so every other big-endian host used native test_bit(). The test fails on big-endian powerpc because it treated dirty host pages as clean (because of the endianness issue) w/o the fix the test fails with: Clear page 1 value (1) >= iteration (1) Fixes: a049a377164c ("KVM: selftests: Enable dirty_log_test on s390x") Tested-by: Anushree Mathur <anushree.mathur@linux.ibm.com> Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com> Reviewed-by: Gautam Menghani <gautam@linux.ibm.com> Tested-by: Gautam Menghani <gautam@linux.ibm.com> Acked-by: Madhavan Srinivasan <maddy@linux.ibm.com> Link: https://patch.msgid.link/63c900860b5f7e49cfa7258602e94b58b3de73b3.1791280439.git.ritesh.list@gmail.com Signed-off-by: Sean Christopherson <seanjc@google.com>
2026-10-13Merge branch 'for-7.4/cxl-dcd' into cxl-for-nextDave Jiang
Part 1 of DCD support. Functionality disabled. Documentation/cxl: Document DPA partition layout and ordering rules cxl/core: Enforce partition order/simplify partition calls cxl/mem: Configure dynamic capacity interrupts cxl/pci: Factor out interrupt policy check cxl/events: Split event msgnum configuration from irq setup cxl/cdat: Gather DSMAS data for DCD partitions cxl/mem: Read dynamic capacity configuration from the device cxl/mbox: Flag support for Dynamic Capacity Devices (DCD)
2026-10-13selftests/bpf: Enable CONFIG_DEBUG_INFO_BTF_INLINE for CIAlan Maguire
Ensure we add inline info to BTF for testing. Suggested-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Alan Maguire <alan.maguire@oracle.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://patch.msgid.link/20261012140640.2932195-4-alan.maguire@oracle.com
2026-10-13selftests/bpf: Fix btf_inline to use .text section as baseAlan Maguire
Relative addresses in LOCSEC are relative to the associated ELF section for the LOCSEC "inline<section>"; in the case of this test, it is ".text". Fix the test to compute the address via the section base rather than the overall module base address. Since addresses in BTF inline LOC_PARAMs can be module base-relative, do not remove the module base calcuation function. Fixes: 400f0881c912 ("selftests/bpf: Add a test verifying inline information") Signed-off-by: Alan Maguire <alan.maguire@oracle.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://patch.msgid.link/20261012140640.2932195-3-alan.maguire@oracle.com