[LTP] futex_wait06: Add EFAULT error coverage test

linuxtestproject.agent@gmail.com linuxtestproject.agent@gmail.com
Mon May 25 16:15:27 CEST 2026


Hi Michael,

On Mon, 25 May 2026, Michael Menasherov wrote:
> [PATCH 1/4] futex_wait06: Add EFAULT error coverage test

> diff --git a/runtest/syscalls b/runtest/syscalls
> @@ -1907,3 +1907,4 @@ io_uring03 io_uring03
>  # Tests below may cause kernel memory leak
>  perf_event_open03 perf_event_open03
> +futex_wait06 futex_wait06

This test doesn't cause a kernel memory leak. Same issue applies to
futex_wait07, futex_wake05, and futex_cmp_requeue03 in patches 2-4.
All four entries should be placed alongside the existing futex tests
(after futex_wait_bitset01, ~line 1878), not under this comment.

[...]

--- [PATCH 3/4] futex_wake05: Add EFAULT error coverage test ---

> + * PROT_NONE memory triggers EFAULT because the kernel cannot look up
> + * the futex key for an inaccessible page.

This warrants a note: the test calls futex_wake() without
FUTEX_PRIVATE_FLAG (opflags=0), which takes the shared-futex path in
get_futex_key() and requires resolving the physical page — hence EFAULT
for PROT_NONE. That reasoning is correct for MAP_PRIVATE|MAP_ANONYMOUS
today, but the comment doesn't explain the dependency on the absence of
FUTEX_PRIVATE_FLAG. A reader might wonder why FUTEX_WAKE (which never
reads *uaddr) can return EFAULT at all. Worth a brief clarification.

[...]

The rest of the code looks correct: mmap/munmap patterns, signal
handling in futex_wait07, MAP_SHARED for the cross-process futex, and
TST_PROCESS_STATE_WAIT before SAFE_KILL are all fine. Makefile uses
wildcards so no explicit entries needed.

---
Note:

Our agent completed the review of the patch. The full review can be
found at: <review_url>

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
```

---

**Verdict: Needs revision**

Two items:
1. **All 4 patches** — runtest/syscalls entries must move out from under `# Tests below may cause kernel memory leak` and be placed with the other futex tests (~line 1878).
2. **futex_wake05** — the comment about PROT_NONE triggering EFAULT should clarify that this relies on using the shared-futex path (no `FUTEX_PRIVATE_FLAG`), since FUTEX_WAKE doesn't read `*uaddr` and the reason for EFAULT is non-obvious.


More information about the ltp mailing list