futex: Add EFAULT error coverage tests
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v17 Latest2 patches 2 repliesIn review
- v162 patches 5 repliesSuperseded
- v152 patches 4 repliesSuperseded
Earlier versions · 14
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v14 | 4 patches | 8 replies | Superseded | |
| v13 | 4 patches | 1 reply | Superseded | |
| v12 | 4 patches | 1 reply | Superseded | |
| v11 | 4 patches | 1 reply | Superseded | |
| v10 | 4 patches | 1 reply | Superseded | |
| v9 | 4 patches | 1 reply | Superseded | |
| v8 | 4 patches | 1 reply | Superseded | |
| v7 | 4 patches | 1 reply | Superseded | |
| v6 | 4 patches | 2 replies | Superseded | |
| v5 | 4 patches | 1 reply | Superseded | |
| v4 | 4 patches | 9 replies | Superseded | |
| v3 | 1 patch | 1 reply | Superseded | |
| v2 | 1 patch | 2 replies | Superseded | |
| v1 | 1 patch | 1 reply | Superseded |
Changes in v17 from the cover letter
- futex_wake05: replace kernel-space address case with truncated file-backed mapping, fix comment to list format, use EFAULT directly in TST_EXP_FAIL(), add .needs_tmpdir
- futex_cmp_requeue03: use EFAULT directly in TST_EXP_FAIL()
Patches in v17 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | futex_wake05: Add EFAULT error coverage testruntest/ testcases/ testcases/ | +115 | 2 replies | |
| 2/2 | futex_cmp_requeue03: Add EFAULT error coverage testruntest/ testcases/ testcases/ | +105 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v17 yet.
Cover letter [LTP] [PATCH v17 0/2] futex: Add EFAULT error coverage tests
Hi Petr,
Thanks for the review. Here is v17 addressing your feedback.
futex_wait06 and futex_wait07 were already merged. This series contains the remaining two patches.
futex_cmp_requeue03:
Applied your nit — removed the exp_errno field from the testcase struct and used EFAULT directly in TST_EXP_FAIL().
futex_wake05:
Applied both nits (list comment format, EFAULT directly). For the kernel-space address case: you were right to question it. I couldn't confirm consistent EFAULT across kernels, so I looked for a better replacement.
I used AI assistance to research the kernel's get_user_pages() code paths and cross-referenced existing LTP mmap tests to verify the approach. The replacement I landed on is a shared file-backed mapping where the file is truncated to 0 after mmap().
The three cases now exercise genuinely different code paths:
- unmapped memory fails at find_vma() (no VMA exists)
- PROT_NONE memory fails at get_user_pages_fast() (VMA exists but page is inaccessible)
- the truncated file mapping triggers VM_FAULT_SIGBUS inside the page fault handler (filemap_fault() sees offset beyond EOF), which get_user_pages() propagates as EFAULT
The SIGBUS is never delivered to user space — get_user_pages() converts VM_FAULT_SIGBUS to -EFAULT internally. This behavior has been stable since before kernel 2.6 and works reliably on all architectures and both 32/64-bit. The test uses .needs_tmpdir = 1.
Changes since v16:
- futex_wake05: replace kernel-space address case with truncated file-backed mapping, fix comment to list format, use EFAULT directly in TST_EXP_FAIL(), add .needs_tmpdir
- futex_cmp_requeue03: use EFAULT directly in TST_EXP_FAIL()
Michael Menasherov (2):
futex_wake05: Add EFAULT error coverage test
futex_cmp_requeue03: Add EFAULT error coverage test
runtest/syscalls | 2 + testcases/kernel/syscalls/futex/.gitignore | 2 + .../syscalls/futex/futex_cmp_requeue03.c | 103 ++++++++++++++++ .../kernel/syscalls/futex/futex_wake05.c | 113 ++++++++++++++++++ 4 files changed, 220 insertions(+) create mode 100644 testcases/kernel/syscalls/futex/futex_cmp_requeue03.c create mode 100644 testcases/kernel/syscalls/futex/futex_wake05.c
Signature · 5 lines
2.55.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp