| d1c656df | 12-Jul-2026 |
Miles Krause <mileskrause5200@gmail.com> |
selftests/futex: Give circular-list nodes static storage
The registered robust-list head has static storage but points at three automatic lock nodes. GCC warns about storing the address of a local v
selftests/futex: Give circular-list nodes static storage
The registered robust-list head has static storage but points at three automatic lock nodes. GCC warns about storing the address of a local variable in the static head when building the selftest with -Wall.
Give the nodes static storage as well. This keeps every object in the circular list alive through child exit without changing the list topology.
Signed-off-by: Miles Krause <mileskrause5200@gmail.com> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Reviewed-by: André Almeida <andrealmeid@igalia.com> Link: https://patch.msgid.link/20260711-futex-robust-list-static-nodes-v1-1-723754d75cf5@gmail.com
show more ...
|
| 23dd3f88 | 18-May-2026 |
Yuwen Chen <ywen.chen@foxmail.com> |
selftests/futex: Use thread synchronization helpers instead of usleep()
This test uses usleep() to delay the main thread after creating the test thread[s] under the assumption that they already are
selftests/futex: Use thread synchronization helpers instead of usleep()
This test uses usleep() to delay the main thread after creating the test thread[s] under the assumption that they already are blocked on the futex when the main thread continues.
That "works" on otherwise idle systems, but fails under load resulting in failed selftests because the requeue operation starts before the waiters reached the kernel.
Replace the usleep() waits by the new thread synchronization helpers to cure that.
[ tglx: Adapted to test harness changes, fixed coding style, sanitized the timeout handling and rewrote change log.
Co-developed-by: Edward Liaw <edliaw@google.com> Signed-off-by: Yuwen Chen <ywen.chen@foxmail.com> Signed-off-by: Edward Liaw <edliaw@google.com> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Link: https://patch.msgid.link/tencent_76B9DE9C9FE5C57F6D74B5149970DF8CCF0A@qq.com
show more ...
|
| 6c4a1b97 | 18-May-2026 |
Yuwen Chen <ywen.chen@foxmail.com> |
selftests/futex: Provide thread creation and synchronization helpers
There are timing issues in the use of threads in some selftests for futexes as the tests rely on timed waits to ensure that the o
selftests/futex: Provide thread creation and synchronization helpers
There are timing issues in the use of threads in some selftests for futexes as the tests rely on timed waits to ensure that the other test thread[s] reached the lock wait function in the kernel.
That "works" on halfways idle systems, but fails under load which results in tests failing.
Provide a set of helper functions to create test threads and to wait for them to reach the lock wait by monitoring /proc/$PID/wchan.
[ tglx: Fixup coding style, move the timeout into the helper, adapt to test harness changes and massage change log ]
Signed-off-by: Yuwen Chen <ywen.chen@foxmail.com> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Link: https://patch.msgid.link/tencent_4C90BE98BBC48B38B9FBC6A95C45CF49F309@qq.com
show more ...
|
| 50c121e5 | 24-Jun-2026 |
Wake Liu <wakel@google.com> |
selftests/futex: Dynamically skip unsupported tests
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, thes
selftests/futex: Dynamically skip unsupported tests
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
show more ...
|
| 90a0286c | 07-Jun-2026 |
Valery Borovsky <vebohr@gmail.com> |
selftests/futex: Add FUTEX_LOCK_PI owner-exiting coverage
The futex functional tests cover FUTEX_LOCK_PI timeout semantics (futex_wait_timeout.c) and robust-list owner death (robust_list.c), but not
selftests/futex: Add FUTEX_LOCK_PI owner-exiting coverage
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
show more ...
|
| 553bd67a | 01-Jun-2026 |
Wake Liu <wakel@google.com> |
selftests/futex: Migrate robust_list to harness
Migrate robust_list test to the kselftest harness framework, removing mixed legacy ksft_* API usages and passing test metadata to cloned child functio
selftests/futex: Migrate robust_list to harness
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
show more ...
|
| 4f22ba7e | 01-Jun-2026 |
Wake Liu <wakel@google.com> |
selftests/futex: Migrate futex_priv_hash to harness
Migrate futex_priv_hash test to the kselftest harness framework, removing mixed legacy ksft_* API usages and passing test metadata to all helper f
selftests/futex: Migrate futex_priv_hash to harness
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
show more ...
|
| 9b19fbb3 | 01-Jun-2026 |
Wake Liu <wakel@google.com> |
selftests/futex: Migrate futex_numa_mpol to harness
Migrate futex_numa_mpol test to the kselftest harness framework, removing mixed legacy ksft_* API usages and passing test metadata to helper funct
selftests/futex: Migrate futex_numa_mpol to harness
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
show more ...
|
| 7fe733f1 | 01-Jun-2026 |
Wake Liu <wakel@google.com> |
selftests/futex: Migrate futex_requeue_pi_signal_restart to harness
Migrate futex_requeue_pi_signal_restart test to the kselftest harness framework, removing mixed legacy ksft_* API usages and ensur
selftests/futex: Migrate futex_requeue_pi_signal_restart to harness
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
show more ...
|
| 4559deb7 | 01-Jun-2026 |
Wake Liu <wakel@google.com> |
selftests/futex: Migrate futex_requeue_pi_mismatched_ops to harness
Migrate futex_requeue_pi_mismatched_ops test to the kselftest harness framework, removing mixed legacy ksft_* API usages and passi
selftests/futex: Migrate futex_requeue_pi_mismatched_ops to harness
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
show more ...
|
| b7d837c2 | 01-Jun-2026 |
Wake Liu <wakel@google.com> |
selftests/futex: Migrate futex_requeue_pi to harness
Migrate futex_requeue_pi test to the kselftest harness framework, removing mixed legacy ksft_* API usages and passing test metadata to all helper
selftests/futex: Migrate futex_requeue_pi to harness
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
show more ...
|
| d0f7df9b | 01-Jun-2026 |
Wake Liu <wakel@google.com> |
selftests/futex: Migrate futex_requeue to harness
Migrate futex_requeue test to the kselftest harness framework, removing mixed legacy ksft_* API usages and ensuring proper thread joining.
[ tglx:
selftests/futex: Migrate futex_requeue to harness
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
show more ...
|
| 78834d8b | 25-May-2026 |
Wake Liu <wakel@google.com> |
selftests/futex: Migrate futex_wait_uninitialized_heap to harness
Migrate futex_wait_uninitialized_heap test to the kselftest harness framework, removing mixed legacy ksft_* API usages and ensuring
selftests/futex: Migrate futex_wait_uninitialized_heap to harness
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
show more ...
|
| dccef66d | 25-May-2026 |
Wake Liu <wakel@google.com> |
selftests/futex: Migrate futex_wait_private_mapped_file to harness
Migrate futex_wait_private_mapped_file test to the kselftest harness framework, removing mixed legacy ksft_* API usages and passing
selftests/futex: Migrate futex_wait_private_mapped_file to harness
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
show more ...
|
| 0d65d1ab | 25-May-2026 |
Wake Liu <wakel@google.com> |
selftests/futex: Migrate futex_wait to harness
Migrate futex_wait test to the kselftest harness framework, removing mixed legacy ksft_* API usages and ensuring proper thread joining.
[ tglx: Fixup
selftests/futex: Migrate futex_wait to harness
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
show more ...
|
| a894f6f4 | 26-May-2026 |
Wake Liu <wakel@google.com> |
selftests/futex: Correct validation logic in waitv
In futex_waitv negative tests (invalid_flag, unaligned_address, etc.), test results are evaluated as:
if (res == EINVAL)
Since sys_futex_waitv r
selftests/futex: Correct validation logic in waitv
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
show more ...
|
| e531301d | 26-May-2026 |
Wake Liu <wakel@google.com> |
selftests/futex: Migrate functional tests to harness
Currently, multiple futex functional tests (wait_timeout, waitv, wait_wouldblock) mix low-level ksft_* logging and result APIs with the kselftest
selftests/futex: Migrate functional tests to harness
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
show more ...
|
| b3749774 | 06-Mar-2026 |
Davidlohr Bueso <dave@stgolabs.net> |
selftests/futex: Bump up libnuma version check
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-b
selftests/futex: Bump up libnuma version check
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
show more ...
|
| 3814c4e1 | 02-Mar-2026 |
Nylon Chen <nylon.chen@sifive.com> |
selftests/futex: Conditionally include libnuma support
Use LIBNUMA_TEST to conditionally add -lnuma to LDLIBS. Guard numa header includes with #ifdef LIBNUMA_VER_SUFFICIENT to allow compilation with
selftests/futex: Conditionally include libnuma support
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
show more ...
|
| cd91b502 | 10-Nov-2025 |
André Almeida <andrealmeid@igalia.com> |
selftests/futex: Create test for robust list
Create a test for the robust list mechanism. Test the following uAPI operations:
- Creating a robust mutex where the lock waiter is wake by the kernel
selftests/futex: Create test for robust list
Create a test for the robust list mechanism. Test the following uAPI operations:
- Creating a robust mutex where the lock waiter is wake by the kernel when the lock owner died - Setting a robust list to the current task - Getting a robust list from the current task - Getting a robust list from another task - Using the list_op_pending field from robust_list_head struct to test robustness when the lock owner dies before completing the locking - Setting a invalid size for syscall argument `len` - Adding multiple elements to a robust list wait waiting for each of them - Creating a circular list and checking that the kernel does not get stuck in an infinity loop
Signed-off-by: André Almeida <andrealmeid@igalia.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://patch.msgid.link/20251110224130.3044761-1-andrealmeid@igalia.com
show more ...
|