fix(kernel): preserve invalid-offset errors in AIO completions #2143

Merged
erick-dsnk merged 1 commit from upstream-pr/2143 into main 2026-10-10 07:06:54 +00:00
erick-dsnk commented 2026-10-09 09:57:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by erick-dsnk on 2026-10-09T09:57:25Z.


What

Preserve the guest EINVAL result when a native AIO read or write completes with an invalid offset. The request stays aborted, valid requests in the same submission still complete, and aggregate queue state reflects the aborted request.

Tested

  • Linux x86-64: full libs build and incremental final-base libs build succeeded.
  • ctest --test-dir build -R '^guest_aio$' --output-on-failure --timeout 30 passed on the final commit (0.01 s).
  • The AIO test covers negative read/write offsets in single, aggregate, and multiple submissions, including successful mixed requests and unchanged file contents after failed writes.
  • With the mapping removed, the same CTest failed at the expected EINVAL assertion; restoring it and rebuilding returned the test to passing.
  • Contributor-reported Windows validation (rmz-24, Windows 11 Pro 25H2, WinLibs MinGW-w64 GCC 15.2.0 r7, Release): full build and libs succeeded; guest_aio and all 159 guest_* tests passed. Resetting Aio.cpp to base 3bd74c15 while retaining the test reproduced the expected EINVAL failure (report).

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw; silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4798881056 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2143). Originally posted by [erick-dsnk](https://github.com/erick-dsnk) on 2026-10-09T09:57:25Z. --- ### What Preserve the guest `EINVAL` result when a native AIO read or write completes with an invalid offset. The request stays aborted, valid requests in the same submission still complete, and aggregate queue state reflects the aborted request. ### Tested - Linux x86-64: full `libs` build and incremental final-base `libs` build succeeded. - `ctest --test-dir build -R '^guest_aio$' --output-on-failure --timeout 30` passed on the final commit (0.01 s). - The AIO test covers negative read/write offsets in single, aggregate, and multiple submissions, including successful mixed requests and unchanged file contents after failed writes. - With the mapping removed, the same CTest failed at the expected `EINVAL` assertion; restoring it and rebuilding returned the test to passing. - Contributor-reported Windows validation (rmz-24, Windows 11 Pro 25H2, WinLibs MinGW-w64 GCC 15.2.0 r7, Release): full build and `libs` succeeded; `guest_aio` and all 159 `guest_*` tests passed. Resetting `Aio.cpp` to base `3bd74c15` while retaining the test reproduced the expected `EINVAL` failure ([report](https://github.com/boykopovar/AnyPS5/pull/2143#issuecomment-6080278986)). ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] Unimplemented paths throw; silent stubs are listed in TechnicalDebt - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes
rmz-24 commented 2026-10-09 11:50:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by rmz-24 on 2026-10-09T11:50:36Z.


Windows results for 72b99cea, since the description notes the Windows runtime wasn't tested: Windows 11 Pro 25H2 (10.0.26200.9457), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, full build plus libs.

  • guest_aio passes.
  • All 159 guest_* tests pass.
  • With Aio.cpp reset to the base (3bd74c15) and the new test kept, guest_aio fails at GuestAio.cpp:79 (invalidReadResult.return_value == SCE_KERNEL_ERROR_EINVAL). The Windows host's negative-offset read reports EINVAL too, so the new mapping is reached on both hosts.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6080278986 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2143#issuecomment-6080278986). Originally posted by [rmz-24](https://github.com/rmz-24) on 2026-10-09T11:50:36Z. --- Windows results for 72b99cea, since the description notes the Windows runtime wasn't tested: Windows 11 Pro 25H2 (10.0.26200.9457), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, full build plus `libs`. - `guest_aio` passes. - All 159 `guest_*` tests pass. - With `Aio.cpp` reset to the base (3bd74c15) and the new test kept, `guest_aio` fails at `GuestAio.cpp:79` (`invalidReadResult.return_value == SCE_KERNEL_ERROR_EINVAL`). The Windows host's negative-offset read reports `EINVAL` too, so the new mapping is reached on both hosts. AI-assisted: yes
oneandonlydean commented 2026-10-10 03:19:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-10T03:19:17Z.


This conflicts with main after today's merges; could you rebase? It passed testing and is otherwise ready.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6093234748 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2143#issuecomment-6093234748). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-10T03:19:17Z. --- This conflicts with main after today's merges; could you rebase? It passed testing and is otherwise ready.
adriadam10 commented 2026-10-10 06:50:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T06:50:28Z.


Checked build + ctest (399 tests in the touched directories) green; guest_aio fails without the Aio.cpp change. Windows run by @rmz-24 above covers the Windows host. Conflict with main was only in GuestAio.cpp (the new Lseek before the batch writes); rebased keeping both blocks. Merging once CI is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6094823943 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2143#issuecomment-6094823943). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-10T06:50:28Z. --- Checked build + ctest (399 tests in the touched directories) green; `guest_aio` fails without the `Aio.cpp` change. Windows run by @rmz-24 above covers the Windows host. Conflict with main was only in `GuestAio.cpp` (the new `Lseek` before the batch writes); rebased keeping both blocks. Merging once CI is green.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!2143
No description provided.