futex: Add error coverage tests for wait, wake and cmp_requeue
v14 cover futex: Add error coverage tests for wait, wake and cmp_requeue
Improve error handling coverage for futex syscalls by adding tests for missing error conditions that were previously untested.
futex_wait06 verifies EFAULT is returned when uaddr or timeout points to unmapped memory.
futex_wait07 verifies EINTR is returned when futex_wait() is interrupted by a signal.
futex_wake05 verifies EFAULT is returned when uaddr points to unmapped or PROT_NONE memory.
futex_cmp_requeue03 verifies EFAULT is returned when uaddr or uaddr2 points to unmapped or inaccessible (PROT_NONE) memory.
v14:
- futex_cmp_requeue03: add note explaining why opflags=0 (no FUTEX_PRIVATE_FLAG) is required for EFAULT to be returned
Michael Menasherov (4):
futex_wait06: Add EFAULT error coverage test
futex_wait07: Add EINTR error coverage test
futex_wake05: Add EFAULT error coverage test
futex_cmp_requeue03: Add EFAULT error coverage test
runtest/syscalls | 4 + testcases/kernel/syscalls/futex/.gitignore | 4 + .../syscalls/futex/futex_cmp_requeue03.c | 102 ++++++++++++++++++ .../kernel/syscalls/futex/futex_wait06.c | 75 +++++++++++++ .../kernel/syscalls/futex/futex_wait07.c | 89 +++++++++++++++ .../kernel/syscalls/futex/futex_wake05.c | 89 +++++++++++++++ 6 files changed, 363 insertions(+) create mode 100644 testcases/kernel/syscalls/futex/futex_cmp_requeue03.c create mode 100644 testcases/kernel/syscalls/futex/futex_wait06.c create mode 100644 testcases/kernel/syscalls/futex/futex_wait07.c create mode 100644 testcases/kernel/syscalls/futex/futex_wake05.c
Signature · 5 lines
2.54.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v14 1/4 futex_wait06: Add EFAULT error coverage test
futex(FUTEX_WAIT) has no existing test for EFAULT. Add coverage for the cases where uaddr points to unmapped memory and where the timeout pointer is invalid.
--- runtest/syscalls | 1 + testcases/kernel/syscalls/futex/.gitignore | 1 + .../kernel/syscalls/futex/futex_wait06.c | 75 +++++++++++++++++++ 3 files changed, 77 insertions(+) create mode 100644 testcases/kernel/syscalls/futex/futex_wait06.c
runtest/syscalls +1 -0
@@ -1868,6 +1868,7 @@ futex_wait02 futex_wait02 futex_wait03 futex_wait03 futex_wait04 futex_wait04 futex_wait05 futex_wait05 +futex_wait06 futex_wait06 futex_waitv01 futex_waitv01 futex_waitv02 futex_waitv02 futex_waitv03 futex_waitv03
testcases/kernel/syscalls/futex/.gitignore +1 -0
@@ -13,3 +13,4 @@ /futex_waitv01 /futex_waitv02 /futex_waitv03 +/futex_wait06
testcases/kernel/syscalls/futex/futex_wait06.c new file +75 -0
75 lines not on this page · raw message
Signature · 5 lines
2.54.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] futex_wait06: Add EFAULT error coverage test
Hi Michael,
Quoted 4 lines · Michael Menasherov
futex_wait06: Add EFAULT error coverage testfutex_wait07: Add EINTR error coverage testfutex_wake05: Add EFAULT error coverage testfutex_cmp_requeue03: Add EFAULT error coverage test
All good. Reviewed.
---
Note:
The agent can sometimes produce false positives although often its findings are genuine. If you find issues with the review, please comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v14 1/4] futex_wait06: Add EFAULT error coverage test
In reply to Michael Menasherov via ltpHi!
testcases/kernel/syscalls/futex/futex_wait06.c line 68
Quoted 4 lines
testcases/kernel/syscalls/futex/futex_wait06.c new file +4
-0+ bad =SAFE_MMAP (NULL ,getpagesize (),PROT_READ |PROT_WRITE , +MAP_PRIVATE |MAP_ANONYMOUS ,-1 ,0 ); +SAFE_MUNMAP ((void *)bad,getpagesize ()); +}
I've changed the test to use the tst_get_bad_addr() library function isntead and pushed, thanks.
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v14 2/4 futex_wait07: Add EINTR error coverage test
In reply to Michael Menasherov via ltpfutex(FUTEX_WAIT) has no existing test for EINTR. Add coverage for the case where the wait is interrupted by a signal before the futex word changes.
--- runtest/syscalls | 1 + testcases/kernel/syscalls/futex/.gitignore | 1 + .../kernel/syscalls/futex/futex_wait07.c | 89 +++++++++++++++++++ 3 files changed, 91 insertions(+) create mode 100644 testcases/kernel/syscalls/futex/futex_wait07.c
runtest/syscalls +1 -0
@@ -1869,6 +1869,7 @@ futex_wait03 futex_wait03 futex_wait04 futex_wait04 futex_wait05 futex_wait05 futex_wait06 futex_wait06 +futex_wait07 futex_wait07 futex_waitv01 futex_waitv01 futex_waitv02 futex_waitv02 futex_waitv03 futex_waitv03
testcases/kernel/syscalls/futex/.gitignore +1 -0
@@ -14,3 +14,4 @@ /futex_waitv02 /futex_waitv03 /futex_wait06 +/futex_wait07
testcases/kernel/syscalls/futex/futex_wait07.c new file +89 -0
89 lines not on this page · raw message
Signature · 5 lines
2.54.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v14 2/4] futex_wait07: Add EINTR error coverage test
Hi!
Pushed, thanks.
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v14 3/4 futex_wake05: Add EFAULT error coverage test
In reply to Michael Menasherov via ltpfutex(FUTEX_WAKE) has no existing test for EFAULT. Add coverage for the cases where uaddr points to unmapped or PROT_NONE memory.
--- runtest/syscalls | 1 + testcases/kernel/syscalls/futex/.gitignore | 1 + .../kernel/syscalls/futex/futex_wake05.c | 89 +++++++++++++++++++ 3 files changed, 91 insertions(+) create mode 100644 testcases/kernel/syscalls/futex/futex_wake05.c
runtest/syscalls +1 -0
@@ -1877,6 +1877,7 @@ futex_wake01 futex_wake01 futex_wake02 futex_wake02 futex_wake03 futex_wake03 futex_wake04 futex_wake04 +futex_wake05 futex_wake05 futex_wait_bitset01 futex_wait_bitset01 memfd_create01 memfd_create01
testcases/kernel/syscalls/futex/.gitignore +1 -0
@@ -15,3 +15,4 @@ /futex_waitv03 /futex_wait06 /futex_wait07 +/futex_wake05
testcases/kernel/syscalls/futex/futex_wake05.c new file +89 -0
89 lines not on this page · raw message
Signature · 5 lines
2.54.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v14 3/4] futex_wake05: Add EFAULT error coverage test
Hi!
Quoted 4 lines
testcases/kernel/syscalls/futex/futex_wake05.c new file +4
-0+// SPDX-License-Identifier: GPL-2.0-or-later +/* +* Copyright (C) 2026 Red Hat, Inc. +* Copyright (C) 2026 Michael Menasherov <[email protected]>
testcases/kernel/syscalls/futex/futex_wake05.c line 14
Quoted 10 lines
testcases/kernel/syscalls/futex/futex_wake05.c new file +10
-0+*/ + +/*\ +* Check that futex(FUTEX_WAKE) returns EFAULT when uaddr points to +* unmapped or PROT_NONE memory. +* +* The test uses opflags=0 (no FUTEX_PRIVATE_FLAG), so futex_wake() takes +* the shared-futex path in get_futex_key() which must resolve the physical +* page. For PROT_NONE memory this page lookup fails with EFAULT, even though +* futex_wake() never reads *uaddr.
Maybe this should be more explicit and say that the unmapped address takes different codepath than the PROT_NONE one. I had to check the get_futex_key() to realize that this is one of the syscalls where different types of EFAULT memory actually matters.
Also we have specific EFAULT handling for kernel addresses at the start of the futex, so figuring out a kernel address and passing it to the syscall would be a good idea as well.
Also there is a lot of NUMA specific code in there, so adding one more test that requires NUMA and tries to hit the NUMA specific codepaths would make sense as well.
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v14 4/4 futex_cmp_requeue03: Add EFAULT error coverage test
In reply to Michael Menasherov via ltpfutex(FUTEX_CMP_REQUEUE) has no existing test for EFAULT. Add coverage for the cases where uaddr or uaddr2 points to unmapped or inaccessible (PROT_NONE) memory.
--- runtest/syscalls | 1 + testcases/kernel/syscalls/futex/.gitignore | 1 + .../syscalls/futex/futex_cmp_requeue03.c | 102 ++++++++++++++++++ 3 files changed, 104 insertions(+) create mode 100644 testcases/kernel/syscalls/futex/futex_cmp_requeue03.c
runtest/syscalls +1 -0
@@ -1863,6 +1863,7 @@ perf_event_open02 perf_event_open02 futex_cmp_requeue01 futex_cmp_requeue01 futex_cmp_requeue02 futex_cmp_requeue02 +futex_cmp_requeue03 futex_cmp_requeue03 futex_wait01 futex_wait01 futex_wait02 futex_wait02 futex_wait03 futex_wait03
testcases/kernel/syscalls/futex/.gitignore +1 -0
@@ -16,3 +16,4 @@ /futex_wait06 /futex_wait07 /futex_wake05 +/futex_cmp_requeue03
testcases/kernel/syscalls/futex/futex_cmp_requeue03.c new file +102 -0
102 lines not on this page · raw message
Signature · 5 lines
2.54.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi,
Just a kind reminder about this patch series (v14) sent on May 27th. The LTP AI Reviewer has approved all four patches with no issues found.
Would appreciate it if a human maintainer could take a look when time permits.
GitHub PR: https://github.com/linux-test-project/ltp/pull/1301
Thanks,
Michael Menasherov
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi,
Just following up on this patch series which has been in review since April 12th. We are now on v14 and all previous review comments have been fully addressed. The LTP AI Reviewer has approved all four patches with no issues found.
I understand maintainers are busy, but would really appreciate someone taking a look at this when time permits.
GitHub PR: https://github.com/linux-test-project/ltp/pull/1301
Thanks,
Michael Menasherov
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi,
Following up on this patch series (v14) sent on May 27th. The LTP AI Reviewer has approved all four patches with no issues found, and all previous review comments have been fully addressed.
I noticed master hasn't had merges since May 13th — is there a freeze or quiet period I should be aware of? Happy to wait if so, just want to make sure the series isn't lost in the queue.
GitHub PR: https://github.com/linux-test-project/ltp/pull/1301
Thanks,
Michael Menasherov
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
Quoted 7 lines
Following up on this patch series (v14) sent on May 27th. The LTP AI Reviewer has approved all four patches with no issues found, and all previous review comments have been fully addressed.
I noticed master hasn't had merges since May 13th — is there a freeze or quiet period I should be aware of? Happy to wait if so, just want to make sure the series isn't lost in the queue.
Sorry for not replying earlier, we were mostly working on May stable release during May, hence no new features were reviewed and it took some time to get back to the backlog that accumulated during the release.
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp