summaryrefslogtreecommitdiff
path: root/tools
AgeCommit message (Collapse)Author
2026-07-07KVM: selftests: Seed libc's RNG before using it to generate a seed for KVM's ↵Sean Christopherson
pRNG Seed the RNG used by random() using the de facto standard method of srand(time(0)), so that a different seed is actually used in each test run. E.g. without seeding the RNG, literally every test on x86 will use 0x6b8b4567 to seed the KVM RNG. Link: https://patch.msgid.link/20260626213534.3866178-6-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
2026-07-07KVM: selftests: Initialize the default/global pRNG during kvm_selftest_init()Sean Christopherson
Initialize the default kvm_rng during selftest initialization so that the pRNG can be used by tests before creating a VM. As pointed out by Sashiko, failure to actually initialize the generate makes it decidedly not random. Link: https://patch.msgid.link/20260626213534.3866178-5-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
2026-07-07KVM: selftests: Rename guest_rng to kvm_rngJosh Hilke
Rename functions prefixed with 'guest_random_' to 'kvm_random_' and the global random state variable 'guest_rng' to 'kvm_rng', as the pRNG isn't strictly limited to guest code. This will allow using the pRNG in host code without creating confusing/misleading function calls. No functional changes are intended. Suggested-by: Sean Christopherson <seanjc@google.com> Signed-off-by: Josh Hilke <jrhilke@google.com> [sean: massage changelog] Link: https://patch.msgid.link/20260626213534.3866178-4-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
2026-07-07KVM: selftests: Add macros to read/write+sync to/from guest memoryDavid Matlack
Add SYNC_FROM_GUEST_AND_READ(vm, variable), to read a variable value from the guest. Add WRITE_AND_SYNC_TO_GUEST(vm, variable, value) to write a value to a guest variable. These macros improve the readability of code which reads and writes data between host and guest in tests. Use the new macro in existing tests that do back-to-back write+sync. No functional changes are intended. Suggested-by: Sean Christopherson <seanjc@google.com> Signed-off-by: David Matlack <dmatlack@google.com> Co-developed-by: Josh Hilke <jrhilke@google.com> Signed-off-by: Josh Hilke <jrhilke@google.com> [sean: massage changelog] Link: https://patch.msgid.link/20260626213534.3866178-3-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
2026-07-07KVM: selftests: Build and link selftests/vfio/lib into KVM selftestsDavid Matlack
Include libvfio.mk into the KVM selftests Makefile and link it into all KVM selftests by adding it to LIBKVM_OBJS. This lays the groundwork for future changes to utilize VFIO devices to verify IRQ bypass in KVM selftests. Note that KVM selftests build their own copy of selftests/vfio/lib and the resulting object files are placed in $(OUTPUT)/lib. This allows the KVM and VFIO selftests to apply different CFLAGS when building without conflicting with each other. Signed-off-by: David Matlack <dmatlack@google.com> Signed-off-by: Josh Hilke <jrhilke@google.com> Link: https://patch.msgid.link/20260626213534.3866178-2-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
2026-07-07selftests/bpf: Add test for bpf_get_smp_processor_idMaxim Khmelevskii
Add a test which checks on each CPU that the bpf_get_smp_processor_id BPF helper is returning the correct CPU number. Signed-off-by: Maxim Khmelevskii <max@linux.ibm.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com> Link: https://lore.kernel.org/bpf/20260703125648.919196-6-max@linux.ibm.com Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
2026-07-07selftests/bpf: Cover MEM_ALLOC access past object boundsYiyang Chen
Add a linked_list negative loader case for a program-BTF type whose last member is a zero-length flexible array. The program writes through the first flexible-array element of an object allocated by bpf_obj_new(). The verifier should reject the access when the BTF walk reaches beyond the static size of the allocated object. Signed-off-by: Yiyang Chen <chenyy23@mails.tsinghua.edu.cn> Acked-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/bpf/e36fd5d2f4047809f0e5da46a7077083297e64db.1782807039.git.chenyy23@mails.tsinghua.edu.cn Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
2026-07-07selftests/bpf: Fix memory leak in msg_alloc_iov error pathMalaya Kumar Rout
In msg_alloc_iov(), when calloc() fails for an individual iov_base allocation, the error path frees all previously allocated iov_base entries but fails to free the iov array itself that was allocated with calloc() at the beginning of the function. This results in a memory leak of the iov array. Add free(iov) in the unwind_iov error path to ensure proper cleanup of all allocated memory. Fixes: 753fb2ee0934 ("bpf: sockmap, add msg_peek tests to test_sockmap") Signed-off-by: Malaya Kumar Rout <malayarout91@gmail.com> Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com> Link: https://lore.kernel.org/bpf/20260704122936.102394-1-malayarout91@gmail.com Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
2026-07-07selftests/bpf: libarena: Add parallel bitmap selftestEmil Tsalapatis
Add a selftest for testing the atomic bitmap set/clear/ test_and_set/test_and_clear operations. The selftest checks atomicity by spawning two threads, each of which either only works on even bits or with odd bits. The test checks that threads do not affect each other's bits. Signed-off-by: Emil Tsalapatis <emil@etsalapatis.com> Link: https://lore.kernel.org/bpf/20260706181730.21731-7-emil@etsalapatis.com Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
2026-07-07selftests/bpf: libarena: Add bitmap selftestsEmil Tsalapatis
Add testing for the new arena bitmap data structure. Signed-off-by: Emil Tsalapatis <emil@etsalapatis.com> Acked-by: Ihor Solodrai <ihor.solodrai@linux.dev> Link: https://lore.kernel.org/bpf/20260706181730.21731-6-emil@etsalapatis.com Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
2026-07-07selftests/bpf: Add arena-based bitmap data structureEmil Tsalapatis
Add an arena-based word-aligned bitmap data struture. The structure is useful as a building block, e.g., sched-ext uses it to represent cpumask structures. Signed-off-by: Emil Tsalapatis <emil@etsalapatis.com> Link: https://lore.kernel.org/bpf/20260706181730.21731-5-emil@etsalapatis.com Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
2026-07-07selftests/bpf: libarena: Clean up allocation state before buddy testsEmil Tsalapatis
Summary: The buddy allocator requires the global BPF buddy allocator to not be already initialized. However, the test currently merely resets the allocator before the buddy tests instead of destroying it, and the test worked because the buddy test happened to run first. Properly destroy the allocator instead of resetting it. Fixes: b1487dc1b181 ("selftests/bpf: Add selftests for libarena buddy allocator") Signed-off-by: Emil Tsalapatis <emil@etsalapatis.com> Acked-by: Ihor Solodrai <ihor.solodrai@linux.dev> Link: https://lore.kernel.org/bpf/20260706181730.21731-4-emil@etsalapatis.com Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
2026-07-07selftests/bpf: libarena: Fix can-loop zero variable definitionEmil Tsalapatis
BPF can_loop based loops require the index variable to stay imprecise. This means we must initialize them from a currently imprecise variable instead of directly assigning 0 to them, like so: static volatile u32 zero = 0; for (i = zero; i < NUM_LOOPS; i++) { /* loop body */ } The libarena implementation of this technique is currently faulty. For the technique to work, the variable must not be in a map. This includes the .rodata DATASEC map used for const variables. However, libarena still defines the zero variable as constant. Modify the zero variable definition into a volatile variable. This change adds a complication caused by the compiler optimizing array derefences from for (i = zero; i < NUM_LOOPS; i++) { val = *(ptr + i); } into for (i = zero; i < NUM_LOOPS; i++) { val = *ptr++; } and causing verification failures. Use the barrier_var() clobber macro to prevent this optimization from taking place. Using barrier_var() is the only way to break the optimization, as annotating the index as volatile does not suffice. After that, remove the bpf_for() invocations introduced in libarena for parallel spmc testing. Reported-by: Eduard Zingerman <eddyz87@gmail.com> Signed-off-by: Emil Tsalapatis <emil@etsalapatis.com> Acked-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/bpf/20260706181730.21731-3-emil@etsalapatis.com Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
2026-07-07selftests/bpf: libarena: Replace leftover st_ prefix with test_Emil Tsalapatis
The st_ (selftests_) prefix is confusing and has been replaced with the more descriptive test_. However, last patch did not properly move all files to the new prefix. Rename the existing files to complete the move. Acked-by: Ihor Solodrai <ihor.solodrai@linux.dev> Signed-off-by: Emil Tsalapatis <emil@etsalapatis.com> Link: https://lore.kernel.org/bpf/20260706181730.21731-2-emil@etsalapatis.com Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
2026-07-07Merge branch 'topic/firewire-include-fix' into for-linusTakashi Iwai
Pull header inclusion fix for firewire drivers Signed-off-by: Takashi Iwai <tiwai@suse.de>
2026-07-07rtla: Fix missing unistd includeAndreas Ziegler
Compiling RTLA 7.1.x with GCC 16 and uClibc as standard library fails with these errors: src/common.c: In function ‘set_signals’: src/common.c:40:17: error: implicit declaration of function ‘alarm’ [-Wimplicit-function-declaration] 40 | alarm(params->duration); | ^~~~~ src/common.c: In function ‘common_apply_config’: src/common.c:187:44: error: implicit declaration of function ‘getpid’; did you mean ‘getpt’? [-Wimplicit-function-declaration] 187 | retval = sched_setaffinity(getpid(), sizeof(params->hk_cpu_set), | ^~~~~~ | getpt In file included from src/common.c:9: src/common.c: In function ‘run_tool’: src/common.c:262:19: error: implicit declaration of function ‘sysconf’; did you mean ‘sscanf’? [-Wimplicit-function-declaration] 262 | nr_cpus = get_nprocs_conf(); | ^~~~~~~~~~~~~~~ src/common.c:262:19: error: ‘_SC_NPROCESSORS_CONF’ undeclared (first use in this function) 262 | nr_cpus = get_nprocs_conf(); | ^~~~~~~~~~~~~~~ src/common.c:262:19: note: each undeclared identifier is reported only once for each function it appears in src/common.c:370:17: error: implicit declaration of function ‘sleep’ [-Wimplicit-function-declaration] 370 | sleep(1); | ^~~~~ Restore the missing unistd.h include. Fixes: 115b06a00875 ("tools/rtla: Consolidate nr_cpus usage across all tools") Signed-off-by: Andreas Ziegler <br025@umbiko.net> Link: https://lore.kernel.org/r/20260624033342.129970-1-br025@umbiko.net [ capital letter in patch subject, remove EOL after Fixes ] Signed-off-by: Tomas Glozar <tglozar@redhat.com>
2026-07-07selftests: drv-net: Add test for cross-esw rate schedulingCosmin Ratiu
Adds a Python selftest using the YNL devlink API to verify the devlink rate ops. The test requires a bond device given in the config as NETIF containing two PFs. Test setup will then create 1 VF on each PF and verify the various rate commands. ./devlink_rate_cross_esw.py TAP version 13 1..3 ok 1 devlink_rate_cross_esw.test_same_esw_parent ok 2 devlink_rate_cross_esw.test_cross_esw_parent ok 3 devlink_rate_cross_esw.test_tx_rates_on_cross_esw Tests will be skipped when the preconditions aren't met, when the devlink API is too old or when the devices don't appear to support cross-esw scheduling (detected via EOPNOTSUPP). Signed-off-by: Cosmin Ratiu <cratiu@nvidia.com> Reviewed-by: Carolina Jubran <cjubran@nvidia.com> Signed-off-by: Tariq Toukan <tariqt@nvidia.com> Link: https://patch.msgid.link/20260701073254.754518-14-tariqt@nvidia.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-06Merge tag 'mm-hotfixes-stable-2026-07-06-17-49' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Pull misc fixes from Andrew Morton: "20 hotfixes. 17 are for MM. 12 are cc:stable and the remaining 8 address post-7.1 issues or aren't considered suitable for backporting. Two patches from SJ addresses a couple of quite old DAMON issues. And two patches from Yichong Chen fixes tools/virtio build issues. The remaining patches are singletons" * tag 'mm-hotfixes-stable-2026-07-06-17-49' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: tools/include: include stdint.h for SIZE_MAX in overflow.h tools/virtio: add missing compat definitions for vhost_net_test mm: do file ownership checks with the proper mount idmap samples/damon/mtier: fail early if address range parameters are invalid mm: a second pagecache maintainer mm/damon: add a kernel-doc comment for damon_ctx->rnd_state mm/damon: add a kernel-doc comment for damon_ctx->probes mailmap: add entries for Radu Rendec selftests/mm: hmm-tests: include linux/mman.h to access MADV_COLLAPSE selftests/mm: pagemap_ioctl: use the correct page size for transact_test() fs/proc: fix KPF_KSM reported for all anonymous pages mm: page_ext: add count limit to page_ext_iter_next to prevent invalid PFN access mm/damon/ops-common: handle extreme intervals in damon_hot_score() MAINTAINERS: add Lance as an rmap reviewer mm/compaction: handle free_pages_prepare() properly in compaction_free() mm/damon/sysfs-schemes: put stats for scheme_add_dirs() internal error mm/damon/sysfs-schemes: fix dir put orders in access_pattern_add_dirs() mm: shrinker: fix NULL pointer dereference in debugfs mm: shrinker: fix shrinker_info teardown race with expansion selftests/mm: fix ksft_process_madv.sh test category
2026-07-06KVM: arm64: selftests: Add MMIO sign-extending load testFuad Tabba
Add a test for sign-extending MMIO loads (LDRSB, LDRSH, LDRSW) into Xt and Wt destinations, with and without the sign bit set. The host supplies the MMIO data and checks the guest register holds the sign-extended value. Repeat the loads big-endian on a mixed-endian implementation. Issue those at EL0: SCTLR_EL1.EE would make an EL1 load big-endian but also walk the little-endian page tables big-endian, whereas SCTLR_EL1.E0E selects only EL0 data endianness and leaves the walk little-endian. Signed-off-by: Fuad Tabba <fuad.tabba@linux.dev> Link: https://patch.msgid.link/20260706115522.954913-3-fuad.tabba@linux.dev Signed-off-by: Marc Zyngier <maz@kernel.org>
2026-07-06selftests: net: make busywait timeout clock portableNirmoy Das
loopy_wait() expects millisecond timestamps. However, Ubuntu Resolute can use uutils date, where `date -u +%s%3N` returns seconds plus full nanoseconds instead of a 3-digit millisecond field. This makes busywait expire too early and can make vlan_bridge_binding.sh read a stale operstate. Fixes: 25ae948b4478 ("selftests/net: add lib.sh") Cc: stable@vger.kernel.org # 6.8+ Link: https://github.com/uutils/coreutils/issues/11658 Signed-off-by: Nirmoy Das <nirmoyd@nvidia.com> Link: https://patch.msgid.link/20260630165157.3814871-1-nirmoyd@nvidia.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-06selftests/tc-testing: Add tests that force multiq and taprio to enqueue to ↵Victor Nogueira
child's gso_skb Add test cases to reproduce scenarios fixed recently [1] where multiqueue and taprio forced their children into enqueueing an skb to gso_skb (during peek), but failed to dequeue from gso_skb because they called the child's dequeue callback directly. This causes a desync in the child's qlen/backlog and results in an eventual null-ptr-deref (with a qfq or dualpi2 child). Test cases are the following: - Force multiq to dequeue from its child's gso_skb with qfq leaf (fb6c) - Force multiq to dequeue from its child's gso_skb with dualpi2 leaf (1922) - Force taprio to dequeue from its child's gso_skb with qfq leaf (476f) - Force taprio to dequeue from its child's gso_skb with dualpi2 leaf (0235) [1] https://lore.kernel.org/netdev/20260625-b4-disp-31bcb279-v1-0-85c40b83c529@proton.me/ Signed-off-by: Victor Nogueira <victor@mojatatu.com> Reviewed-by: Pedro Tammela <pctammela@mojatatu.com> Link: https://patch.msgid.link/20260630153651.249752-1-victor@mojatatu.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-06selftests/alsa: Fix format specifier and function mismatch in mixer-testMalaya Kumar Rout
In the ctl_value_index_valid() function, when validating 64-bit integer controls (SND_CTL_ELEM_TYPE_INTEGER64), the error message for maximum value validation has two bugs: 1. Uses snd_ctl_elem_info_get_max() instead of the 64-bit variant snd_ctl_elem_info_get_max64() 2. Uses %ld format specifier instead of %lld for long long type This is inconsistent with the minimum value validation (line 335-339) which correctly uses get_min64() and %lld. The mismatch can cause: - Incorrect maximum values being reported on some architectures - Undefined behavior due to format specifier mismatch - Potential crashes when printing the error message Fix by using snd_ctl_elem_info_get_max64() and %lld format specifier to match the data type and be consistent with the minimum value check. Signed-off-by: Malaya Kumar Rout <malayarout91@gmail.com> Link: https://patch.msgid.link/20260705171038.171966-1-malayarout91@gmail.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
2026-07-05selftests/rseq: Fix spelling of accommodateDing Junlin
It's spelled with two 'm'. Signed-off-by: Ding Junlin <1746193727@qq.com> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Reviewed-by: Paul E. McKenney <paulmck@kernel.org> Link: https://patch.msgid.link/tencent_BAB26179A92C5CE28657C0451540E6EE4B05@qq.com
2026-07-05selftests/futex: Dynamically skip unsupported testsWake Liu
Some new futex tests rely on kernel features that may not be supported on all configurations (e.g., FUTEX2_NUMA or PR_FUTEX_HASH). Currently, these tests fail with EINVAL when the features are missing. Add dynamic skip logic to: - futex_priv_hash: Skip if PR_FUTEX_HASH returns ENOSYS or EINVAL. - futex_numa_mpol: Skip if futex2 or FUTEX2_NUMA returns ENOSYS or EINVAL. This allows the tests to pass (as SKIPPED) on kernels without support, while preserving coverage on configurations that do support them. [ tglx: Adapt to harness changes, massage change log ] Signed-off-by: Wake Liu <wakel@google.com> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Link: https://patch.msgid.link/20260624070223.1533167-1-wakel@google.com
2026-07-05selftests/futex: Add FUTEX_LOCK_PI owner-exiting coverageValery Borovsky
The futex functional tests cover FUTEX_LOCK_PI timeout semantics (futex_wait_timeout.c) and robust-list owner death (robust_list.c), but nothing exercises a non-robust PI owner exiting while holding the lock, nor the basic ownership / EDEADLK / unlock word semantics of FUTEX_LOCK_PI. Add futex_lock_pi_exiting.c with three tests: - lock_unlock_basic: an uncontended FUTEX_LOCK_PI puts the owner TID in the futex word, a recursive lock by the owner returns EDEADLK, and FUTEX_UNLOCK_PI clears the word. - owner_dies_with_blocked_waiter: a thread acquires a PI futex and exits while holding it; a blocked FUTEX_LOCK_PI waiter must come out cleanly (0, EOWNERDEAD or ESRCH) and own the lock when it acquires. - stress_owner_exits: repeatedly drive the same exiting-owner path. The exiting-owner retry path is where commit 210d36d892de ("futex: Clear stale exiting pointer in futex_lock_pi() retry path") fixed a stale task pointer that tripped WARN_ON_ONCE() in wait_for_owner_exiting(). That warning does not change the syscall return value, so this test does not assert on it directly; the stress loop exists to give a kernel booted with panic_on_warn=1 (as fuzzers and CI commonly run) a chance to trip on it. Signed-off-by: Valery Borovsky <vebohr@gmail.com> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Link: https://patch.msgid.link/20260607183249.246037-1-vebohr@gmail.com
2026-07-05selftests/futex: Migrate robust_list to harnessWake Liu
Migrate robust_list test to the kselftest harness framework, removing mixed legacy ksft_* API usages and passing test metadata to cloned child functions via child_args struct. Also, fix an out-of-bounds waitpid bug during multithreaded tests. [ tglx: Fixup coding style ] Signed-off-by: Wake Liu <wakel@google.com> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Link: https://patch.msgid.link/20260601065126.3623867-8-wakel@google.com
2026-07-05selftests/futex: Migrate futex_priv_hash to harnessWake Liu
Migrate futex_priv_hash test to the kselftest harness framework, removing mixed legacy ksft_* API usages and passing test metadata to all helper functions. [ tglx: Fixup coding style ] Signed-off-by: Wake Liu <wakel@google.com> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Link: https://patch.msgid.link/20260601065126.3623867-7-wakel@google.com
2026-07-05selftests/futex: Migrate futex_numa_mpol to harnessWake Liu
Migrate futex_numa_mpol test to the kselftest harness framework, removing mixed legacy ksft_* API usages and passing test metadata to helper functions. [ tglx: Fixup coding style ] Signed-off-by: Wake Liu <wakel@google.com> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Link: https://patch.msgid.link/20260601065126.3623867-6-wakel@google.com
2026-07-05selftests/futex: Migrate futex_requeue_pi_signal_restart to harnessWake Liu
Migrate futex_requeue_pi_signal_restart test to the kselftest harness framework, removing mixed legacy ksft_* API usages and ensuring proper thread joining. [ tglx: Fixup coding style ] Signed-off-by: Wake Liu <wakel@google.com> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Link: https://patch.msgid.link/20260601065126.3623867-5-wakel@google.com
2026-07-05selftests/futex: Migrate futex_requeue_pi_mismatched_ops to harnessWake Liu
Migrate futex_requeue_pi_mismatched_ops test to the kselftest harness framework, removing mixed legacy ksft_* API usages and passing test metadata to helper thread. [ tglx: Fixup coding style ] Signed-off-by: Wake Liu <wakel@google.com> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Link: https://patch.msgid.link/20260601065126.3623867-4-wakel@google.com
2026-07-05selftests/futex: Migrate futex_requeue_pi to harnessWake Liu
Migrate futex_requeue_pi test to the kselftest harness framework, removing mixed legacy ksft_* API usages and passing test metadata to all helper threads via thread arguments. [ tglx: Fixup coding style ] Signed-off-by: Wake Liu <wakel@google.com> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Link: https://patch.msgid.link/20260601065126.3623867-3-wakel@google.com
2026-07-05selftests/futex: Migrate futex_requeue to harnessWake Liu
Migrate futex_requeue test to the kselftest harness framework, removing mixed legacy ksft_* API usages and ensuring proper thread joining. [ tglx: Fixup coding style ] Signed-off-by: Wake Liu <wakel@google.com> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Link: https://patch.msgid.link/20260601065126.3623867-2-wakel@google.com
2026-07-05selftests/futex: Migrate futex_wait_uninitialized_heap to harnessWake Liu
Migrate futex_wait_uninitialized_heap test to the kselftest harness framework, removing mixed legacy ksft_* API usages and ensuring proper thread joining. [ tglx: Fixup coding style ] Signed-off-by: Wake Liu <wakel@google.com> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Link: https://patch.msgid.link/20260525092002.3762888-4-wakel@google.com
2026-07-05selftests/futex: Migrate futex_wait_private_mapped_file to harnessWake Liu
Migrate futex_wait_private_mapped_file test to the kselftest harness framework, removing mixed legacy ksft_* API usages and passing test metadata to helper thread. [ tglx: Fixup coding style ] Signed-off-by: Wake Liu <wakel@google.com> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Link: https://patch.msgid.link/20260525092002.3762888-3-wakel@google.com
2026-07-05selftests/futex: Migrate futex_wait to harnessWake Liu
Migrate futex_wait test to the kselftest harness framework, removing mixed legacy ksft_* API usages and ensuring proper thread joining. [ tglx: Fixup coding style ] Signed-off-by: Wake Liu <wakel@google.com> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Link: https://patch.msgid.link/20260525092002.3762888-2-wakel@google.com
2026-07-05selftests/futex: Correct validation logic in waitvWake Liu
In futex_waitv negative tests (invalid_flag, unaligned_address, etc.), test results are evaluated as: if (res == EINVAL) Since sys_futex_waitv returns -1 on error and sets errno, direct positive comparisons against res are always false, causing tests to silently pass regardless of real errors. Correct these validations to assert EXPECT_EQ(res, -1) and compare errno directly against expected constants. [ tglx: Fixup coding style ] Signed-off-by: Wake Liu <wakel@google.com> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Link: https://patch.msgid.link/20260526010635.23980-3-wakel@google.com
2026-07-05selftests/futex: Migrate functional tests to harnessWake Liu
Currently, multiple futex functional tests (wait_timeout, waitv, wait_wouldblock) mix low-level ksft_* logging and result APIs with the kselftest_harness.h framework. On older kernels where system calls like futex_waitv are missing (returning -ENOSYS), this mixed usage triggers framework inconsistencies, causing the test to fail with: "Illegal usage of low-level ksft APIs in harness test". Address this by completely refactoring these tests to exclusively use the high-level kselftest_harness.h framework (gtest-like API), mapping all low-level calls to native harness macros: - Non-fatal assertions: Replace ksft_test_result_fail() with EXPECT_EQ() and EXPECT_NE(). - Fatal assertions: Replace ksft_exit_fail_msg() with ASSERT_EQ() and ASSERT_TRUE() to immediately terminate execution upon setup failure. - Test skipping: Replace ksft_exit_skip() with the graceful SKIP() macro combined with early runtime availability checks for sys_futex_waitv. - Debug logging: Replace ksft_print_dbg_msg() with TH_LOG() to inherit automatic file/line context. - Success reporting: Remove explicit ksft_test_result_pass() calls, deferring to automated harness completion reporting. Additionally: - Fix a critical SIGSEGV crash in early syscall probing logic caused by passing a NULL pointer to inline user-space timespec conversions. - Introduce TEST_TIMEOUT() and GET_ABS_TIMEOUT() macros in wait_timeout to encapsulate assertions while preserving source line attribution. - Pass test metadata (_metadata) into secondary threads to allow native harness assertions during concurrent execution. [ tglx: Fixup coding style ] Signed-off-by: Wake Liu <wakel@google.com> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Link: https://patch.msgid.link/20260526010635.23980-2-wakel@google.com
2026-07-05selftests/futex: Remove static keyword from 'head'Ankit Khushwaha
'head' is defined as 'static struct robust_list_head' that stores the local variable of 'struct lock_struct a' raising the Wdangling-pointer warning. robust_list.c: In function ‘child_circular_list’: robust_list.c:522:24: warning: storing the address of local variable ‘a’ in ‘head.list.next’ [-Wdangling-pointer=] 522 | head.list.next = &a.list; | ~~~~~~~~~~~~~~~^~~~~~~~~ robust_list.c:513:28: note: ‘a’ declared here 513 | struct lock_struct a, b, c; | ^ robust_list.c:512:40: note: ‘head’ declared here 512 | static struct robust_list_head head; | ^~~~ Since 'head' doesn't need static storge duration, removing the static keyword of it to fix this. Signed-off-by: Ankit Khushwaha <ankitkhushwaha.linux@gmail.com> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Link: https://patch.msgid.link/20260420173544.55288-1-ankitkhushwaha.linux@gmail.com
2026-07-05Merge tag 'perf-urgent-2026-07-05' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip Pull perf events fixes from Ingo Molnar: - Fix a perf_event_attr::remove_on_exec bug for group events (Taeyang Lee) - Fix uprobes CALL emulation interaction with shadow stacks, and add a testcase for this (David Windsor) - Fix uprobes unregister bug (Jiri Olsa) * tag 'perf-urgent-2026-07-05' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: uprobes/x86: Use proper mm_struct in __in_uprobe_trampoline selftests/x86: Add shadow stack uprobe CALL test x86/uprobes: Keep shadow stack in sync for emulated CALLs perf/core: Detach event groups during remove_on_exec
2026-07-05selftests/alsa: Fix memory leak in find_controls error pathMalaya Kumar Rout
In find_controls(), card_data is allocated with malloc() but when snd_ctl_open_lconf() fails, the code jumps to next_card without freeing the allocated memory. This results in a memory leak for each card where snd_ctl_open_lconf() fails. Add free(card_data) before goto next_card to ensure proper cleanup of the allocated memory in the error path. Fixes: 5aaf9efffc57 ("kselftest: alsa: Add simplistic test for ALSA mixer controls kselftest") Signed-off-by: Malaya Kumar Rout <malayarout91@gmail.com> Link: https://patch.msgid.link/20260704105736.94874-1-malayarout91@gmail.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
2026-07-04perf tests: Add auto counter reload (ACR) sampling testDapeng Mi
Add auto counter reload sampling test to verify that the intended event records can be captured and the self-reloaded events won't generate any records. Signed-off-by: Dapeng Mi <dapeng1.mi@linux.intel.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
2026-07-04perf vendor events amd: Update Zen 6 core eventsSandipan Das
Update definitions for the following events. * PMCx00A - Fix descriptions * PMCx00C - Add missing unit masks * PMCx00D - Add missing unit masks and fix descriptions * PMCx013 - Fix incorrect unit masks Fixes: 2f42fb0661d9 ("perf vendor events amd: Add Zen 6 core events") Signed-off-by: Sandipan Das <sandipan.das@amd.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
2026-07-04perf vendor events amd: Update Zen 5 core eventsSandipan Das
Update definitions for the following events. * PMCx00A - Add missing unit masks * PMCx00B - Add missing unit masks and fix descriptions * PMCx00C - Add missing unit masks * PMCx00D - Add missing unit masks * PMCx025 - Add missing unit masks and fix descriptions Fixes: 45c072f2537a ("perf vendor events amd: Add Zen 5 core events") Signed-off-by: Sandipan Das <sandipan.das@amd.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
2026-07-04perf test amd ibs: avoid using executable heapOndrej Mosnacek
Making [parts of] the heap executable is dangerous and is blocked by SELinux on Fedora/RHEL even for an unconfined user. Replace the malloc() + mprotect() combo with just mmap(), creating a private anonymous rwx mapping, which only requires the more commonly allowed "execmem" permission under SELinux (things like JIT or regex compilation need it as well). mmap() with MAP_ANONYMOUS will give us a zeroed mapping that begins on a page boundary, so the result is equivalent to the original code even without a memset() or the page-alignment dance. Verified that the test still passes on a machine with an AMD CPU that has the "ibs" CPU flag. Fixes: 35db59fa8ea2 ("perf test amd ibs: Add sample period unit test") Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com> Reviewed-by: Ravi Bangoria <ravi.bangoria@amd.com> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
2026-07-04selftests/bpf: Add tests for forked/cloned optimized uprobesJiri Olsa
Adding tests for forked/cloned optimized uprobes and make sure the child can properly execute optimized probe for both fork (dups mm) and clone with CLONE_VM. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Reviewed-by: Jakub Sitnicki <jakub@cloudflare.com> Link: https://patch.msgid.link/20260703114917.238144-14-jolsa@kernel.org
2026-07-04selftests/bpf: Add tests for uprobe nop10 red zone clobberingAndrii Nakryiko
The uprobe nop5 optimization used to replace a 5-byte NOP with a 5-byte CALL to a trampoline. The CALL pushes a return address onto the stack at [rsp-8], clobbering whatever was stored there. On x86-64, the red zone is the 128 bytes below rsp that user code may use for temporary storage without adjusting rsp. Compilers can place USDT argument operands there, generating specs like "8@-8(%rbp)" when rbp == rsp. With the CALL-based optimization, the return address overwrites that argument before the BPF-side USDT argument fetch runs. Add two tests for this case. The uprobe_syscall subtest stores known values at -8(%rsp), -16(%rsp), and -24(%rsp), executes an optimized nop10 uprobe, and verifies the red-zone data is still intact. The USDT subtest triggers a probe in a function where the compiler places three USDT operands in the red zone and verifies that all 10 optimized invocations deliver the expected argument values to BPF. On an unfixed kernel, the first hit goes through the INT3 path and later hits use the optimized CALL path, so the red-zone checks fail after optimization. [ updates to use nop10 ] Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Signed-off-by: Jiri Olsa <jolsa@kernel.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Reviewed-by: Jakub Sitnicki <jakub@cloudflare.com> Link: https://patch.msgid.link/20260703114917.238144-13-jolsa@kernel.org
2026-07-04selftests/bpf: Add reattach tests for uprobe syscallJiri Olsa
Adding reattach tests for uprobe syscall tests to make sure we can re-attach and optimize same uprobe multiple times. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Link: https://patch.msgid.link/20260703114917.238144-12-jolsa@kernel.org
2026-07-04selftests/bpf: Change uprobe/usdt trigger bench code to use nop10Jiri Olsa
Changing uprobe/usdt trigger bench code to use nop10 instead of nop5. Also changing run_bench_uprobes.sh to use nop10 triggers. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Reviewed-by: Jakub Sitnicki <jakub@cloudflare.com> Link: https://patch.msgid.link/20260703114917.238144-11-jolsa@kernel.org
2026-07-04selftests/bpf: Change uprobe syscall tests to use nop10Jiri Olsa
Optimized uprobes are now on top of 10-bytes nop instructions, reflect that in existing tests. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Reviewed-by: Jakub Sitnicki <jakub@cloudflare.com> Link: https://patch.msgid.link/20260703114917.238144-10-jolsa@kernel.org
2026-07-04selftests/bpf: Emit nop,nop10 instructions combo for x86_64 archJiri Olsa
Syncing latest usdt.h change [1]. Now that we have nop10 optimization support in kernel, let's emit nop,nop10 for usdt probe. We leave it up to the library to use desirable nop instruction. [1] https://github.com/libbpf/usdt/commit/9018f82577d1dad7ed628d9efdaffc09f8f2241b Signed-off-by: Jiri Olsa <jolsa@kernel.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Reviewed-by: Jakub Sitnicki <jakub@cloudflare.com> Link: https://patch.msgid.link/20260703114917.238144-9-jolsa@kernel.org