summaryrefslogtreecommitdiff
path: root/tools/testing/selftests
AgeCommit message (Collapse)AuthorFilesLines
2026-03-27selftests: net: Remove unnecessary backslashes in fq_band_pktlimit.shYohei Kojima1-8/+8
Address "grep: warning: stray \ before white space" warning from GNU grep 3.12. This warns the misplaced backslashes before whitespaces (e.g. \\' ' or '\ ') which leads to unspecified behavior [1]. We can just remove the backslashes before whitespaces as POSIX says: Enclosing characters in single-quotes ('') shall preserve the literal value of each character within the single-quotes. and bourne-compatible shells behave so. [1]: https://lists.gnu.org/r/bug-gnulib/2022-05/msg00057.html Signed-off-by: Yohei Kojima <yk@y-koj.net> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/dd0bbd48cdf468da56ec34fd61cecd4d2111d7ba.1774372510.git.yk@y-koj.net Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-03-27selftests: add check for seg6 tunsrcJustin Iurman1-13/+96
Extend srv6_hencap_red_l3vpn_test.sh to include checks for the new "tunsrc" feature. If there is no support for tunsrc, it silently falls back to the encap config without tunsrc. Cc: Shuah Khan <shuah@kernel.org> Signed-off-by: Justin Iurman <justin.iurman@6wind.com> Reviewed-by: Andrea Mayer <andrea.mayer@uniroma2.it> Link: https://patch.msgid.link/20260324091434.359341-3-justin.iurman@6wind.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-03-27Revert "selftests/sched_ext: Add tests for SCX_ENQ_IMMED and ↵Tejun Heo7-601/+0
scx_bpf_dsq_reenq()" This reverts commit c50dcf533149. The tests are superficial, likely AI-generated slop, and flaky. They don't add actual value and just churn the selftests. Signed-off-by: Tejun Heo <tj@kernel.org>
2026-03-26selftests/bpf: Test kind encoding/decodingAlan Maguire1-0/+226
verify btf__new_empty_opts() adds layouts for all kinds supported, and after adding kind-related types for an unknown kind, ensure that parsing uses this info when that kind is encountered rather than giving up. Signed-off-by: Alan Maguire <alan.maguire@oracle.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20260326145444.2076244-9-alan.maguire@oracle.com
2026-03-26Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netJakub Kicinski13-8/+583
Cross-merge networking fixes after downstream PR (net-7.0-rc6). No conflicts, or adjacent changes. Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-03-26Merge tag 'landlock-7.0-rc6' of ↵Linus Torvalds1-1/+90
git://git.kernel.org/pub/scm/linux/kernel/git/mic/linux Pull Landlock fixes from Mickaël Salaün: "This mainly fixes Landlock TSYNC issues related to interrupts and unexpected task exit. Other fixes touch documentation and sample, and a new test extends coverage" * tag 'landlock-7.0-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/mic/linux: landlock: Expand restrict flags example for ABI version 8 selftests/landlock: Test tsync interruption and cancellation paths landlock: Clean up interrupted thread logic in TSYNC landlock: Serialize TSYNC thread restriction samples/landlock: Bump ABI version to 8 landlock: Improve TSYNC types landlock: Fully release unused TSYNC work entries landlock: Fix formatting
2026-03-26KVM: arm64: kselftest: set_id_regs: Add test for FEAT_LSUIYeoreum Yun1-0/+1
Add test coverage for FEAT_LSUI. Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com> Reviewed-by: Mark Brown <broonie@kernel.org> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2026-03-26Merge tag 'net-7.0-rc6' of ↵Linus Torvalds5-4/+171
git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net Pull networking fixes from Paolo Abeni: "Including fixes from Bluetooth, CAN, IPsec and Netfilter. Notably, this includes the fix for the Bluetooth regression that you were notified about. I'm not aware of any other pending regressions. Current release - regressions: - bluetooth: - fix stack-out-of-bounds read in l2cap_ecred_conn_req - fix regressions caused by reusing ident - netfilter: revisit array resize logic - eth: ice: set max queues in alloc_etherdev_mqs() Previous releases - regressions: - core: correctly handle tunneled traffic on IPV6_CSUM GSO fallback - bluetooth: - fix dangling pointer on mgmt_add_adv_patterns_monitor_complete - fix deadlock in l2cap_conn_del() - sched: codel: fix stale state for empty flows in fq_codel - ipv6: remove permanent routes from tb6_gc_hlist when all exceptions expire. - xfrm: fix skb_put() panic on non-linear skb during reassembly - openvswitch: - avoid releasing netdev before teardown completes - validate MPLS set/set_masked payload length - eth: iavf: fix out-of-bounds writes in iavf_get_ethtool_stats() Previous releases - always broken: - bluetooth: fix null-ptr-deref on l2cap_sock_ready_cb - udp: fix wildcard bind conflict check when using hash2 - netfilter: fix use of uninitialized rtp_addr in process_sdp - tls: Purge async_hold in tls_decrypt_async_wait() - xfrm: - prevent policy_hthresh.work from racing with netns teardown - fix skb leak with espintcp and async crypto - smc: fix double-free of smc_spd_priv when tee() duplicates splice pipe buffer - can: - add missing error handling to call can_ctrlmode_changelink() - fix OOB heap access in cgw_csum_crc8_rel() - eth: - mana: fix use-after-free in add_adev() error path - virtio-net: fix for VIRTIO_NET_F_GUEST_HDRLEN - bcmasp: fix double free of WoL irq" * tag 'net-7.0-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (90 commits) net: macb: use the current queue number for stats netfilter: ctnetlink: use netlink policy range checks netfilter: nf_conntrack_sip: fix use of uninitialized rtp_addr in process_sdp netfilter: nf_conntrack_expect: skip expectations in other netns via proc netfilter: nf_conntrack_expect: store netns and zone in expectation netfilter: ctnetlink: ensure safe access to master conntrack netfilter: nf_conntrack_expect: use expect->helper netfilter: nf_conntrack_expect: honor expectation helper field netfilter: nft_set_rbtree: revisit array resize logic netfilter: ip6t_rt: reject oversized addrnr in rt_mt6_check() netfilter: nfnetlink_log: fix uninitialized padding leak in NFULA_PAYLOAD tls: Purge async_hold in tls_decrypt_async_wait() selftests: netfilter: nft_concat_range.sh: add check for flush+reload bug netfilter: nft_set_pipapo_avx2: don't return non-matching entry on expiry Bluetooth: btusb: clamp SCO altsetting table indices Bluetooth: L2CAP: Fix ERTM re-init and zero pdu_len infinite loop Bluetooth: L2CAP: Fix deadlock in l2cap_conn_del() Bluetooth: btintel: serialize btintel_hw_error() with hci_req_sync_lock Bluetooth: L2CAP: Fix send LE flow credits in ACL link net: mana: fix use-after-free in add_adev() error path ...
2026-03-26RISC-V: KVM: selftests: Add RISC-V SBI STA shmem alignment testsJiakai Xu2-0/+33
Add RISC-V KVM selftests to verify the SBI Steal-Time Accounting (STA) shared memory alignment requirements. The SBI specification requires the STA shared memory GPA to be 64-byte aligned, or set to all-ones to explicitly disable steal-time accounting. This test verifies that KVM enforces the expected behavior when configuring the SBI STA shared memory via KVM_SET_ONE_REG. Specifically, the test checks that: - misaligned GPAs are rejected with -EINVAL - 64-byte aligned GPAs are accepted - all-ones GPA is accepted Signed-off-by: Jiakai Xu <xujiakai2025@iscas.ac.cn> Signed-off-by: Jiakai Xu <jiakaiPeanut@gmail.com> Reviewed-by: Andrew Jones <andrew.jones@oss.qualcomm.com> Link: https://lore.kernel.org/r/20260303010859.1763177-4-xujiakai2025@iscas.ac.cn Signed-off-by: Anup Patel <anup@brainfault.org>
2026-03-26KVM: selftests: Refactor UAPI tests into dedicated functionJiakai Xu1-16/+51
Move steal time UAPI tests from steal_time_init() into a separate check_steal_time_uapi() function for better code organization and maintainability. Previously, x86 and ARM64 architectures performed UAPI validation tests within steal_time_init(), mixing initialization logic with uapi tests. Changes by architecture: x86_64: - Extract MSR reserved bits test from steal_time_init() - Move to check_steal_time_uapi() which tests that setting MSR_KVM_STEAL_TIME with KVM_STEAL_RESERVED_MASK fails ARM64: - Extract three UAPI tests from steal_time_init(): Device attribute support check Misaligned IPA rejection (EINVAL) Duplicate IPA setting rejection (EEXIST) - Move all tests to check_steal_time_uapi() RISC-V: - Add empty check_steal_time_uapi() stub for future use - No changes to steal_time_init() (had no tests to extract) The new check_steal_time_uapi() function: - Is called once before the per-VCPU test loop No functional change intended. Suggested-by: Andrew Jones <andrew.jones@oss.qualcomm.com> Signed-off-by: Jiakai Xu <xujiakai2025@iscas.ac.cn> Signed-off-by: Jiakai Xu <jiakaiPeanut@gmail.com> Reviewed-by: Andrew Jones <andrew.jones@oss.qualcomm.com> Link: https://lore.kernel.org/r/20260303010859.1763177-3-xujiakai2025@iscas.ac.cn Signed-off-by: Anup Patel <anup@brainfault.org>
2026-03-25selftests: netfilter: nft_concat_range.sh: add check for flush+reload bugFlorian Westphal1-1/+69
This test will fail without the preceding commit ("netfilter: nft_set_pipapo_avx2: fix match retart if found element is expired"): reject overlapping range on add 0s [ OK ] reload with flush /dev/stdin:59:32-52: Error: Could not process rule: File exists add element inet filter test { 10.0.0.29 . 10.0.2.29 } Reviewed-by: Stefano Brivio <sbrivio@redhat.com> Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2026-03-25selftests/bpf: Make reg_bounds test more robustAlexei Starovoitov1-1/+17
The verifier log output may contain multiple lines that start with 18: (bf) r0 = r6 teach reg_bounds to look for lines that have ';' in them, since reg_bounds test is looking for: 18: (bf) r0 = r6 ; R0=... R6=... Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com> Link: https://lore.kernel.org/r/20260325012242.45606-1-alexei.starovoitov@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2026-03-25tcp: add cwnd_event_tx_start to tcp_congestion_opsEric Dumazet3-26/+31
(tcp_congestion_ops)->cwnd_event() is called very often, with @event oscillating between CA_EVENT_TX_START and other values. This is not branch prediction friendly. Provide a new cwnd_event_tx_start pointer dedicated for CA_EVENT_TX_START. Both BBR and CUBIC benefit from this change, since they only care about CA_EVENT_TX_START. No change in kernel size: $ scripts/bloat-o-meter -t vmlinux.0 vmlinux add/remove: 4/4 grow/shrink: 3/1 up/down: 564/-568 (-4) Function old new delta bbr_cwnd_event_tx_start - 450 +450 cubictcp_cwnd_event_tx_start - 70 +70 __pfx_cubictcp_cwnd_event_tx_start - 16 +16 __pfx_bbr_cwnd_event_tx_start - 16 +16 tcp_unregister_congestion_control 93 99 +6 tcp_update_congestion_control 518 521 +3 tcp_register_congestion_control 422 425 +3 __tcp_transmit_skb 3308 3306 -2 __pfx_cubictcp_cwnd_event 16 - -16 __pfx_bbr_cwnd_event 16 - -16 cubictcp_cwnd_event 80 - -80 bbr_cwnd_event 454 - -454 Total: Before=25240512, After=25240508, chg -0.00% Signed-off-by: Eric Dumazet <edumazet@google.com> Link: https://patch.msgid.link/20260323234920.1097858-1-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-03-25selftests: drv-net: add missing tc config options for netkit testsBobby Eshleman1-0/+2
The NetDrvContEnv env context uses tc clsact qdiscs and BPF tc filters for traffic redirection, but the kernel config options are missing from the selftests config. Without them, the tc qdisc installation trips on: CMD: tc qdisc add dev enp1s0 clsact EXIT: 2 STDERR: Error: Specified qdisc kind is unknown. net.lib.py.utils.CmdExitFailure: Command failed Add CONFIG_NET_CLS_ACT and CONFIG_NET_SCH_INGRESS to enable these tc options. Fixes: 3f74d5bb807e ("selftests/net: Add env for container based tests") Signed-off-by: Bobby Eshleman <bobbyeshleman@meta.com> Link: https://patch.msgid.link/20260323-config-fixes-for-nk-tests-v2-1-6c505d83e52d@meta.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-03-25Merge commit 'f35dbac6942171dc4ce9398d1d216a59224590a9' into ↵Steven Rostedt14-42/+331
trace/ring-buffer/core The commit f35dbac69421 ("ring-buffer: Fix to update per-subbuf entries of persistent ring buffer") was a fix and merged upstream. It is needed for some other work in the ring buffer. The current branch has the remote buffer code that is shared with the Arm64 subsystem and can't be rebased. Merge in the upstream commit to allow continuing of the ring buffer work. Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
2026-03-25selftests/bpf: Test variable length stack writeAlexei Starovoitov1-0/+41
Add a test to make sure that variable length stack writes scrubs STACK_SPILL into STACK_MISC. Tested-by: Eduard Zingerman <eddyz87@gmail.com> Acked-by: Kumar Kartikeya Dwivedi <memxor@gmail.com> Link: https://lore.kernel.org/r/20260324215938.81733-2-alexei.starovoitov@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2026-03-25selftests/futex: Bump up libnuma version checkDavidlohr Bueso2-2/+2
numa_set_mempolicy_home_node() was introduced in libnuma 2.0.18, not 2.0.16, via: https://github.com/numactl/numactl/commit/8f2ffc89654c Signed-off-by: Davidlohr Bueso <dave@stgolabs.net> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Link: https://patch.msgid.link/20260306182215.2088991-1-dave@stgolabs.net
2026-03-25selftests/futex: Conditionally include libnuma supportNylon Chen2-1/+6
Use LIBNUMA_TEST to conditionally add -lnuma to LDLIBS. Guard numa header includes with #ifdef LIBNUMA_VER_SUFFICIENT to allow compilation without libnuma installed. Co-developed-by: Zong Li <zong.li@sifive.com> Signed-off-by: Zong Li <zong.li@sifive.com> Signed-off-by: Nylon Chen <nylon.chen@sifive.com> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Link: https://patch.msgid.link/20260301-20260128_nylon_chen_sifive_com-v3-1-995ab4cc71aa@sifive.com
2026-03-25selftests/bpf: verify_pkcs7_sig: Use 'struct module_signature' from the UAPI ↵Thomas Weißschuh1-25/+3
headers Now that the UAPI headers provide the required definitions, use those. Some symbols have been renamed, adapt to those. Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Reviewed-by: Petr Pavlu <petr.pavlu@suse.com> Reviewed-by: Nicolas Schier <nsc@kernel.org> Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
2026-03-25sign-file: use 'struct module_signature' from the UAPI headersThomas Weißschuh1-0/+1
Now that the UAPI headers provide the required definitions, use those. Some symbols have been renamed, adapt to those. Also adapt the include path for the custom sign-file rule in the bpf selftests. Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Reviewed-by: Petr Pavlu <petr.pavlu@suse.com> Reviewed-by: Nicolas Schier <nsc@kernel.org> Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
2026-03-24selftests/bpf: move trampoline_count to dedicated bpf_testmod targetSun Jian3-20/+27
trampoline_count fills all trampoline attachment slots for a single target function and verifies that one extra attach fails with -E2BIG. It currently targets bpf_modify_return_test, which is also used by other selftests such as modify_return, get_func_ip_test, and get_func_args_test. When such tests run in parallel, they can contend for the same per-function trampoline quota and cause unexpected attach failures. This issue is currently masked by harness serialization. Move trampoline_count to a dedicated bpf_testmod target and register it for fmod_ret attachment. Also route the final trigger through trigger_module_test_read(), so the execution path exercises the same dedicated target. This keeps the test semantics unchanged while isolating it from other selftests, so it no longer needs to run in serial mode. Remove the TODO comment as well. Tested: ./test_progs -t trampoline_count -vv ./test_progs -j$(nproc) -t trampoline_count -vv ./test_progs -j$(nproc) -t \ trampoline_count,modify_return,get_func_ip_test,get_func_args_test -vv 20 runs of: ./test_progs -j$(nproc) -t \ trampoline_count,modify_return,get_func_ip_test,get_func_args_test Signed-off-by: Sun Jian <sun.jian.kdev@gmail.com> Acked-by: Jiri Olsa <jolsa@kernel.org> Link: https://lore.kernel.org/r/20260324044949.869801-1-sun.jian.kdev@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2026-03-24selftests/bpf: Fix sockmap_multi_channels reliabilityJiayuan Chen1-2/+15
Previously I added a FIONREAD test for sockmap, but it can occasionally fail in CI [1]. The test sends 10 bytes in two segments (2 + 8). For UDP, FIONREAD only reports the length of the first datagram, not the total queued data. The original code used recv_timeout() expecting all 10 bytes, but under high system load, the second datagram may not yet be processed by the protocol stack, so recv would only return the first 2-byte datagram, causing a size mismatch failure. Fix this by receiving exactly the expected bytes (matching FIONREAD) in the first recv. The remaining datagram is then consumed in a second recv block, which is only reachable for UDP since TCP's expected already equals sizeof(buf). Test: ./test_progs -a sockmap_basic 410/1 sockmap_basic/sockmap create_update_free:OK ... Summary: 1/35 PASSED, 0 SKIPPED, 0 FAILED [1] https://github.com/kernel-patches/bpf/actions/runs/22919385910/job/66515395423 Cc: Jiayuan Chen <jiayuan.chen@linux.dev> Fixes: 17e2ce02bf56 ("selftests/bpf: Add tests for FIONREAD and copied_seq") Signed-off-by: Jiayuan Chen <jiayuan.chen@shopee.com> Link: https://lore.kernel.org/r/20260312072549.6766-1-jiayuan.chen@linux.dev Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2026-03-24selftests/bpf: Improve tc_tunnel test reliabilityJiayuan Chen1-1/+1
A test failure was discovered in BPF CI [1] caused by connection timeout. The current test timeout of 500ms is insufficient for CI environments, particularly under high load. While the optimal timeout is unclear, this test was converted from the original test_tc_tunnel.sh script. The original script used nc with "-w 1" to specify a 1-second timeout [2]. Therefore, this test restores the timeout to 1s. Test: ./test_progs -a tc_tunnel #478/1 tc_tunnel/ipip_none:OK #478/2 tc_tunnel/ipip6_none:OK #478/3 tc_tunnel/ip6tnl_none:OK #478/4 tc_tunnel/sit_none:OK #478/5 tc_tunnel/vxlan_eth:OK #478/6 tc_tunnel/ip6vxlan_eth:OK #478/7 tc_tunnel/gre_none:OK #478/8 tc_tunnel/gre_eth:OK #478/9 tc_tunnel/gre_mpls:OK #478/10 tc_tunnel/ip6gre_none:OK #478/11 tc_tunnel/ip6gre_eth:OK #478/12 tc_tunnel/ip6gre_mpls:OK #478/13 tc_tunnel/udp_none:OK #478/14 tc_tunnel/udp_eth:OK #478/15 tc_tunnel/udp_mpls:OK #478/16 tc_tunnel/ip6udp_none:OK #478/17 tc_tunnel/ip6udp_eth:OK #478/18 tc_tunnel/ip6udp_mpls:OK #478 tc_tunnel:OK Summary: 1/18 PASSED, 0 SKIPPED, 0 FAILED [1] https://github.com/kernel-patches/bpf/actions/runs/22674350732/job/65728072723 [2] https://lore.kernel.org/all/20251027-tc_tunnel-v3-4-505c12019f9d@bootlin.com/ Cc: Jiayuan Chen <jiayuan.chen@linux.dev> Signed-off-by: Jiayuan Chen <jiayuan.chen@shopee.com> Link: https://lore.kernel.org/r/20260312083615.31835-1-jiayuan.chen@linux.dev Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2026-03-24selftests/bpf: Add trampolines single and multi-level pointer params test ↵Slava Imameev2-0/+70
coverage Add single and multi-level pointer parameters and return value test coverage for BPF trampolines. Includes verifier tests for single and multi-level pointers. The tests check verifier logs for pointers inferred as scalar() type. Signed-off-by: Slava Imameev <slava.imameev@crowdstrike.com> Acked-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20260314082127.7939-3-slava.imameev@crowdstrike.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2026-03-24selftests/sched_ext: Skip rt_stall on older kernels and list skipped testsCheng-Yang Chou2-1/+12
rt_stall tests the ext DL server which was introduced in commit cd959a356205 ("sched_ext: Add a DL server for sched_ext tasks"). On older kernels that lack this feature, the test calls ksft_exit_fail() internally which terminates the entire runner process, preventing subsequent tests from running. Add a guard in setup() that checks for the ext_server field in struct rq via __COMPAT_struct_has_field() and returns SCX_TEST_SKIP if not present. Also print the names of skipped tests in the results summary, mirroring the existing behavior for failed tests. Signed-off-by: Cheng-Yang Chou <yphbchou0911@gmail.com> Signed-off-by: Tejun Heo <tj@kernel.org>
2026-03-24selftests/cgroup: Don't require synchronous populated update on task exitTejun Heo4-4/+23
test_cgcore_populated (test_core) and test_cgkill_{simple,tree,forkbomb} (test_kill) check cgroup.events "populated 0" immediately after reaping child tasks with waitpid(). This used to work because cgroup_task_exit() in do_exit() unlinked tasks from css_sets before exit_notify() woke up waitpid(). d245698d727a ("cgroup: Defer task cgroup unlink until after the task is done switching out") moved the unlink to cgroup_task_dead() in finish_task_switch(), which runs after exit_notify(). The populated counter is now decremented after the parent's waitpid() can return, so there is no longer a synchronous ordering guarantee. On PREEMPT_RT, where cgroup_task_dead() is further deferred through lazy irq_work, the race window is even larger. The synchronous populated transition was never part of the cgroup interface contract - it was an implementation artifact. Use cg_read_strcmp_wait() which retries for up to 1 second, matching what these tests actually need to verify: that the cgroup eventually becomes unpopulated after all tasks exit. Fixes: d245698d727a ("cgroup: Defer task cgroup unlink until after the task is done switching out") Reported-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Tejun Heo <tj@kernel.org> Tested-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Cc: Christian Brauner <brauner@kernel.org> Cc: cgroups@vger.kernel.org
2026-03-24selftests/bpf: Test 32-bit scalar spill pruning in stacksafe()Alexei Starovoitov1-0/+37
Add a test verifying that stacksafe() correctly handles 32-bit scalar spills when comparing stack states for equivalence during state pruning. A 32-bit scalar spill creates slot[0-3] = STACK_INVALID and slot[4-7] = STACK_SPILL. Without the im=4 check in stacksafe(), the STACK_SPILL vs STACK_MISC mismatch at byte 4 causes pruning to fail, forcing the verifier to re-explore a path that is provably safe. Acked-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20260323022410.75444-2-alexei.starovoitov@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2026-03-24Merge tag 'kvm-s390-master-7.0-1' of ↵Paolo Bonzini2-0/+76
git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux into HEAD KVM: s390: Fixes for 7.0 - fix deadlock in new memory management - handle kernel faults on donated memory properly - fix bounds checking for irq routing + selftest - fix invalid machine checks + logging
2026-03-24selftests/bpf: Add test for struct_ops __ref argument in any positionVarun R Mallya4-0/+54
Add a selftest to verify that the verifier correctly identifies refcounted arguments in struct_ops programs, even when they are not the first argument. This ensures that the restriction on tail calls for programs with __ref arguments is properly enforced regardless of which argument they appear in. This test verifies the fix for check_struct_ops_btf_id() proposed by Keisuke Nishimura [0], which corrected a bug where only the first argument was checked for the refcounted flag. The test includes: - An update to bpf_testmod to add 'test_refcounted_multi', an operator with three arguments where the third is tagged with "__ref". - A BPF program 'test_refcounted_multi' that attempts a tail call. - A test runner that asserts the verifier rejects the program with "program with __ref argument cannot tail call". [0]: https://lore.kernel.org/bpf/20260320130219.63711-1-keisuke.nishimura@inria.fr/ Signed-off-by: Varun R Mallya <varunrmallya@gmail.com> Link: https://lore.kernel.org/r/20260321214038.80479-1-varunrmallya@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2026-03-24selftests/bpf: Fix compiler warnings in task_local_data.hAmery Hung1-2/+3
Fix compiler warnings about unused parameter, narrowing non-constant into a smaller type and comparison between integers of different size. Signed-off-by: Amery Hung <ameryhung@gmail.com> Acked-by: Kumar Kartikeya Dwivedi <memxor@gmail.com> Link: https://lore.kernel.org/r/20260323231133.859941-1-ameryhung@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2026-03-24selftests: team: add non-Ethernet header_ops reproducerJiayuan Chen3-0/+44
Add a team selftest that sets up: g0 (gre) -> b0 (bond) -> t0 (team) and triggers IPv6 traffic on t0. This reproduces the non-Ethernet header_ops confusion scenario and protects against regressions in stacked team/bond/gre configurations. Using this script, the panic reported by syzkaller can be reproduced [1]. After the fix: # ./non_ether_header_ops.sh PASS: non-Ethernet header_ops stacking did not crash [1] https://syzkaller.appspot.com/bug?extid=3d8bc31c45e11450f24c Cc: Jiayuan Chen <jiayuan.chen@linux.dev> Signed-off-by: Jiayuan Chen <jiayuan.chen@shopee.com> Link: https://patch.msgid.link/20260320072139.134249-3-jiayuan.chen@linux.dev Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-03-24selftests: net: io_uring_zerocopy: enable io_uring for the testAleksei Oladko1-0/+9
The io_uring_zerocopy.sh kselftest assumes that io_uring support is enabled on the host system. When io_uring is disabled via the kernel.io_uring_disabled sysctl, the test fails. Explicitly enable io_uring for the test by setting kernel.io_uring_disabled=0. Save the original value of kernel.io_uring_disabled before changing it and restore it in cleanup handler to ensure the system state is restored regardless of test outcome. Signed-off-by: Aleksei Oladko <aleksey.oladko@virtuozzo.com> Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com> Link: https://patch.msgid.link/20260321215908.175465-5-aleksey.oladko@virtuozzo.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-03-24selftests: net: run reuseport in an isolated netnsAleksei Oladko4-0/+42
The reuseport_* tests (bpf, bpf_cpu, bpf_numa, dualstack) currently use a fixed port range. This can cause intermittent test failures when the ports are already in use by other services: failed to bind receive socket: Address already in use To avoid conflicts, run these tests in separate network namespaces using unshare. Each test now has its own isolated network stack, preventing port collisions with the host services. Signed-off-by: Aleksei Oladko <aleksey.oladko@virtuozzo.com> Link: https://patch.msgid.link/20260321215908.175465-2-aleksey.oladko@virtuozzo.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-03-24selftests: rds: Add -c config option to rds/config.shAllison Henderson2-16/+26
This patch adds a new -c flag to config.sh that enables callers to specify the file path of the config they would like to update. If no config is specified, the default will be the .config of the current directory. Signed-off-by: Allison Henderson <achender@kernel.org> Link: https://patch.msgid.link/20260320041834.2761069-3-achender@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-03-24selftests: rds: add tools/testing/selftests/net/rds/configAllison Henderson1-0/+5
The ksft CI runtime needs an rds specific config file to build a minimal kernel with the right options enabled. This patch adds an rds selftest config containing the required CONFIG_RDS* and CONFIG_NET_* options. Signed-off-by: Allison Henderson <achender@kernel.org> Link: https://patch.msgid.link/20260320041834.2761069-2-achender@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-03-24selftests: bonding: add test for stacked bond header_parse recursionJiayuan Chen3-0/+74
Add a selftest to reproduce the infinite recursion in bond_header_parse() when bonds are stacked (bond1 -> bond0 -> gre). When a packet is received via AF_PACKET SOCK_DGRAM on the topmost bond, dev_parse_header() calls bond_header_parse() which used skb->dev (always the topmost bond) to get the bonding struct. This caused it to recurse back into itself indefinitely, leading to stack overflow. Before commit b7405dcf7385 ("bonding: prevent potential infinite loop in bond_header_parse()"), the test triggers: ./bond_stacked_header_parse.sh [ 71.999481] BUG: MAX_LOCK_DEPTH too low! [ 72.000170] turning off the locking correctness validator. [ 72.001029] Please attach the output of /proc/lock_stat to the bug report [ 72.002079] depth: 48 max: 48! ... After the fix, everything works fine: ./bond_stacked_header_parse.sh TEST: Stacked bond header_parse does not recurse [ OK ] Signed-off-by: Jiayuan Chen <jiayuan.chen@shopee.com> Link: https://patch.msgid.link/20260320022245.392384-1-jiayuan.chen@linux.dev Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-03-24selftests: forwarding: local_termination: fix PTP UDP cksumsDaniel Golle1-6/+6
All six PTP-over-IP test frames (3x IPv4 + 3x IPv6) contain incorrect UDP checksums. The stored values are the ones-complement sums of just the pseudo-headers, not the complete UDP checksums over pseudo-header + UDP header + payload. This is characteristic of frames captured on the sender before TX checksum offload completion. For example, the IPv4 Sync and Follow-Up frames both store checksum 0xa3c8 despite having different UDP payloads and port numbers - 0xa3c8 is their shared pseudo-header sum (same src/dst IP, same protocol and UDP length). While most L2 switches forward frames without verifying transport checksums, hardware that performs deep packet inspection or has PTP awareness may validate UDP checksums and drop frames that fail verification. This causes the 1588v2 over IPv4/IPv6 tests to fail on such hardware even though L2 PTP (which has no UDP checksum) passes fine. Replace all six pseudo-header partial sums with the correctly computed full UDP checksums: IPv4 Sync: 0xa3c8 -> 0x9f41 IPv4 Follow-Up: 0xa3c8 -> 0xeb8a IPv4 Peer Delay Req: 0xa2bc -> 0x9ab9 IPv6 Sync: 0x2e92 -> 0x1476 IPv6 Follow-Up: 0x2e92 -> 0xf047 IPv6 Peer Delay Req: 0xb454 -> 0x891f Signed-off-by: Daniel Golle <daniel@makrotopia.org> Reviewed-by: Alexander Sverdlin <alexander.sverdlin@gmail.com> Link: https://patch.msgid.link/651c3decb80023e4395ec149fd81110afa3869a1.1774067006.git.daniel@makrotopia.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-03-24selftests: rss_drv: Add RSS indirection table resize testsBjörn Töpel1-4/+229
Add resize tests to rss_drv.py. Devices without dynamic table sizing are skipped via _require_dynamic_indir_size(). resize_periodic: set a periodic 4-entry table, shrink channels to fold, grow back to unfold. Check the exact pattern is preserved. Has main and non-default context variants. resize_below_user_size_reject: send a periodic table with user_size between the big and small device table sizes. Verify that shrinking below user_size is rejected even though the table is periodic. Has main and non-default context variants. resize_nonperiodic_reject: set a non-periodic table (equal N), verify that channel reduction is rejected. resize_nonperiodic_no_corruption: verify a failed resize leaves both the indirection table contents and the channel count unchanged. Signed-off-by: Björn Töpel <bjorn@kernel.org> Link: https://patch.msgid.link/20260320085826.1957255-5-bjorn@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-03-24selftest: net: Add GC test for temporary routes with exceptions.Kuniyuki Iwashima1-3/+58
Without the prior commit, IPv6 GC cannot track exceptions tied to permanent routes if they were originally added as temporary routes. Let's add a test case for the issue. 1. Add temporary routes 2. Create exceptions for the temporary routes 3. Promote the routes to permanent routes 4. Check if GC can find and purge the exceptions A few notes: + At step 4, unlike other test cases, we cannot wait for $GC_WAIT_TIME. While the exceptions are always iterable via netlink (since it traverses the entire fib tree instead of tb6_gc_hlist), rt6_nh_dump_exceptions() skips expired entries. If we waited for the expiration time, we would be unable to distinguish whether the exceptions were truly purged by GC or just hidden due to being expired. + For the same reason, at step 2, we use ICMPv6 redirect message instead of Packet Too Big message. This is because MTU exceptions always have RTF_EXPIRES, and rt6_age_examine_exception() does not respect the period specified by net.ipv6.route.flush=1. + We add a neighbour entry for the redirect target with NTF_ROUTER. Without this, the exceptions would be removed at step 3 when the fib6_may_remove_gc_list() is called. Without the fix, the exceptions remain even after GC is triggered by sysctl -wq net.ipv6.route.flush=1. FAIL: Expected 0 routes, got 5 TEST: ipv6 route garbage collection (promote to permanent routes) [FAIL] With the fix, GC purges the exceptions properly. TEST: ipv6 route garbage collection (promote to permanent routes) [ OK ] Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com> Reviewed-by: David Ahern <dsahern@kernel.org> Link: https://patch.msgid.link/20260320072317.2561779-4-kuniyu@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-03-23selftests/bpf: Improve connect_force_port test reliabilityVarun R Mallya3-12/+34
The connect_force_port test fails intermittently in CI because the hardcoded server ports (60123/60124) may already be in use by other tests or processes [1]. Fix this by passing port 0 to start_server(), letting the kernel assign a free port dynamically. The actual assigned port is then propagated to the BPF programs by writing it into the .bss map's initial value (via bpf_map__initial_value()) before loading, so the BPF programs use the correct backend port at runtime. [1] https://github.com/kernel-patches/bpf/actions/runs/22697676317/job/65808536038 Suggested-by: Jiayuan Chen <jiayuan.chen@linux.dev> Signed-off-by: Varun R Mallya <varunrmallya@gmail.com> Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org> Reviewed-by: Sun Jian <sun.jian.kdev@gmail.com> Reviewed-by: Jiayuan Chen <jiayuan.chen@linux.dev> Link: https://patch.msgid.link/20260323081131.65604-1-varunrmallya@gmail.com
2026-03-23selftests: check pidfd_info->coredump_code correctnessEmanuele Rocca5-2/+66
Extend the coredump_socket and coredump_socket_protocol selftests to verify that the field coredump_code is set as expected in struct pidfd_info. Signed-off-by: Emanuele Rocca <emanuele.rocca@arm.com> Link: https://patch.msgid.link/acE6Eyuv2MM75pmk@NH27D9T0LF Signed-off-by: Christian Brauner <brauner@kernel.org>
2026-03-23kselftest/coredump: reintroduce null pointer dereferenceEmanuele Rocca1-1/+1
Commit 673a55cc49da replaced the null pointer dereference used in crashing_child() with __builtin_trap to address the following LLVM warnings: coredump_test_helpers.c:59:6: warning: indirection of non-volatile null pointer will be deleted, not trap [-Wnull-dereference] coredump_test_helpers.c:59:6: note: consider using __builtin_trap() or qualifying pointer with 'volatile' All coredump tests expect crashing_child() to result in a SIGSEGV. However, the behavior of __builtin_trap is architecture-dependent. On x86 it yields SIGILL, on aarch64 SIGTRAP. Given that neither of those signals are SIGSEGV, both coredump_socket_test and coredump_socket_protocol_test are currently failing: get_pidfd_info: mask=0xd7, coredump_mask=0x5, coredump_signal=5 socket_coredump_signal_sigsegv: coredump_signal=5, expected SIGSEGV=11 Qualify the pointer with volatile instead of calling __builtin_trap to fix the tests. Signed-off-by: Emanuele Rocca <emanuele.rocca@arm.com> Link: https://patch.msgid.link/ab2kI0PI_Vk6bU88@NH27D9T0LF Reviewed-by: Mark Brown <broonie@kernel.org> Signed-off-by: Christian Brauner <brauner@kernel.org>
2026-03-23Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf 7.0-rc5Alexei Starovoitov21-47/+680
Cross-merge BPF and other fixes after downstream PR. Minor conflicts in: tools/testing/selftests/bpf/progs/exceptions_fail.c tools/testing/selftests/bpf/progs/verifier_bounds.c Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2026-03-23selftests/sched_ext: Add tests for SCX_ENQ_IMMED and scx_bpf_dsq_reenq()zhidao su7-0/+601
Add three selftests covering features introduced in v7.1: - dsq_reenq: Verify scx_bpf_dsq_reenq() on user DSQs triggers ops.enqueue() with SCX_ENQ_REENQ and SCX_TASK_REENQ_KFUNC in p->scx.flags. - enq_immed: Verify SCX_OPS_ALWAYS_ENQ_IMMED slow path where tasks dispatched to a busy CPU's local DSQ are re-enqueued through ops.enqueue() with SCX_TASK_REENQ_IMMED. - consume_immed: Verify SCX_ENQ_IMMED via the consume path using scx_bpf_dsq_move_to_local___v2() with explicit SCX_ENQ_IMMED. All three tests skip gracefully on kernels that predate the required features by checking availability via __COMPAT_has_ksym() / __COMPAT_read_enum() before loading. Signed-off-by: zhidao su <suzhidao@xiaomi.com> Signed-off-by: Tejun Heo <tj@kernel.org>
2026-03-23Merge tag 'v7.0-rc5' into driver-core-nextDanilo Krummrich7-4/+348
We need the driver-core fixes in here as well to build on top of. Signed-off-by: Danilo Krummrich <dakr@kernel.org>
2026-03-22Merge tag 'bpf-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpfLinus Torvalds6-4/+336
Pull bpf fixes from Alexei Starovoitov: - Fix how linked registers track zero extension of subregisters (Daniel Borkmann) - Fix unsound scalar fork for OR instructions (Daniel Wade) - Fix exception exit lock check for subprogs (Ihor Solodrai) - Fix undefined behavior in interpreter for SDIV/SMOD instructions (Jenny Guanni Qu) - Release module's BTF when module is unloaded (Kumar Kartikeya Dwivedi) - Fix constant blinding for PROBE_MEM32 instructions (Sachin Kumar) - Reset register ID for END instructions to prevent incorrect value tracking (Yazhou Tang) * tag 'bpf-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf: selftests/bpf: Add a test cases for sync_linked_regs regarding zext propagation bpf: Fix sync_linked_regs regarding BPF_ADD_CONST32 zext propagation selftests/bpf: Add tests for maybe_fork_scalars() OR vs AND handling bpf: Fix unsound scalar forking in maybe_fork_scalars() for BPF_OR selftests/bpf: Add tests for sdiv32/smod32 with INT_MIN dividend bpf: Fix undefined behavior in interpreter sdiv/smod for INT_MIN selftests/bpf: Add tests for bpf_throw lock leak from subprogs bpf: Fix exception exit lock checking for subprogs bpf: Release module BTF IDR before module unload selftests/bpf: Fix pkg-config call on static builds bpf: Fix constant blinding for PROBE_MEM32 stores selftests/bpf: Add test for BPF_END register ID reset bpf: Reset register ID for BPF_END value tracking
2026-03-22selftests/nolibc: enable -WundefThomas Weißschuh1-1/+2
Users might use -Wundef, so also use it in the nolibc testsuite to ensure no warnings are triggered. The existing line with warning options is getting too long, so move all warnings to a dedicated line. Acked-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Link: https://patch.msgid.link/20260318-nolibc-wundef-v1-2-fcb7f9ac7298@weissschuh.net
2026-03-22tools/nolibc: add support for program_invocation_{,short_}nameThomas Weißschuh1-0/+34
Add support for the GNU extensions 'program_invocation_name' and 'program_invocation_short_name'. These are useful to print error messages, which by convention include the program name. As these are global variables which take up memory even if not used, similar to 'errno', gate them behind NOLIBC_IGNORE_ERRNO. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://patch.msgid.link/20260318-nolibc-err-h-v4-1-08247a694bd9@weissschuh.net
2026-03-21selftests/bpf: Add a test cases for sync_linked_regs regarding zext propagationDaniel Borkmann1-0/+108
Add multiple test cases for linked register tracking with alu32 ops: - Add a test that checks sync_linked_regs() regarding reg->id (the linked target register) for BPF_ADD_CONST32 rather than known_reg->id (the branch register). - Add a test case for linked register tracking that exposes the cross-type sync_linked_regs() bug. One register uses alu32 (w7 += 1, BPF_ADD_CONST32) and another uses alu64 (r8 += 2, BPF_ADD_CONST64), both linked to the same base register. - Add a test case that exercises regsafe() path pruning when two execution paths reach the same program point with linked registers carrying different ADD_CONST flags (BPF_ADD_CONST32 from alu32 vs BPF_ADD_CONST64 from alu64). This particular test passes with and without the fix since the pruning will fail due to different ranges, but it would still be useful to carry this one as a regression test for the unreachable div by zero. With the fix applied all the tests pass: # LDLIBS=-static PKG_CONFIG='pkg-config --static' ./vmtest.sh -- ./test_progs -t verifier_linked_scalars [...] ./test_progs -t verifier_linked_scalars #602/1 verifier_linked_scalars/scalars: find linked scalars:OK #602/2 verifier_linked_scalars/sync_linked_regs_preserves_id:OK #602/3 verifier_linked_scalars/scalars_neg:OK #602/4 verifier_linked_scalars/scalars_neg_sub:OK #602/5 verifier_linked_scalars/scalars_neg_alu32_add:OK #602/6 verifier_linked_scalars/scalars_neg_alu32_sub:OK #602/7 verifier_linked_scalars/scalars_pos:OK #602/8 verifier_linked_scalars/scalars_sub_neg_imm:OK #602/9 verifier_linked_scalars/scalars_double_add:OK #602/10 verifier_linked_scalars/scalars_sync_delta_overflow:OK #602/11 verifier_linked_scalars/scalars_sync_delta_overflow_large_range:OK #602/12 verifier_linked_scalars/scalars_alu32_big_offset:OK #602/13 verifier_linked_scalars/scalars_alu32_basic:OK #602/14 verifier_linked_scalars/scalars_alu32_wrap:OK #602/15 verifier_linked_scalars/scalars_alu32_zext_linked_reg:OK #602/16 verifier_linked_scalars/scalars_alu32_alu64_cross_type:OK #602/17 verifier_linked_scalars/scalars_alu32_alu64_regsafe_pruning:OK #602/18 verifier_linked_scalars/alu32_negative_offset:OK #602/19 verifier_linked_scalars/spurious_precision_marks:OK #602 verifier_linked_scalars:OK Summary: 1/19 PASSED, 0 SKIPPED, 0 FAILED Co-developed-by: Puranjay Mohan <puranjay@kernel.org> Signed-off-by: Puranjay Mohan <puranjay@kernel.org> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20260319211507.213816-2-daniel@iogearbox.net Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2026-03-21selftests/bpf: Test bpf_program__clone() attach_btf_id overrideMykyta Yatsenko2-0/+91
Add a test that verifies bpf_program__clone() respects caller-provided attach_btf_id in bpf_prog_load_opts. The BPF program has SEC("fentry/bpf_fentry_test1"). It is cloned twice from the same prepared object: first with no opts, verifying the callback resolves attach_btf_id from sec_name to bpf_fentry_test1; then with attach_btf_id overridden to bpf_fentry_test2, verifying the loaded program is actually attached to bpf_fentry_test2. Both results are checked via bpf_prog_get_info_by_fd(). Signed-off-by: Mykyta Yatsenko <yatsenko@meta.com> Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com> Link: https://lore.kernel.org/r/20260317-veristat_prepare-v4-3-74193d4cc9d9@meta.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>