selftests/futex: Create test for robust list
André Almeida
reviewerPATCH v6 1/1 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
---
Changes from v5:
- use kselftest_harness.h
- make functions local
- removed casting of void pointers
- whenever a child thread fails, returns -1 immediately
- parent thread checks child returns for test success
- sleep(1) -> usleep(100)
- Use reverse tree ordering, and tabular arrangment
- ASSERT(*futex | FUTEX_OWNER_DIED) -> ASSERT(*futex & FUTEX_OWNER_DIED)
--- .../selftests/futex/functional/.gitignore | 1 + .../selftests/futex/functional/Makefile | 3 +- .../selftests/futex/functional/robust_list.c | 552 ++++++++++++++++++ 3 files changed, 555 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/futex/functional/robust_list.c
tools/testing/selftests/futex/functional/.gitignore +1 -0
@@ -12,3 +12,4 @@ futex_wait_uninitialized_heap futex_wait_wouldblock futex_waitv futex_numa +robust_list
tools/testing/selftests/futex/functional/Makefile +2 -1
@@ -22,7 +22,8 @@ TEST_GEN_PROGS := \ futex_priv_hash \ futex_numa_mpol \ futex_waitv \ - futex_numa + futex_numa \ + robust_list TEST_PROGS := run.sh
tools/testing/selftests/futex/functional/robust_list.c new file +552 -0
552 lines not on this page · raw message
Signature · 1 line
2.51.2
The following commit has been merged into the locking/futex branch of tip:
The following commit has been merged into the locking/futex branch of tip:
Commit-ID: cd91b502f1b4bb81e82fbae38678c698ee5ac026 Gitweb: https://git.kernel.org/tip/cd91b502f1b4bb81e82fbae38678c698ee5ac026 Author: André Almeida <[email protected]> AuthorDate: Mon, 10 Nov 2025 19:41:30 -03:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Fri, 14 Nov 2025 14:39:37 +01:00
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
--- tools/testing/selftests/futex/functional/.gitignore | 1 +- tools/testing/selftests/futex/functional/Makefile | 3 +- tools/testing/selftests/futex/functional/robust_list.c | 552 ++++++++- 3 files changed, 555 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/futex/functional/robust_list.c
tools/testing/selftests/futex/functional/.gitignore +1 -0
@@ -12,3 +12,4 @@ futex_wait_uninitialized_heap futex_wait_wouldblock futex_waitv futex_numa +robust_list
tools/testing/selftests/futex/functional/Makefile +2 -1
@@ -22,7 +22,8 @@ TEST_GEN_PROGS := \ futex_priv_hash \ futex_numa_mpol \ futex_waitv \ - futex_numa + futex_numa \ + robust_list TEST_PROGS := run.sh
tools/testing/selftests/futex/functional/robust_list.c new file +552 -0
552 lines not on this page · raw message