summaryrefslogtreecommitdiff
path: root/tools/testing
AgeCommit message (Collapse)Author
2026-05-21Merge tag 'net-7.1-rc5' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net Pull networking fixes from Jakub Kicinski: "Including fixes from Bluetooth, wireless and netfilter. Craziness continues with no end in sight. Even discounting the driver revert this is a pretty huge PR for standards of the previous era. I'd speculate - we haven't seen the worst of it, yet. Good news, I guess, is that so far we haven't seen many (any?) cases of "AI reported a bug, we fixed it and a real user regressed". Current release - fix to a fix: - Bluetooth: btmtk: accept too short WMT FUNC_CTRL events - vsock/virtio: relax the recently added memory limit a little Current release - regressions: - IB/IPoIB: make sure IB drivers always use async set_rx_mode since some (mlx5) are now required to use it due to locking changes Previous releases - regressions: - udp: fix UDP length on last GSO_PARTIAL segment - af_unix: fix UAF read of tail->len in unix_stream_data_wait() - tcp: fix stale per-CPU tcp_tw_isn leak enabling ISN prediction - mlx5e: fix unlocked writing to ICOSQ, breaking AF_XDP Previous releases - always broken: - tap: fix stack info leak in tap_ioctl() SIOCGIFHWADDR - ipv4: raw: reject IP_HDRINCL packets with ihl < 5 - Bluetooth: a lot of locking and concurrency fixes (as always) - batman-adv (mesh wireless networking): a lot of random fixes for issues reported by security researchers and Sashiko - netfilter: same thing, a lot of small security-ish fixes all over the place, nothing really stands out Misc: - bring back the old 3c509 driver, Maciej wants to maintain it" * tag 'net-7.1-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (187 commits) net: enetc: avoid VF->PF mailbox timeout during SR-IOV teardown net: enetc: fix init and teardown order to prevent use of unsafe resources net: enetc: fix unbounded loop and interrupt handling in VF-to-PF messaging net: enetc: fix DMA write to freed memory in enetc_msg_free_mbx() net: enetc: fix race condition in VF MAC address configuration net: enetc: fix TOCTOU race and validate VF MAC address net: enetc: add ratelimiting to VF mailbox error messages net: enetc: fix missing error code when pf->vf_state allocation fails net: enetc: fix incorrect mailbox message status returned to VFs net: bridge: prevent too big nested attributes in br_fill_linkxstats() l2tp: use list_del_rcu in l2tp_session_unhash net: bcmgenet: keep RBUF EEE/PM disabled ethernet: 3c509: Fix most coding style issues ethernet: 3c509: Update documentation to match MAINTAINERS ethernet: 3c509: Add GPL 2.0 SPDX license identifier ethernet: 3c509: Fix AUI transceiver type selection Revert "drivers: net: 3com: 3c509: Remove this driver" tools: ynl: support listening on all nsids net: gro: don't merge zcopy skbs pds_core: ensure null-termination for firmware version strings ...
2026-05-21selftests/landlock: Increase default audit socket timeoutMickaël Salaün
matches_log_fs() and other audit_match_record() callers intermittently return -EAGAIN under heavy debug configs (KASAN, lockdep). The audit record delivery pipeline is asynchronous: landlock_log_denial() queues the record to audit_queue, and kauditd_thread dequeues and delivers via netlink. Under debug configs, kauditd scheduling between audit_log_end() and netlink_unicast() can exceed a syscall round trip (more than 1 usec), which was the value of the socket timeout used for the recvfrom() calls. The observed failure [1] is an EAGAIN error code (-11) which means that the access record had not arrived within the 1 usec timeout of recvfrom(). The expected record does arrive, but only after matches_log_fs() has already returned. It is then consumed by a later audit_count_records() call, making records.access == 1 instead of 0. Switch the default socket timeout to the slow value (1 second) so all audit_match_record() callers wait long enough for kauditd delivery, and lower it to the fast value (1 usec) only on the two paths that expect no record: audit_count_records() and the expected_domain_id == 0 probe in matches_log_domain_deallocated(). audit_init() drains stale records with the fast timeout (terminating on -EAGAIN once the backlog is empty) and switches to the patient default before returning. 1 second gives ~10x margin over the observed maximum (~100 ms, while the happy path is ~23 us). Rename the timeval constants to reflect their new roles: - audit_tv_dom_drop (1 second) -> audit_tv_default: default socket timeout, patient enough for asynchronous kauditd delivery. - audit_tv_default (1 usec) -> audit_tv_fast: fast timeout for paths that expect no record (drain, audit_count_records(), probes). Invert the conditional in matches_log_domain_deallocated(). Check setsockopt returns on both the lower and restore paths; preserve the first error via !err when the restore fails after a prior error so the actionable return code is not masked by a bookkeeping failure. Cc: Günther Noack <gnoack@google.com> Cc: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Cc: stable@vger.kernel.org Depends-on: 07c2572a8757 ("selftests/landlock: Skip stale records in audit_match_record()") Fixes: 6a500b22971c ("selftests/landlock: Add tests for audit flags and domain IDs") Reported-by: Günther Noack <gnoack3000@gmail.com> Closes: https://lore.kernel.org/r/20260402.eb5c4e85f472@gnoack.org [1] Reported-by: kernel test robot <oliver.sang@intel.com> Closes: https://lore.kernel.org/oe-lkp/202605111649.a8b30a62-lkp@intel.com Closes: https://lore.kernel.org/oe-lkp/202604300436.a07fae12-lkp@intel.com Tested-by: Günther Noack <gnoack3000@gmail.com> Link: https://patch.msgid.link/20260513105112.140137-2-mic@digikod.net Signed-off-by: Mickaël Salaün <mic@digikod.net>
2026-05-21selftests/landlock: Filter dealloc records in audit_count_records()Mickaël Salaün
audit_count_records() counts both AUDIT_LANDLOCK_DOMAIN allocation and deallocation records in records.domain . Domain deallocation is tied to asynchronous credential freeing via kworker threads (landlock_put_ruleset_deferred), so the dealloc record can arrive after the drain in audit_init() and after the preceding audit_match_record() call. This causes flaky failures in tests that assert an exact records.domain count: a stale dealloc record from a previous test's domain inflates the count by one. Observed on x86_64 under build configurations that delay the kworker firing the dealloc callback (e.g. coverage instrumentation): the audit_layout1 tests in fs_test.c intermittently saw records.domain == 2 where 1 was expected. The fix is in the shared helper, so those existing checks become robust without needing a fs_test.c edit. Filter audit_count_records() with a regex to skip records containing deallocation status. The remaining domain records (allocation, emitted synchronously during landlock_log_denial()) are deterministic. Deallocation records are already tested explicitly via matches_log_domain_deallocated() in audit_test.c, which uses its own domain-ID-based filtering and longer timeout. With this filter in place, re-add the records.domain == 0 checks that were removed in commit 3647a4977fb7 ("selftests/landlock: Drain stale audit records on init") as a workaround for this race. Cc: Günther Noack <gnoack@google.com> Cc: stable@vger.kernel.org Depends-on: 07c2572a8757 ("selftests/landlock: Skip stale records in audit_match_record()") Fixes: 6a500b22971c ("selftests/landlock: Add tests for audit flags and domain IDs") Tested-by: Günther Noack <gnoack3000@gmail.com> Link: https://patch.msgid.link/20260513105112.140137-1-mic@digikod.net Signed-off-by: Mickaël Salaün <mic@digikod.net>
2026-05-21selftests/hid: Remove unused LLD variableJames Clark
This file was mostly copied from selftests/bpf/Makefile, but the LLD variable is not used here. Also, this copied block didn't get the same fixes as the original one did later. Remove it to avoid confusion and so future fixes don't have to be in two places. Signed-off-by: James Clark <james.clark@linaro.org> Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
2026-05-21selftests: net: Fix checksums in xdp_nativeNimrod Oren
Data adjustment cases failed with "Data exchange failed" when using IPv4 because the program did not update the IP and UDP checksums in the IPv4 branch. The issue was masked when both IPv4 and IPv6 were configured, since the test harness prefers IPv6. While here, generalize csum_fold_helper() to fold twice so it works for any 32-bit input. Fixes: 0b65cfcef9c5 ("selftests: drv-net: Test tail-adjustment support") Reviewed-by: Carolina Jubran <cjubran@nvidia.com> Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com> Signed-off-by: Nimrod Oren <noren@nvidia.com> Link: https://patch.msgid.link/20260520153928.3371765-1-noren@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-21selftests: rds: config: disable modulesMatthieu Baerts (NGI0)
The run.sh script explicitly checks that CONFIG_MODULES is disabled. By default, this config option is enabled. Explicitly disable it to be able to run the RDS tests. Note that writing '# CONFIG_(...) is not set' is usually recommended to disable an option in the .config, but it looks like selftests usually set 'CONFIG_(...)=n', which looks clearer. Fixes: 0f5d68004780 ("selftests: rds: add tools/testing/selftests/net/rds/config") Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Reviewed-by: Allison Henderson <achender@kernel.org> Link: https://patch.msgid.link/20260520-net-rds-config-modules-v1-1-2100df02fe9a@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-21selftests: openat2: port emptypath_test to kselftest harnessChristian Brauner
Convert the emptypath selftests to the FIXTURE_SETUP()/FIXTURE_TEARDOWN() and the two checks become TEST_F()s. No change in coverage. Link: https://patch.msgid.link/20260521-wettstreit-meinen-46271dede480@brauner Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
2026-05-21kselftest/openat2: test for OPENAT2_REGULAR flagDorjoy Chowdhury
Just a happy path test. Christian Brauner <brauner@kernel.org> says: Update OPENAT2_REGULAR fallback define to match upper-32-bit UAPI value. Port the test to the kselftest_harness TEST*/FIXTURE framework to match the migrated openat2_test.c, and add a regression test ensuring open()/openat() keep ignoring the internal __O_REGULAR carrier bit. Signed-off-by: Dorjoy Chowdhury <dorjoychy111@gmail.com> Link: https://patch.msgid.link/20260328172314.45807-3-dorjoychy111@gmail.com Reviewed-by: Aleksa Sarai <aleksa@amutable.com> Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
2026-05-21selftests: harness: fix pidfd leak in __wait_for_testGeliang Tang
Fix the pidfd leak in kselftest_harness.h's __wait_for_test() where childfd = syscall(__NR_pidfd_open, t->pid, 0) is never closed. Fixes: 73a3cde97677 ("selftests: harness: Implement test timeouts through pidfd") Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn> Link: https://patch.msgid.link/a82e275ccfb2609a1984d90ab559fa3af78f1e81.1776678050.git.tanggeliang@kylinos.cn Reviewed-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
2026-05-21lkdtm/powerpc: add PPC_RADIX_TLBIEL test for radix MCE validationSayali Patil
Add a new LKDTM trigger (PPC_RADIX_TLBIEL) that executes a process-scoped radix TLBIEL instruction to exercise the radix MMU behaviour and associated machine check exception (MCE) handling paths. This provides a way to validate MCE handling in radix mode. Currently, there is no dedicated LKDTM test that exercises this path or allows triggering radix-specific machine check behaviour for validation. The test is only enabled on ppc64 systems with radix MMU support and If radix is not active, the trigger is skipped and reported as XFAIL. Co-developed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com> Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com> Signed-off-by: Sayali Patil <sayalip@linux.ibm.com> Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com> Reviewed-by: Michael Ellerman <mpe@kernel.org> Link: https://patch.msgid.link/85c9b59217bcecb3c7af52e9d5b175266771d7de.1778975974.git.sayalip@linux.ibm.com Signed-off-by: Kees Cook <kees@kernel.org>
2026-05-21selftests/bpf: Add test cases for bpf_list_del/add/is_first/is_last/emptyKaitao Cheng
Extend refcounted_kptr with tests for bpf_list_add (including prev from bpf_list_front and bpf_refcount_acquire), bpf_list_del (including node from bpf_list_front, bpf_rbtree_remove and bpf_refcount_acquire), bpf_list_empty, bpf_list_is_first/last, and push_back on uninit head. To verify the validity of bpf_list_del/add, the test also expects the verifier to reject calls to bpf_list_del/add made without holding the spin_lock. Signed-off-by: Kaitao Cheng <chengkaitao@kylinos.cn> Link: https://lore.kernel.org/r/20260521032306.97118-9-kaitao.cheng@linux.dev Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2026-05-21selftest: add tests for O_EMPTYPATHJori Koolstra
Add tests for the new O_EMPTYPATH flag of openat(2)/openat2(2). Also, the current openat2 tests include a helper header file that defines the necessary structs and constants to use openat2(2), such as struct open_how. This may result in conflicting definitions when the system header openat2.h is present as well. So add openat2.h generated by 'make headers' to the uapi header files in ./tools/include and remove the helper file definitions of the current openat2 selftests. Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl> Link: https://patch.msgid.link/20260424114611.1678641-3-jkoolstra@xs4all.nl Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
2026-05-21selftests: openat2: migrate to kselftest harnessAleksa Sarai
These tests were written in the early days of selftests' TAP support, the more modern kselftest harness is much easier to follow and maintain. The actual contents of the tests are unchanged by this change. Most of the diff involves switching from the E_* syscall wrappers we previously used to ASSERT_EQ(fn(...), 0) in tests and helper functions. The first pass of the migration was done using Claude, followed by a manual rework and review. Assisted-by: Claude:claude-4.6-opus Signed-off-by: Aleksa Sarai <aleksa@amutable.com> Link: https://patch.msgid.link/20260401-openat2-selftests-kunit-v2-4-ad153a07da0c@amutable.com Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
2026-05-21selftests: openat2: switch from custom ARRAY_LEN to ARRAY_SIZEAleksa Sarai
For whatever reason, the original version of the tests used a custom version of ARRAY_SIZE, but ARRAY_SIZE works just as well. Signed-off-by: Aleksa Sarai <aleksa@amutable.com> Link: https://patch.msgid.link/20260401-openat2-selftests-kunit-v2-3-ad153a07da0c@amutable.com Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
2026-05-21selftests: openat2: move helpers to headerAleksa Sarai
This is a bit ugly, but in the next patch we will move to using kselftest_harness.h -- which doesn't play well with being included in multiple compilation units due to duplicate function definitions. Not including kselftest_harness.h would let us avoid this patch, but the helpers will need include kselftest_harness.h in order to switch to TH_LOG. Signed-off-by: Aleksa Sarai <aleksa@amutable.com> Link: https://patch.msgid.link/20260401-openat2-selftests-kunit-v2-2-ad153a07da0c@amutable.com Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
2026-05-21selftests: move openat2 tests to selftests/filesystems/Aleksa Sarai
These tests really should've always belonged there, doubly so now that they include a lot of other generic filesystem-related tests. Suggested-by: Christian Brauner <brauner@kernel.org> Signed-off-by: Aleksa Sarai <aleksa@amutable.com> Link: https://patch.msgid.link/20260401-openat2-selftests-kunit-v2-1-ad153a07da0c@amutable.com Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
2026-05-20selftests/bpf: add regression test for ktls+sockmap verdict UAFXingwang Xiang
Test the scenario where a socket is inserted into a sockmap with a BPF_SK_SKB_VERDICT program before TLS RX is configured. Previously sk_psock_verdict_data_ready() would call tcp_read_skb() and drain the receive queue without advancing copied_seq, causing tls_decrypt_sg() to walk a dangling frag_list pointer (use-after-free). The test drives the full vulnerable sequence and verifies that after the fix recv() returns the correct decrypted data. Signed-off-by: Xingwang Xiang <v3rdant.xiang@gmail.com> Link: https://patch.msgid.link/20260517145630.20521-3-v3rdant.xiang@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-20selftests: rds: Add ROCE support to run.shAllison Henderson
This patch adds support for testing rds rdma over ROCE. A new -r flag is added to config.sh which enables the required kernel configs for rdma. We also add a -T flag to run.sh, which takes a transport option, tcp or rdma. The rdma option will check to ensure the proper configs have been enabled. The flag is then passed to test.py, which will run the test over the specified transport(s) Signed-off-by: Allison Henderson <achender@kernel.org> Link: https://patch.msgid.link/20260518012443.2629206-12-achender@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-20selftests: rds: Add ROCE support to test.pyAllison Henderson
This patch adds support for testing rds rdma over ROCE in test.py A new -T flag is added, which takes a transport option, tcp or rdma. A new setup_rdma() function is added that will configure rdma interfaces and sockets for use in the test case. Signed-off-by: Allison Henderson <achender@kernel.org> Link: https://patch.msgid.link/20260518012443.2629206-11-achender@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-20selftests: rds: Register network teardown via atexitAllison Henderson
This patch adds a teardown_tcp() helper that removes net0/net1. The cmd calls here use fail=False so they can be called from completed or partially-setup states on error. Also call teardown_tcp() at the top of setup_tcp() so a previous interrupted run does not leave net0/net1 lingering and break a subsequent ip netns add. Register teardown_tcp() with atexit before setup_tcp() is invoked. Likewise, we can simpliy stop_pcaps() handling by registering it with atexit instead of calling it from the signal handler. atexit handlers run on any exit path - normal completion, raised exception, and sys.exit() from the timeout signal handler. This guarantees cleanup are called without further wrapping the test body in a try/finally blocks. atexit LIFO ordering keeps stop_pcaps before teardown_tcp so tcpdumps are killed cleanly before their namespaces go away. This is a preparatory cleanup for the upcoming ROCE patch which will also register a teardown_rdma() alongside teardown_tcp() Signed-off-by: Allison Henderson <achender@kernel.org> Link: https://patch.msgid.link/20260518012443.2629206-10-achender@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-20selftests: rds: Handle errors in netns_socketAllison Henderson
Sockets created by child processes in netns_socket may raise exceptions that are currently not handled by the parent. If for example a namespace didn't exist or the rds module didn't load. Because these exceptions occur with in a child thread, the child thread exits, but the parent does not check the return status. Further, allowing the child processes to quietly raise exceptions will cause problems later if the parent registers clean up functions with atexit. Since the child processes inherit the parents handlers, they may prematurely call the parents cleanup routines without the parent being aware. Fix this by all catching exceptions raised by the child processes. Child errors surface as a non-zero exit status, which are then properly raised in the parent process. Signed-off-by: Allison Henderson <achender@kernel.org> Link: https://patch.msgid.link/20260518012443.2629206-9-achender@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-20selftests: rds: Add helper function snd_rcv_packets() in test.pyAllison Henderson
Hoist the send/recv logic in test.py into a helper function, snd_rcv_packets(). This is a preparatory refactoring for the rds over ROCE series which can use the same function to run the test over tcp, rdma, or both. No functional changes are introduced in this patch. Signed-off-by: Allison Henderson <achender@kernel.org> Link: https://patch.msgid.link/20260518012443.2629206-8-achender@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-20selftests: rds: Add helper function verify_hashes() in test.pyAllison Henderson
Hoist the verify hashes logic in test.py into a helper function, verify_hashes(). This is a preparatory refactoring for the rds over ROCE series that helps modularize the send/recv logic. Breaking up the logic now will help avoid large function pylint errors later. No functional changes are introduced in this patch. Signed-off-by: Allison Henderson <achender@kernel.org> Link: https://patch.msgid.link/20260518012443.2629206-7-achender@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-20selftests: rds: Add helper function recv_burst() in test.pyAllison Henderson
Hoist receive packet logic in test.py into a helper function, recv_burst(). This is a preparatory refactoring for the rds over ROCE series that helps modularize the send/recv logic. Breaking up the logic now will help avoid large function pylint errors later. No functional changes are introduced in this patch. Signed-off-by: Allison Henderson <achender@kernel.org> Link: https://patch.msgid.link/20260518012443.2629206-6-achender@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-20selftests: rds: Add helper function send_burst() in test.pyAllison Henderson
Hoist the send packet logic in test.py into a helper function, send_burst(). This is a preparatory refactoring for the rds over ROCE series that helps modularize the send/recv logic. Breaking up the logic now will help avoid large function pylint errors later. No functional changes are introduced in this patch. Signed-off-by: Allison Henderson <achender@kernel.org> Link: https://patch.msgid.link/20260518012443.2629206-5-achender@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-20selftests: rds: Add helper function check_info() in test.pyAllison Henderson
Hoist the page info logic in test.py into a helper function, check_info(). This is a preparatory refactoring for the rds over ROCE series that helps modularize the send/recv logic. Breaking up the logic now will help avoid large function pylint errors later. No functional changes are introduced in this patch. Signed-off-by: Allison Henderson <achender@kernel.org> Link: https://patch.msgid.link/20260518012443.2629206-4-achender@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-20selftests: rds: Add helper function setup_tcp() in test.pyAllison Henderson
Hoist the network configs in test.py into a tcp specific helper function, setup_tcp(). This is a preparatory refactoring for the rds over ROCE series which will add separate function for rdma specific configs. No functional changes are introduced in this patch. Signed-off-by: Allison Henderson <achender@kernel.org> Link: https://patch.msgid.link/20260518012443.2629206-3-achender@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-20vfio: selftests: Add tests to validate SR-IOV UAPIRaghavendra Rao Ananta
Add a selftest, vfio_pci_sriov_uapi_test.c, to validate the SR-IOV UAPI, including the following cases, iterating over all the IOMMU modes currently supported: - Setting correct/incorrect/NULL tokens during device init. - Close the PF device immediately after setting the token. - Change/override the PF's token after device init. Signed-off-by: Raghavendra Rao Ananta <rananta@google.com> Reviewed-by: Vipin Sharma <vipinsh@google.com> Reviewed-by: David Matlack <dmatlack@google.com> Tested-by: David Matlack <dmatlack@google.com> Link: https://lore.kernel.org/r/20260505212838.1698034-9-rananta@google.com Signed-off-by: Alex Williamson <alex@shazbot.org>
2026-05-20vfio: selftests: Add helpers to alloc/free vfio_pci_deviceRaghavendra Rao Ananta
Add a helper, vfio_pci_device_alloc(), to allocate 'struct vfio_pci_device'. The subsequent test patch will utilize this to get the struct with very minimal initialization done. Internally, let vfio_pci_device_init() also make use of this function and later do the full initialization. Symmetrically, add a free variant, vfio_pci_device_free(), to be used in a similar fashion. No functional change intended. Signed-off-by: Raghavendra Rao Ananta <rananta@google.com> Reviewed-by: David Matlack <dmatlack@google.com> Reviewed-by: Vipin Sharma <vipinsh@google.com> Tested-by: David Matlack <dmatlack@google.com> Link: https://lore.kernel.org/r/20260505212838.1698034-8-rananta@google.com Signed-off-by: Alex Williamson <alex@shazbot.org>
2026-05-20vfio: selftests: Add helper to set/override a vf_tokenRaghavendra Rao Ananta
Add a helper function, vfio_device_set_vf_token(), to set or override a vf_token. Not only at init, but a vf_token can also be set via the VFIO_DEVICE_FEATURE ioctl, by setting the VFIO_DEVICE_FEATURE_PCI_VF_TOKEN flag. Hence, add an API to utilize this functionality from the test code. The subsequent commit will use this to test the functionality of this method to set the vf_token. Signed-off-by: Raghavendra Rao Ananta <rananta@google.com> Reviewed-by: David Matlack <dmatlack@google.com> Reviewed-by: Vipin Sharma <vipinsh@google.com> Tested-by: David Matlack <dmatlack@google.com> Link: https://lore.kernel.org/r/20260505212838.1698034-7-rananta@google.com Signed-off-by: Alex Williamson <alex@shazbot.org>
2026-05-20vfio: selftests: Expose more vfio_pci_device functionsRaghavendra Rao Ananta
Refactor and make the functions called under device initialization public. A later patch adds a test that calls these functions to validate the UAPI of SR-IOV devices. Opportunistically, to test the success and failure cases of the UAPI, split the functions dealing with VFIO_GROUP_GET_DEVICE_FD and VFIO_DEVICE_BIND_IOMMUFD into a core function and another one that asserts the ioctl. The former will be used for testing the SR-IOV UAPI, hence only export these. Signed-off-by: Raghavendra Rao Ananta <rananta@google.com> Reviewed-by: David Matlack <dmatlack@google.com> Reviewed-by: Vipin Sharma <vipinsh@google.com> Tested-by: David Matlack <dmatlack@google.com> Link: https://lore.kernel.org/r/20260505212838.1698034-6-rananta@google.com Signed-off-by: Alex Williamson <alex@shazbot.org>
2026-05-20vfio: selftests: Extend container/iommufd setup for passing vf_tokenRaghavendra Rao Ananta
A UUID is normally set as a vf_token to correspond the VFs with the PFs, if they are both bound by the vfio-pci driver. This is true for iommufd-based approach and container-based approach. The token can be set either during device creation (VFIO_GROUP_GET_DEVICE_FD) in container-based approach or during iommu bind (VFIO_DEVICE_BIND_IOMMUFD) in the iommu-fd case. Hence extend the functions, vfio_pci_iommufd_setup() and vfio_pci_container_setup(), to accept vf_token as an (optional) argument and handle the necessary setup. No functional changes are expected. Signed-off-by: Raghavendra Rao Ananta <rananta@google.com> Reviewed-by: David Matlack <dmatlack@google.com> Reviewed-by: Vipin Sharma <vipinsh@google.com> Tested-by: David Matlack <dmatlack@google.com> Link: https://lore.kernel.org/r/20260505212838.1698034-5-rananta@google.com Signed-off-by: Alex Williamson <alex@shazbot.org>
2026-05-20vfio: selftests: Introduce a sysfs libRaghavendra Rao Ananta
Introduce a sysfs library to handle the common reads/writes to the PCI sysfs files, for example, getting the total number of VFs supported by the device via /sys/bus/pci/devices/$BDF/sriov_totalvfs. The library will be used in the upcoming test patch to configure the VFs for a given PF device. Since readlink() is quite commonly used in the lib, introduce and use readlink_safe() to take care of potential buffer overrun errors and to safely terminate the buffer with '\0'. Opportunistically, move vfio_pci_get_group_from_dev() to this library as it falls under the same bucket. Rename it to sysfs_iommu_group_get() to align with other function names. Signed-off-by: Raghavendra Rao Ananta <rananta@google.com> Reviewed-by: Vipin Sharma <vipinsh@google.com> Reviewed-by: David Matlack <dmatlack@google.com> Tested-by: David Matlack <dmatlack@google.com> Link: https://lore.kernel.org/r/20260505212838.1698034-4-rananta@google.com Signed-off-by: Alex Williamson <alex@shazbot.org>
2026-05-20vfio: selftests: Introduce snprintf_assert()Raghavendra Rao Ananta
Introduce snprintf_assert() to protect the users of snprintf() to fail if the requested operation was truncated due to buffer limits. VFIO tests and libraries, including a new sysfs library that will be introduced by an upcoming patch, rely quite heavily on snprintf()s to build PCI sysfs paths. Having a protection against this will be helpful to prevent false test failures. Signed-off-by: Raghavendra Rao Ananta <rananta@google.com> Reviewed-by: David Matlack <dmatlack@google.com> Reviewed-by: Vipin Sharma <vipinsh@google.com> Tested-by: David Matlack <dmatlack@google.com> Link: https://lore.kernel.org/r/20260505212838.1698034-3-rananta@google.com Signed-off-by: Alex Williamson <alex@shazbot.org>
2026-05-20vfio: selftests: Add -Wall and -Werror to the MakefileRaghavendra Rao Ananta
Add the compiler flags, -Wall and -Werror, to catch all the build warnings and flag them as a build error, respectively. This is to ensure that no obvious programmer errors are introduced. We can add -Wno-* flags in the future to ignore specific warnings as necesasry. Signed-off-by: Raghavendra Rao Ananta <rananta@google.com> Reviewed-by: David Matlack <dmatlack@google.com> Reviewed-by: Vipin Sharma <vipinsh@google.com> Tested-by: David Matlack <dmatlack@google.com> Link: https://lore.kernel.org/r/20260505212838.1698034-2-rananta@google.com Signed-off-by: Alex Williamson <alex@shazbot.org>
2026-05-20vfio: selftests: Allow builds when ARCH=x86David Matlack
Allow builds when ARCH=x86 since the top-level Makefile can set ARCH=x86 even for 64-bit x86 builds. Note that ARCH=x86 could also indicate a native build on a 32-bit x86 host. However, it doesn't seem like anyone is building selftests natively on 32-bit x86 hosts these days since KVM selftests allow ARCH=x86 and fail to compile on 32-bit x86. If someone reports an issue on 32-bit native builds we can harden the KVM and VFIO selftests to explicitly check 64-bit (see the discussion in the Closes link below). Fixes: a55d4bbbe644 ("vfio: selftests: only build tests on arm64 and x86_64") Reported-by: Jason Gunthorpe <jgg@nvidia.com> Closes: https://lore.kernel.org/kvm/20260427231217.GA1670652@nvidia.com/ Signed-off-by: David Matlack <dmatlack@google.com> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Link: https://lore.kernel.org/r/20260428232707.2139059-1-dmatlack@google.com Signed-off-by: Alex Williamson <alex@shazbot.org>
2026-05-20vfio: selftests: Fix out-of-tree build with make O=Jason Gunthorpe
The test programs are compiled via a static pattern rule that requires intermediate .o files: $(TEST_GEN_PROGS): %: %.o $(LIBVFIO_O) After lib.mk prefixes TEST_GEN_PROGS with $(OUTPUT), this creates dependencies on .o files in the output directory (e.g. $(OUTPUT)/vfio_dma_mapping_test.o). However, there is no rule to compile these .o files from the source directory .c files when OUTPUT differs from the source directory. Add an explicit chain of pattern rules: $(OUTPUT)/% -> $(OUTPUT)/%.o -> %.c Following the same pattern already used in libvfio.mk for the library objects. Fixes: 19faf6fd969c ("vfio: selftests: Add a helper library for VFIO selftests") Reviewed-by: David Matlack <dmatlack@google.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Link: https://lore.kernel.org/r/0-v2-4ccc247e6aff+1d93-vfio_st_make_o_jgg@nvidia.com Signed-off-by: Alex Williamson <alex@shazbot.org>
2026-05-20selftests/bpf: Filter timing outliers with IQR in batch-timing libraryPuranjay Mohan
System noise (timer interrupts, scheduling) can inflate the reported stddev. tcp-v4-syn showed stddev 37.86 ns without filtering vs 0.16 ns with filtering on the same run data. Filter samples outside [Q1 - 1.5*IQR, Q3 + 1.5*IQR] before computing statistics. Scenarios with genuinely wide distributions have large IQR so the fences stay wide and the filter has minimal effect. Signed-off-by: Puranjay Mohan <puranjay@kernel.org> Link: https://lore.kernel.org/r/20260520133338.3392667-4-puranjay@kernel.org Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2026-05-20selftests/bpf: Fix expired UDP LRU entries in XDP LB benchmarkPuranjay Mohan
populate_lru() zero-initializes atime: struct real_pos_lru lru = { .pos = real_idx }; connection_table_lookup() treats UDP entries with cur_time - atime > 30s as expired, so every pre-populated entry expires immediately. Calibration masks this on the CPU it runs on, but if validation migrates to another CPU: [udp-v4-lru-hit] COUNTER FAIL: LRU misses=1, expected 0 Initialize atime from CLOCK_MONOTONIC for UDP flows. Fixes: a4b5ba8187cb ("selftests/bpf: Add XDP load-balancer benchmark driver") Signed-off-by: Puranjay Mohan <puranjay@kernel.org> Link: https://lore.kernel.org/r/20260520133338.3392667-3-puranjay@kernel.org Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2026-05-20selftests/bpf: Fix cold_lru producing zero batch_hash in XDP LB benchmarkPuranjay Mohan
batch_hash = (batch_gen ^ cpu_id) * KNUTH_HASH_MULT; When batch_gen == cpu_id the XOR produces zero, batch_hash is zero, and *saddr ^= 0 is a no-op. Every iteration hits the warm LRU entry. During validation batch_gen is 2, so running on CPU 2 triggers: [udp-v4-lru-miss] COUNTER FAIL: LRU misses=0, expected 1 Replace XOR with addition so the multiplier input is always >= 1. This also preserves the per-CPU salt for multi-producer runs. Fixes: 4b4f2229104c ("selftests/bpf: Add XDP load-balancer BPF program") Signed-off-by: Puranjay Mohan <puranjay@kernel.org> Link: https://lore.kernel.org/r/20260520133338.3392667-2-puranjay@kernel.org Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2026-05-20bpf: Reject NULL data/sig in bpf_verify_pkcs7_signatureKP Singh
__bpf_dynptr_data() can return NULL (FILE dynptrs, any non-contiguous backing). bpf_verify_pkcs7_signature() forwards the pointer to verify_pkcs7_signature() unchecked, causing a NULL deref in asn1_ber_decoder() reachable from a sleepable BPF LSM at lsm.s/bpf. NULL-check both pointers and reject with -EINVAL. Mirrors the guards already in kernel/bpf/crypto.c. Fixes: 865b0566d8f1 ("bpf: Add bpf_verify_pkcs7_signature() kfunc") Reported-by: Xianrui Dong <dongxianrui1@gmail.com> Signed-off-by: KP Singh <kpsingh@kernel.org> Reviewed-by: Amery Hung <ameryhung@gmail.com> Acked-by: Song Liu <song@kernel.org> Acked-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20260520024059.313468-1-kpsingh@kernel.org Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
2026-05-19selftests: bridge_vlan_mcast: Test toggling of multicast snoopingIdo Schimmel
Test toggling of multicast snooping when per-VLAN multicast snooping is enabled. The test always passes, but without "bridge: mcast: Fix possible use-after-free when removing a bridge port" it results in a splat. Acked-by: Nikolay Aleksandrov <nikolay@nvidia.com> Signed-off-by: Ido Schimmel <idosch@nvidia.com> Link: https://patch.msgid.link/20260517121122.188333-3-idosch@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-19Merge tag 'mm-hotfixes-stable-2026-05-18-21-07' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Pull misc fixes from Andrew Morton: "14 hotfixes. 9 are for MM. 10 are cc:stable and the remainder are for post-7.1 issues or aren't deemed suitable for backporting. There's a two-patch MAINTAINERS series from Mike Rapoport which updates us for the new KEXEC/KDUMP/crash/LUO/etc arrangements. And another two-patch series from Muchun Song to fix a couple of memory-hotplug issues. Otherwise singletons, please see the changelogs for details" * tag 'mm-hotfixes-stable-2026-05-18-21-07' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: mm/memory: fix spurious warning when unmapping device-private/exclusive pages mm: fix __vm_normal_page() to handle missing support for pmd_special()/pud_special() drivers/base/memory: fix memory block reference leak in poison accounting mm/memory_hotplug: fix memory block reference leak on remove lib: kunit_iov_iter: fix test fail on powerpc mm/page_alloc: fix initialization of tags of the huge zero folio with init_on_free MAINTAINERS: add kexec@ list to LIVE UPDATE ENTRY MAINTAINERS: add tree for KDUMP and KEXEC selftests/mm: run_vmtests.sh: fix destructive tests invocation scripts/gdb: slab: update field names of struct kmem_cache scripts/gdb: mm: cast untyped symbols in x86_page_ops mm/damon: fix damos_stat tracepoint format for sz_applied mm/damon/sysfs-schemes: call missing mem_cgroup_iter_break() mm/migrate_device: fix spinlock leak in migrate_vma_insert_huge_pmd_page
2026-05-19selftests: mptcp: drop nanoseconds width specifierMatthieu Baerts (NGI0)
Using the format specifier +%s%3N with GNU date is honoured, and only prints 3 digits of the nanoseconds portion of the seconds since epoch, which corresponds to the milliseconds. The uutils implementation of date currently does not honour this, and always prints all 9 digits. This is a known issue [1], but can be worked around by adapting this test to use nanoseconds instead of microseconds, and then divide it by 1e6. This fix is similar to what has been done on systemd side [2], and it is needed to run the selftests on Ubuntu 26.04, containing uutils 0.8.0. Note that the Fixes tag is there even if this patch doesn't fix an issue in the kernel selftests, but it is useful for those using uutils 0.8.0. Fixes: 048d19d444be ("mptcp: add basic kselftest for mptcp") Cc: stable@vger.kernel.org Link: https://github.com/uutils/coreutils/issues/11658 [1] Link: https://github.com/systemd/systemd/pull/41627 [2] Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Link: https://patch.msgid.link/20260515-net-mptcp-misc-fixes-7-1-rc4-v2-6-701e96419f2f@kernel.org Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-05-19selftests: mptcp: join: cover ADD_ADDR tx drop and list progressLi Xiasong
Extend add_addr_ports_tests with IPv6 signaling cases that exercise ADD_ADDR tx-space shortage when tcp_timestamps are enabled. Add one case to verify PM still progresses to later signal endpoints after the first one is dropped. This covers both failure accounting and the non-blocking behavior of the announce list after a tx-space drop on pure ACK. Signed-off-by: Li Xiasong <lixiasong1@huawei.com> Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Link: https://patch.msgid.link/20260515-net-mptcp-misc-fixes-7-1-rc4-v2-3-701e96419f2f@kernel.org Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-05-19kselftest/arm64: Add 2025 dpISA coverage to hwcapsMark Brown
Add coverage of the new hwcaps to the test program, encodings cross checked against LLVM 22. Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Will Deacon <will@kernel.org>
2026-05-19Merge tag 'ovpn-net-20260514' of https://github.com/OpenVPN/ovpn-net-nextPaolo Abeni
Antonio Quartulli says: ==================== Included fixes: * fix TCP selftest failures by reducing number of attempted pings * fix RCU ptr deref outside of RCU read section * fix UAF in case of TCP peer failed to be added to hashtable * fix race condition between iface teardown and new peer being added * ensure dstats are updated with BH disabled to avoid concurrency * tag 'ovpn-net-20260514' of https://github.com/OpenVPN/ovpn-net-next: ovpn: disable BHs when updating device stats ovpn: fix race between deleting interface and adding new peer ovpn: respect peer refcount in CMD_NEW_PEER error path ovpn: tcp - use cached peer pointer in ovpn_tcp_close() selftests: ovpn: reduce remaining ping flood counts ==================== Link: https://patch.msgid.link/20260514231544.795993-1-antonio@openvpn.net Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-05-19kselftest/arm64: Add tests for POR_EL0 save/reset/restoreKevin Brodsky
POR_EL0 is expected to be: - Saved in the poe_context record - Reset to POR_EL0_INIT when invoking the signal handler - Restored from poe_context when returning from the signal handler Add a new test, poe_restore, to check that the save/reset/restore mechanism is working as intended. See commit 2e8a1acea859 ("arm64: signal: Improve POR_EL0 handling to avoid uaccess failures") for more details. This commit did not handle the case where poe_context is missing correctly. This was recently fixed; add a new test, poe_missing_poe_context, to check this case. Note: td->pass is only set to true at the very end, as an unexpected signal may occur in case of failure (especially in poe_missing_poe_context if POR_EL0 is restored to an invalid value). Failures are tracked with a global, failed_check. Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com> Signed-off-by: Will Deacon <will@kernel.org>
2026-05-19kselftest/arm64: Move/add POE helpers to test_signals_utils.hKevin Brodsky
In preparation to adding further POE signal tests, move get_por_el0() to test_signals_utils.h and add set_por_el0(). Reviewed-by: Mark Brown <broonie@kernel.org> Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com> Signed-off-by: Will Deacon <will@kernel.org>
2026-05-19kselftest/arm64: Add POE as a feature in the signal testsKevin Brodsky
Add the POE feature to the signal tests framework, to allow tests to require it. Reviewed-by: Mark Brown <broonie@kernel.org> Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com> Signed-off-by: Will Deacon <will@kernel.org>