fix(libkernel_sys): read and write the aiocb of aio_read, aio_write and aio_fsync as FreeBSD's aio_aqueue does #14403

Merged
roboterspinne merged 6 commits from upstream-pr/14403 into main 2026-11-07 10:26:13 +00:00
roboterspinne commented 2026-11-01 11:35:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by roboterspinne on 2026-11-01T11:35:00Z.


What

On 26fa1212b8 (line numbers below refer to it) aio_read, aio_write and aio_fsync go to Queue() (core/libs/prx/libkernel_sys/Aio.cpp:208-219), which handles only a null aiocb (line 152), then stores status, error and kernelinfo straight into the guest aiocb (156-158, 160, 182, 184) and copies it with const GuestAiocb request = *user; (164); Consume() (133-140), reached from aio_return and aio_waitcomplete, stores error and status the same way. An aiocb at a bad address such as 0x10, an aiocb in a read-only page, or a completed request whose aiocb became read-only therefore crashes the host process (FATAL: unhandled exception 0xc0000005, exit 139) instead of failing. FreeBSD 11.4's aio_aqueue sets up the process's aio state first (1466-1467), makes the first status/error/kernelinfo stores without checking them (1471-1473), checks the queue limit for EAGAIN (1475-1479), copies the aiocb in and fails with EFAULT when that faults (1484-1489), fails with EINVAL without queuing when the kernelinfo store faults after the descriptor, opcode and offset checks (1576-1580), and ignores the EINPROGRESS store (1609) and the error store at aqueue_fail (1650); kern_aio_return and kern_aio_waitcomplete store error and status with suword and ignore the result. The library's debt entry (docs/dev/debt/libkernel_sys.md:357) already says the aio rules follow FreeBSD 11 vfs_aio.c, and the existing check aio_read(nullptr) gives EFAULT (core/libs/tests/GuestKernelSysAio.cpp:76) already encodes the copy-in rule, for null only.

  • Rule. Queue() follows aio_aqueue: it sets aio.used first; every store into the aiocb goes through GuestCopyOut_nid_no_patch with the result ignored, via a small Store helper that takes the aiocb, a pointer to the member and the member's own type and forms the field's address as integer arithmetic from the aiocb pointer, so a null aiocb never forms a member address; the aiocb is read with GuestCopyIn_nid_no_patch, and a failed copy stores EFAULT (ignored) and fails with EFAULT; a failed kernelinfo store fails with EINVAL and does not queue the request. The separate null check is gone: GuestCopyIn_nid_no_patch fails for address 0 (core/libs/prx/libc/src/General.cpp:856-860), so null still gives EFAULT, and the queue-full EAGAIN now comes first, as in FreeBSD. Consume() stores error and then status through GuestCopyOut_nid_no_patch and ignores the result. The order of the other checks and every result for a valid aiocb are unchanged. The checked copies are the existing helpers: on Windows VirtualQuery and ReadProcessMemory plus the GuestArena::HostWrite guard, so write-tracked guest pages still count as writable; on Linux process_vm_readv/process_vm_writev; on macOS mach_vm_read_overwrite/mach_vm_write. The debt entry now also says that a bad pointer passed to aio_error, aio_suspend or aio_waitcomplete still crashes the host; those are left for a follow-up, since changing aio_error would change its null result and #11416 rewrites aio_suspend and aio_waitcomplete.
  • Tests. Validation() in GuestKernelSysAio.cpp gains four checks, with page helpers in the #ifdef _WIN32 VirtualAlloc/VirtualProtect, else mmap/mprotect, style of GuestFileVectorMemory.cpp: an aiocb at 0x10 gives -1/EFAULT; an aiocb whose last 40 bytes run into a no-access page gives -1/EFAULT, with status -1 and error EFAULT stored in its readable part; a fully valid read request in a read-only page gives -1/EINVAL and is not queued (status keeps its 0 and aio_error returns EINVAL); a completed request whose page is then made read-only still returns its status from aio_return, keeps its old status and error, and a second aio_return gives EINVAL.
  • Overlap. pr_overlap.py --branch reports shared lines only in docs/dev/debt/libkernel_sys.md with #13286, and no shared exports or new files: #13286 changes the readlink entry just above this branch's aio entry, so a merge after it is a one-line conflict resolved by keeping both entries; it does not touch Aio.cpp, its test or the aio entry itself. #10625, which added the symlink entry just below the aio entry, is merged; the merge of main (b28bb77217) into this branch keeps both entries. It cannot compare #9019, #9162, #9297, #9302, #12130, #12642, #13129, #13253, #13256, #14101, #14212 and #14299, which also change that debt file but do not merge with main. Checked by hand: a trial merge of this branch with each of them conflicts in exactly the files that main (b28bb77217) with it already conflicts in, so this branch adds no conflict.

Tested

Windows 11, WinLibs GCC 15.2.0, Ninja, Release, BUILD_TESTING=ON, on 28af4b5e97 (based on 26fa1212b8):

  • cmake --build build --parallel 6 --target guest_kernel_sys_aio_tests, then build/tests/guest_kernel_sys_aio_tests.exe with build/core/libs/libs/unpatched and the WinLibs bin first on PATH. On untouched 26fa1212b8 the test without the new checks prints guest_kernel_sys_aio passed (0.32 s).
  • Counter-check: with the new test file and the untouched Aio.cpp, each new check fails.
    • The 0x10 check: FATAL: unhandled exception 0xc0000005, rip ... libkernel_sys.prx+0x1301f, write of 0x0000000000000058, exit 139.
    • With the earlier new checks left out, the straddling aiocb: check failed at line 123 (the straddling check; the variant file is one line shorter), exit 1: the old code does not fault there, but the call's result is not -1/EFAULT with status -1 and error EFAULT.
    • The read-only aiocb: write of 0x...2048 at libkernel_sys.prx+0x1301f, exit 139.
    • The completed request made read-only: write of 0x...3038 at libkernel_sys.prx+0x123ed (in Consume), exit 139.
  • With this change: guest_kernel_sys_aio passed, exit 0, 0.19 s; 10 consecutive runs all passed. ctest --test-dir build -R '^guest_kernel_sys_aio$': 1/1 passed.
  • Follow-up commit a59f3d947c changes only how Store forms the field address (a pointer to the member and integer arithmetic instead of &user->field); the order and every result stay the same. On a59f3d947c, cmake --build build --parallel 6 --target guest_kernel_sys_aio_tests, then ctest --test-dir build -R '^guest_kernel_sys_aio$' --output-on-failure: 1/1 passed (0.14 s), which includes the null aiocb check aio_read(nullptr) -> -1/EFAULT at line 117 of core/libs/tests/GuestKernelSysAio.cpp.
  • Not run: a UBSan build of the project (WinLibs GCC has no libubsan). The Store shape was checked with a stand-alone probe built with -fsanitize=undefined -fno-sanitize=vptr -fsanitize-trap=all (GCC 15.2.0): the shape of 28af4b5e97 traps on a null aiocb (Illegal instruction, exit 132), the shape of a59f3d947c returns -1 without a trap.
  • Merge of main b28bb77217 into this branch (2dbd3cdfed; the debt-file conflict with the merged #10625 is resolved by keeping both entries, and main's change to the AIO waits in Aio.cpp and its test, adef5635c8, merges without conflict): cmake --build build --parallel 6 --target guest_kernel_sys_aio_tests, then ctest --test-dir build -R '^guest_kernel_sys_aio$' --output-on-failure: 1/1 passed (0.23 s).
  • Merge of main 4f41f4c375 into this branch (aeaf5fda38; no conflicts, and among this branch's files main changed only docs/dev/debt/libkernel_sys.md since b28bb77217): cmake --build build --parallel 6 --target guest_kernel_sys_aio_tests, then ctest --test-dir build -R '^guest_kernel_sys_aio$' --output-on-failure: 1/1 passed (0.13 s). The hosted Windows job at aeaf5fda38 (job 125879104155) runs it: 1/1 Test #654: guest_kernel_sys_aio ... Passed 0.34 sec. The job at 2dbd3cdfed built the test but ran conventions_git_errors (Test #54), because main then lacked #14413 and the CTest index file lost its last digit.
  • python tools/check_conventions.py --base 4f41f4c375 --head HEAD with this title and description passed.
  • Not run: the Linux and macOS checked-copy paths (process_vm_writev/mprotect and mach_vm_write), since there is no such host here.

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 (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes (Claude Code)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5106948007 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14403). Originally posted by [roboterspinne](https://github.com/roboterspinne) on 2026-11-01T11:35:00Z. --- ### What On 26fa1212b8 (line numbers below refer to it) `aio_read`, `aio_write` and `aio_fsync` go to `Queue()` (`core/libs/prx/libkernel_sys/Aio.cpp:208-219`), which handles only a null aiocb (line 152), then stores `status`, `error` and `kernelinfo` straight into the guest aiocb (156-158, 160, 182, 184) and copies it with `const GuestAiocb request = *user;` (164); `Consume()` (133-140), reached from `aio_return` and `aio_waitcomplete`, stores `error` and `status` the same way. An aiocb at a bad address such as 0x10, an aiocb in a read-only page, or a completed request whose aiocb became read-only therefore crashes the host process (`FATAL: unhandled exception 0xc0000005`, exit 139) instead of failing. FreeBSD 11.4's [`aio_aqueue`](https://github.com/freebsd/freebsd-src/blob/8c639945a44588f6cfdddfb057bb5aad88735da0/sys/kern/vfs_aio.c#L1451-L1650) sets up the process's aio state first (1466-1467), makes the first `status`/`error`/`kernelinfo` stores without checking them (1471-1473), checks the queue limit for `EAGAIN` (1475-1479), copies the aiocb in and fails with `EFAULT` when that faults (1484-1489), fails with `EINVAL` without queuing when the `kernelinfo` store faults after the descriptor, opcode and offset checks (1576-1580), and ignores the `EINPROGRESS` store (1609) and the error store at `aqueue_fail` (1650); [`kern_aio_return`](https://github.com/freebsd/freebsd-src/blob/8c639945a44588f6cfdddfb057bb5aad88735da0/sys/kern/vfs_aio.c#L1852-L1853) and [`kern_aio_waitcomplete`](https://github.com/freebsd/freebsd-src/blob/8c639945a44588f6cfdddfb057bb5aad88735da0/sys/kern/vfs_aio.c#L2447-L2448) store `error` and `status` with `suword` and ignore the result. The library's debt entry (`docs/dev/debt/libkernel_sys.md:357`) already says the aio rules follow FreeBSD 11 `vfs_aio.c`, and the existing check `aio_read(nullptr)` gives `EFAULT` (`core/libs/tests/GuestKernelSysAio.cpp:76`) already encodes the copy-in rule, for null only. - **Rule.** `Queue()` follows `aio_aqueue`: it sets `aio.used` first; every store into the aiocb goes through `GuestCopyOut_nid_no_patch` with the result ignored, via a small `Store` helper that takes the aiocb, a pointer to the member and the member's own type and forms the field's address as integer arithmetic from the aiocb pointer, so a null aiocb never forms a member address; the aiocb is read with `GuestCopyIn_nid_no_patch`, and a failed copy stores `EFAULT` (ignored) and fails with `EFAULT`; a failed `kernelinfo` store fails with `EINVAL` and does not queue the request. The separate null check is gone: `GuestCopyIn_nid_no_patch` fails for address 0 (`core/libs/prx/libc/src/General.cpp:856-860`), so null still gives `EFAULT`, and the queue-full `EAGAIN` now comes first, as in FreeBSD. `Consume()` stores `error` and then `status` through `GuestCopyOut_nid_no_patch` and ignores the result. The order of the other checks and every result for a valid aiocb are unchanged. The checked copies are the existing helpers: on Windows `VirtualQuery` and `ReadProcessMemory` plus the `GuestArena::HostWrite` guard, so write-tracked guest pages still count as writable; on Linux `process_vm_readv`/`process_vm_writev`; on macOS `mach_vm_read_overwrite`/`mach_vm_write`. The debt entry now also says that a bad pointer passed to `aio_error`, `aio_suspend` or `aio_waitcomplete` still crashes the host; those are left for a follow-up, since changing `aio_error` would change its null result and #11416 rewrites `aio_suspend` and `aio_waitcomplete`. - **Tests.** `Validation()` in `GuestKernelSysAio.cpp` gains four checks, with page helpers in the `#ifdef _WIN32` `VirtualAlloc`/`VirtualProtect`, else `mmap`/`mprotect`, style of `GuestFileVectorMemory.cpp`: an aiocb at 0x10 gives `-1`/`EFAULT`; an aiocb whose last 40 bytes run into a no-access page gives `-1`/`EFAULT`, with `status` -1 and `error` `EFAULT` stored in its readable part; a fully valid read request in a read-only page gives `-1`/`EINVAL` and is not queued (`status` keeps its 0 and `aio_error` returns `EINVAL`); a completed request whose page is then made read-only still returns its status from `aio_return`, keeps its old `status` and `error`, and a second `aio_return` gives `EINVAL`. - **Overlap.** `pr_overlap.py --branch` reports shared lines only in `docs/dev/debt/libkernel_sys.md` with #13286, and no shared exports or new files: #13286 changes the `readlink` entry just above this branch's aio entry, so a merge after it is a one-line conflict resolved by keeping both entries; it does not touch `Aio.cpp`, its test or the aio entry itself. #10625, which added the `symlink` entry just below the aio entry, is merged; the merge of `main` (b28bb77217) into this branch keeps both entries. It cannot compare #9019, #9162, #9297, #9302, #12130, #12642, #13129, #13253, #13256, #14101, #14212 and #14299, which also change that debt file but do not merge with `main`. Checked by hand: a trial merge of this branch with each of them conflicts in exactly the files that `main` (b28bb77217) with it already conflicts in, so this branch adds no conflict. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Windows 11, WinLibs GCC 15.2.0, Ninja, Release, `BUILD_TESTING=ON`, on 28af4b5e97 (based on 26fa1212b8): - `cmake --build build --parallel 6 --target guest_kernel_sys_aio_tests`, then `build/tests/guest_kernel_sys_aio_tests.exe` with `build/core/libs/libs/unpatched` and the WinLibs `bin` first on `PATH`. On untouched 26fa1212b8 the test without the new checks prints `guest_kernel_sys_aio passed` (0.32 s). - Counter-check: with the new test file and the untouched `Aio.cpp`, each new check fails. - The 0x10 check: `FATAL: unhandled exception 0xc0000005`, `rip ... libkernel_sys.prx+0x1301f`, `write of 0x0000000000000058`, exit 139. - With the earlier new checks left out, the straddling aiocb: `check failed at line 123` (the straddling check; the variant file is one line shorter), exit 1: the old code does not fault there, but the call's result is not `-1`/`EFAULT` with `status` -1 and `error` `EFAULT`. - The read-only aiocb: `write of 0x...2048` at `libkernel_sys.prx+0x1301f`, exit 139. - The completed request made read-only: `write of 0x...3038` at `libkernel_sys.prx+0x123ed` (in `Consume`), exit 139. - With this change: `guest_kernel_sys_aio passed`, exit 0, 0.19 s; 10 consecutive runs all passed. `ctest --test-dir build -R '^guest_kernel_sys_aio$'`: 1/1 passed. - Follow-up commit a59f3d947c changes only how `Store` forms the field address (a pointer to the member and integer arithmetic instead of `&user->field`); the order and every result stay the same. On a59f3d947c, `cmake --build build --parallel 6 --target guest_kernel_sys_aio_tests`, then `ctest --test-dir build -R '^guest_kernel_sys_aio$' --output-on-failure`: 1/1 passed (0.14 s), which includes the null aiocb check `aio_read(nullptr)` -> `-1`/`EFAULT` at line 117 of `core/libs/tests/GuestKernelSysAio.cpp`. - Not run: a UBSan build of the project (WinLibs GCC has no libubsan). The `Store` shape was checked with a stand-alone probe built with `-fsanitize=undefined -fno-sanitize=vptr -fsanitize-trap=all` (GCC 15.2.0): the shape of 28af4b5e97 traps on a null aiocb (`Illegal instruction`, exit 132), the shape of a59f3d947c returns `-1` without a trap. - Merge of `main` b28bb77217 into this branch (2dbd3cdfed; the debt-file conflict with the merged #10625 is resolved by keeping both entries, and `main`'s change to the AIO waits in `Aio.cpp` and its test, adef5635c8, merges without conflict): `cmake --build build --parallel 6 --target guest_kernel_sys_aio_tests`, then `ctest --test-dir build -R '^guest_kernel_sys_aio$' --output-on-failure`: 1/1 passed (0.23 s). - Merge of `main` 4f41f4c375 into this branch (aeaf5fda38; no conflicts, and among this branch's files `main` changed only `docs/dev/debt/libkernel_sys.md` since b28bb77217): `cmake --build build --parallel 6 --target guest_kernel_sys_aio_tests`, then `ctest --test-dir build -R '^guest_kernel_sys_aio$' --output-on-failure`: 1/1 passed (0.13 s). The hosted Windows job at aeaf5fda38 ([job 125879104155](https://github.com/boykopovar/AnyPS5/actions/runs/41624714008/job/125879104155)) runs it: `1/1 Test #654: guest_kernel_sys_aio ... Passed 0.34 sec`. The job at 2dbd3cdfed built the test but ran `conventions_git_errors` (Test #54), because `main` then lacked #14413 and the CTest index file lost its last digit. - `python tools/check_conventions.py --base 4f41f4c375 --head HEAD` with this title and description passed. - Not run: the Linux and macOS checked-copy paths (`process_vm_writev`/`mprotect` and `mach_vm_write`), since there is no such host here. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: <!-- #PR, or none --> none - [x] Fixes: <!-- issue it closes as Fixes #N, or none --> none - [x] Unblocks: <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> none - [x] GPUs tested: <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> n/a - [x] AI-assisted: <!-- yes / no --> yes (Claude Code)
MarcZX10 commented 2026-11-01 12:01:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-01T12:01:51Z.

Review: COMMENTED


Reviewed — no blocking findings

The aio change reads correctly from source, but the NULL-pointer rejection in Queue was removed and no test covers a NULL request; approval waits for the hosted Windows run at 28af4b5e97.

What I ran

Exact head 28af4b5e97bfe4b9dd59a826c000d51946e91d0e; PR base b2620e56d114ef053f8b45433b1d48aff7ec37ba, unchanged at completion. No build and no test run. Commands:

python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14403
python3 tools/pr_abi_audit.py --base b2620e56d114ef053f8b45433b1d48aff7ec37ba --head 28af4b5e97bfe4b9dd59a826c000d51946e91d0e --json
python3 tools/pr_test_quality.py --root <git archive of 28af4b5e97: core/libs/tests, core/libs/prx/libkernel_sys, core/libs/prx/libc, core/libs/CMakeLists.txt> --json core/libs/tests/GuestKernelSysAio.cpp

The precheck's ABI and test-quality helpers were missing from the isolated head tree, so I ran both by hand from /marc/AnyPS5/tools.

Results

Check Result
Diff check, conventions and PR template (precheck) Passed
Live dependency and mergeability (precheck) Passed
ABI audit (by hand) Passed, 0 findings; lexical only
Test-quality heuristic (by hand) One possible-unregistered-cpp-test finding for GuestKernelSysAio.cpp; false positive, because CMake registers guest_kernel_sys_aio_tests at core/libs/CMakeLists.txt L1144
Hosted conventions and labels Success
Hosted Windows Not complete at review time
Hosted relinker and Linux Skipped or not applicable to this change

Findings

Blocking: none.

Non-blocking:

  1. Queue in Aio.cpp no longer rejects a NULL user before it takes the lock and sets aio.used = true (Aio.cpp L156-L162 at this head). The Store(&user->status, ...) calls then form &user->status from a null pointer, which is undefined behaviour in C++ and a null member access that UBSan reports. A NULL request still ends in EFAULT, because GuestCopyIn_nid_no_patch returns false for a zero source address (General.cpp L856-L861 at this head). The new test only passes address 0x10, so the NULL path is not pinned. Suggested fix: restore if (user == nullptr) return Fail(GuestEfault); before the lock, and add a NULL case that asserts EFAULT and an unchanged aio.used.

Sources

Not verified

  • No build and no run of guest_kernel_sys_aio_tests on any platform; the hosted Windows run at this head was not complete at review time.
  • The NULL behaviour was reasoned from source, not executed.
  • Console behaviour of aio_read, aio_write and aio_fsync is not checked here.

To get this to a good state

The NULL-pointer suggestion above is non-blocking. The remaining gate is the hosted Windows run at 28af4b5e97; the same checks will be rerun if the head changes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5727937853 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14403#pullrequestreview-5727937853). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-01T12:01:51Z. **Review:** COMMENTED --- # Reviewed — no blocking findings The aio change reads correctly from source, but the NULL-pointer rejection in `Queue` was removed and no test covers a NULL request; approval waits for the hosted Windows run at `28af4b5e97`. ## What I ran Exact head `28af4b5e97bfe4b9dd59a826c000d51946e91d0e`; PR base `b2620e56d114ef053f8b45433b1d48aff7ec37ba`, unchanged at completion. No build and no test run. Commands: ```sh python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14403 python3 tools/pr_abi_audit.py --base b2620e56d114ef053f8b45433b1d48aff7ec37ba --head 28af4b5e97bfe4b9dd59a826c000d51946e91d0e --json python3 tools/pr_test_quality.py --root <git archive of 28af4b5e97: core/libs/tests, core/libs/prx/libkernel_sys, core/libs/prx/libc, core/libs/CMakeLists.txt> --json core/libs/tests/GuestKernelSysAio.cpp ``` The precheck's ABI and test-quality helpers were missing from the isolated head tree, so I ran both by hand from `/marc/AnyPS5/tools`. ## Results | Check | Result | |---|---| | Diff check, conventions and PR template (precheck) | Passed | | Live dependency and mergeability (precheck) | Passed | | ABI audit (by hand) | Passed, 0 findings; lexical only | | Test-quality heuristic (by hand) | One `possible-unregistered-cpp-test` finding for `GuestKernelSysAio.cpp`; false positive, because CMake registers `guest_kernel_sys_aio_tests` at `core/libs/CMakeLists.txt` L1144 | | Hosted conventions and labels | Success | | Hosted Windows | Not complete at review time | | Hosted relinker and Linux | Skipped or not applicable to this change | ## Findings **Blocking:** none. **Non-blocking:** 1. `Queue` in `Aio.cpp` no longer rejects a NULL `user` before it takes the lock and sets `aio.used = true` ([Aio.cpp L156-L162 at this head](https://github.com/boykopovar/AnyPS5/blob/28af4b5e97bfe4b9dd59a826c000d51946e91d0e/core/libs/prx/libkernel_sys/Aio.cpp#L156-L162)). The `Store(&user->status, ...)` calls then form `&user->status` from a null pointer, which is undefined behaviour in C++ and a null member access that UBSan reports. A NULL request still ends in EFAULT, because `GuestCopyIn_nid_no_patch` returns false for a zero source address ([General.cpp L856-L861 at this head](https://github.com/boykopovar/AnyPS5/blob/28af4b5e97bfe4b9dd59a826c000d51946e91d0e/core/libs/prx/libc/src/General.cpp#L856-L861)). The new test only passes address `0x10`, so the NULL path is not pinned. Suggested fix: restore `if (user == nullptr) return Fail(GuestEfault);` before the lock, and add a NULL case that asserts EFAULT and an unchanged `aio.used`. ## Sources - [`Queue` at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/28af4b5e97bfe4b9dd59a826c000d51946e91d0e/core/libs/prx/libkernel_sys/Aio.cpp#L156-L162) - [`GuestCopyIn_nid_no_patch` at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/28af4b5e97bfe4b9dd59a826c000d51946e91d0e/core/libs/prx/libc/src/General.cpp#L856-L861) ## Not verified - No build and no run of `guest_kernel_sys_aio_tests` on any platform; the hosted Windows run at this head was not complete at review time. - The NULL behaviour was reasoned from source, not executed. - Console behaviour of `aio_read`, `aio_write` and `aio_fsync` is not checked here. ## To get this to a good state The NULL-pointer suggestion above is non-blocking. The remaining gate is the hosted Windows run at `28af4b5e97`; the same checks will be rerun if the head changes.
MarcZX10 commented 2026-11-01 12:17:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-01T12:17:20Z.

Review: APPROVED


Reviewed — looks good

The aio change is correct at 28af4b5e97, and the hosted Windows run for this exact head passed guest_kernel_sys_aio_tests, which was the remaining gate in my earlier comment.

What I ran

Exact head 28af4b5e97bfe4b9dd59a826c000d51946e91d0e; PR base b2620e56d114ef053f8b45433b1d48aff7ec37ba, unchanged at completion. No build and no local test run. Commands:

python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14403
python3 tools/pr_abi_audit.py --base b2620e56d114ef053f8b45433b1d48aff7ec37ba --head 28af4b5e97bfe4b9dd59a826c000d51946e91d0e --json

The precheck's ABI and test-quality helpers were missing from the isolated head tree; the ABI helper was run by hand from /marc/AnyPS5/tools.

Results

Check Result
Diff check, conventions and PR template (precheck) Passed
Live dependency and mergeability (precheck) Passed
ABI audit (by hand) Passed, 0 findings; lexical only
Test-quality heuristic (by hand) One path false positive; the test is registered at core/libs/CMakeLists.txt L1144
Hosted Windows, job at this head Success; guest_kernel_sys_aio_tests built and passed (1 of 1)
Unedited hosted log lines (Windows job)
[3/4] Linking CXX executable tests\guest_kernel_sys_aio_tests.exe
100% tests passed, 0 tests failed out of 1
guest_kernel_sys_aio_tests

Findings

Blocking: none.

Non-blocking: the NULL-pointer point in my earlier comment still applies. Queue no longer rejects a NULL user before taking the lock and setting aio.used, and no test pins the NULL case. The restored early return, or a NULL test case, would close it. This does not block approval.

Sources

Not verified

  • Hosted Linux was skipped for this change.
  • The NULL behaviour was reasoned from source, not executed.
  • Console behaviour of aio_read, aio_write and aio_fsync is not checked.

To get this to a good state

Nothing is required for the approval. The NULL-pointer suggestion is optional.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5727985778 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14403#pullrequestreview-5727985778). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-01T12:17:20Z. **Review:** APPROVED --- # Reviewed — looks good The aio change is correct at `28af4b5e97`, and the hosted Windows run for this exact head passed `guest_kernel_sys_aio_tests`, which was the remaining gate in my earlier comment. ## What I ran Exact head `28af4b5e97bfe4b9dd59a826c000d51946e91d0e`; PR base `b2620e56d114ef053f8b45433b1d48aff7ec37ba`, unchanged at completion. No build and no local test run. Commands: ```sh python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14403 python3 tools/pr_abi_audit.py --base b2620e56d114ef053f8b45433b1d48aff7ec37ba --head 28af4b5e97bfe4b9dd59a826c000d51946e91d0e --json ``` The precheck's ABI and test-quality helpers were missing from the isolated head tree; the ABI helper was run by hand from `/marc/AnyPS5/tools`. ## Results | Check | Result | |---|---| | Diff check, conventions and PR template (precheck) | Passed | | Live dependency and mergeability (precheck) | Passed | | ABI audit (by hand) | Passed, 0 findings; lexical only | | Test-quality heuristic (by hand) | One path false positive; the test is registered at `core/libs/CMakeLists.txt` L1144 | | Hosted Windows, job at this head | Success; `guest_kernel_sys_aio_tests` built and passed (1 of 1) | <details><summary>Unedited hosted log lines (Windows job)</summary> ```text [3/4] Linking CXX executable tests\guest_kernel_sys_aio_tests.exe 100% tests passed, 0 tests failed out of 1 guest_kernel_sys_aio_tests ``` </details> ## Findings **Blocking:** none. **Non-blocking:** the NULL-pointer point in my earlier comment still applies. `Queue` no longer rejects a NULL `user` before taking the lock and setting `aio.used`, and no test pins the NULL case. The restored early return, or a NULL test case, would close it. This does not block approval. ## Sources - [`Queue` at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/28af4b5e97bfe4b9dd59a826c000d51946e91d0e/core/libs/prx/libkernel_sys/Aio.cpp#L156-L162) ## Not verified - Hosted Linux was skipped for this change. - The NULL behaviour was reasoned from source, not executed. - Console behaviour of `aio_read`, `aio_write` and `aio_fsync` is not checked. ## To get this to a good state Nothing is required for the approval. The NULL-pointer suggestion is optional.
MarcZX10 commented 2026-11-02 07:33:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-02T07:33:31Z.

Review: COMMENTED


Reviewed — no blocking findings from the read; the aio test was built on Windows but did not run

This PR changes aio_read, aio_write and aio_fsync so that the guest aiocb is read and written field by field, in the way FreeBSD's aio_aqueue does. The change goes through a Store helper that writes one field at its member offset with GuestCopyOut. I read the production change in full. The Windows CTest run built guest_kernel_sys_aio_tests.exe but did not select it, so the new behaviour has no hosted pass.

What I ran

  • Head a59f3d947c948fe756535f186c6f5ab1907c64ad; base b2620e56d114ef053f8b45433b1d48aff7ec37ba. 3 files, +79/-11: core/libs/prx/libkernel_sys/Aio.cpp (+27/-), core/libs/tests/GuestKernelSysAio.cpp (+61), and docs/dev/debt/libkernel_sys.md (one line).
  • Read the Aio.cpp change in full. The request path now copies the aiocb in with GuestCopyIn (EFAULT on failure) and writes kernelinfo, error and status through Store, which returns the copy-out result. The completion path writes error and status through Store but ignores the result. A failed kernelinfo store in the request path returns EINVAL.
  • Did not read the test bodies in GuestKernelSysAio.cpp.
  • Hosted, Windows: guest_kernel_sys_aio_tests.exe was built and linked. The CTest selection had one case, conventions_ci_gate (Test #52). No aio case ran.
  • Read-only checks from the trusted main checkout: diff check and conventions passed. ABI audit passed: 8 symbols. Stack check: clean, no declared dependencies, no errors.
  • Hosted, other jobs: library-portability and report succeeded. Linux, relinkers and write-watch skipped.
  • No MarcZX10 review at this head.

Results

Check Result Note
Diff check passed
Conventions and PR template passed conventions check from the main checkout
Mergeability and dependencies passed stack check: clean; no declared dependencies
ABI audit (main-checkout tool) passed 8 symbols
guest_kernel_sys_aio_tests (hosted, Windows) built, not run linked, but not in the CTest selection
Aio.cpp change (read) passed by reading the field-by-field writes are as described; see the non-blocking notes
Test bodies in GuestKernelSysAio.cpp not verified not read
Negative controls not run no local build
Read-only check output

Precheck was not run: no PR-head code is run here. Diff check: passed. Conventions: passed. ABI audit: passed (8 symbols). Stack check: clean, no declared dependencies, no errors. Hosted: gh api repos/boykopovar/AnyPS5/commits/a59f3d947c948fe756535f186c6f5ab1907c64ad/check-runs, and the Windows job log.

Negative control

Not run here. A negative control needs a Windows build and run of the aio test, and code from this head is not run here.

Findings

Blocking

None from the code read.

Non-blocking

  • The completion path ignores the result of Store when it writes error and status, while the request path checks its stores. If a copy-out fails when a job finishes, the guest is not told. The diff does not say whether that is intended.
  • A failed kernelinfo store in the request path returns EINVAL, and a failed copy-in returns EFAULT. The diff does not give the reason for the different codes.
  • Store takes member offsets from a static GuestAiocb through reinterpret_cast. It assumes the guest layout matches the member offsets. That assumption was not checked here.

Sources

Not verified

  • The test bodies in GuestKernelSysAio.cpp.
  • The aio behaviour at run time on Windows (no hosted case ran).
  • The guest layout assumed by Store.

To get this to a good state

  • Run guest_kernel_sys_aio_tests at this head in hosted CI. Say in the PR whether the completion-path copy-out result should be checked, and why the error codes differ.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5733281321 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14403#pullrequestreview-5733281321). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-02T07:33:31Z. **Review:** COMMENTED --- # Reviewed — no blocking findings from the read; the aio test was built on Windows but did not run This PR changes `aio_read`, `aio_write` and `aio_fsync` so that the guest aiocb is read and written field by field, in the way FreeBSD's `aio_aqueue` does. The change goes through a `Store` helper that writes one field at its member offset with `GuestCopyOut`. I read the production change in full. The Windows CTest run built `guest_kernel_sys_aio_tests.exe` but did not select it, so the new behaviour has no hosted pass. ## What I ran - Head `a59f3d947c948fe756535f186c6f5ab1907c64ad`; base `b2620e56d114ef053f8b45433b1d48aff7ec37ba`. 3 files, +79/-11: `core/libs/prx/libkernel_sys/Aio.cpp` (+27/-), `core/libs/tests/GuestKernelSysAio.cpp` (+61), and `docs/dev/debt/libkernel_sys.md` (one line). - Read the `Aio.cpp` change in full. The request path now copies the aiocb in with `GuestCopyIn` (EFAULT on failure) and writes `kernelinfo`, `error` and `status` through `Store`, which returns the copy-out result. The completion path writes `error` and `status` through `Store` but ignores the result. A failed `kernelinfo` store in the request path returns EINVAL. - Did not read the test bodies in `GuestKernelSysAio.cpp`. - Hosted, Windows: `guest_kernel_sys_aio_tests.exe` was built and linked. The CTest selection had one case, `conventions_ci_gate` (Test #52). No aio case ran. - Read-only checks from the trusted main checkout: diff check and conventions passed. ABI audit passed: 8 symbols. Stack check: clean, no declared dependencies, no errors. - Hosted, other jobs: `library-portability` and `report` succeeded. Linux, relinkers and write-watch skipped. - No MarcZX10 review at this head. ## Results | Check | Result | Note | | --- | --- | --- | | Diff check | passed | | | Conventions and PR template | passed | conventions check from the main checkout | | Mergeability and dependencies | passed | stack check: clean; no declared dependencies | | ABI audit (main-checkout tool) | passed | 8 symbols | | `guest_kernel_sys_aio_tests` (hosted, Windows) | built, not run | linked, but not in the CTest selection | | `Aio.cpp` change (read) | passed by reading | the field-by-field writes are as described; see the non-blocking notes | | Test bodies in `GuestKernelSysAio.cpp` | not verified | not read | | Negative controls | not run | no local build | <details><summary>Read-only check output</summary> Precheck was not run: no PR-head code is run here. Diff check: passed. Conventions: passed. ABI audit: passed (8 symbols). Stack check: clean, no declared dependencies, no errors. Hosted: `gh api repos/boykopovar/AnyPS5/commits/a59f3d947c948fe756535f186c6f5ab1907c64ad/check-runs`, and the Windows job log. </details> ## Negative control Not run here. A negative control needs a Windows build and run of the aio test, and code from this head is not run here. ## Findings **Blocking** None from the code read. **Non-blocking** - The completion path ignores the result of `Store` when it writes `error` and `status`, while the request path checks its stores. If a copy-out fails when a job finishes, the guest is not told. The diff does not say whether that is intended. - A failed `kernelinfo` store in the request path returns EINVAL, and a failed copy-in returns EFAULT. The diff does not give the reason for the different codes. - `Store` takes member offsets from a static `GuestAiocb` through `reinterpret_cast`. It assumes the guest layout matches the member offsets. That assumption was not checked here. ## Sources - Production: https://github.com/boykopovar/AnyPS5/blob/a59f3d947c948fe756535f186c6f5ab1907c64ad/core/libs/prx/libkernel_sys/Aio.cpp - Test: https://github.com/boykopovar/AnyPS5/blob/a59f3d947c948fe756535f186c6f5ab1907c64ad/core/libs/tests/GuestKernelSysAio.cpp - Windows job log: check-run `windows` on a59f3d947c948fe756535f186c6f5ab1907c64ad ## Not verified - The test bodies in `GuestKernelSysAio.cpp`. - The aio behaviour at run time on Windows (no hosted case ran). - The guest layout assumed by `Store`. ## To get this to a good state - Run `guest_kernel_sys_aio_tests` at this head in hosted CI. Say in the PR whether the completion-path copy-out result should be checked, and why the error codes differ.
XairRrR commented 2026-11-03 11:16:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T11:16:40Z.

Review: APPROVED


Reviewed — approved

aio_read, aio_write and aio_fsync now use checked copies to read and write the guest aiocb, in FreeBSD aio_aqueue order, and Consume makes its stores without checking the result. On Linux the PR merges and builds cleanly, the aio test passes, and with Aio.cpp reverted the test crashes.

What I ran

Head aeaf5fda38cb6d60046bdbfa55394004ee694bf0, main 4f41f4c375f5abb487dbd184fbc150f31994d762, merged tree a0b9f39c8f5bb2a10c572fa8314fa0198747d569. Debian 13, GCC 14.2.0, Release, Ninja, BUILD_TESTING=ON.

git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...aeaf5fda38cb6d60046bdbfa55394004ee694bf0
python3 tools/check_conventions.py --base 4f41f4c375f5abb487dbd184fbc150f31994d762
ctest --test-dir build -R '^guest_kernel_sys_aio$' --output-on-failure --repeat until-fail:10
# negative control
git show 4f41f4c375f5abb487dbd184fbc150f31994d762:core/libs/prx/libkernel_sys/Aio.cpp > core/libs/prx/libkernel_sys/Aio.cpp
ninja -C build -j32 -l32 guest_kernel_sys_aio_tests
ctest --test-dir build -R '^guest_kernel_sys_aio$' --output-on-failure
git show a0b9f39c8f5bb2a10c572fa8314fa0198747d569:core/libs/prx/libkernel_sys/Aio.cpp > core/libs/prx/libkernel_sys/Aio.cpp
ninja -C build -j32 -l32 guest_kernel_sys_aio_tests
ctest --test-dir build -R '^guest_kernel_sys_aio$' --output-on-failure
git status --porcelain

Results

Check Result
git diff --check Clean
check_conventions.py All conventions checks passed
Build (script) Configure, build and libs succeeded
Selected tests (script) 862 ran, 859 passed, 2 expected skips, 0 new failures, 0 timeouts. The one failure, unwrap_self_UnwrapTest_test_new_output_inherits_the_destination_directory_group, also fails on main and has nothing to do with this change
guest_kernel_sys_aio, 10 runs 10 of 10 passed, 0.10–0.20 s each
Negative control Fails (SEGFAULT)
Worktree after restore Clean; the test passes again
Negative control output
1/1 Test #647: guest_kernel_sys_aio .............***Exception: SegFault  0.01 sec
0% tests passed, 1 tests failed out of 1
	647 - guest_kernel_sys_aio (SEGFAULT)

Negative control

I restored core/libs/prx/libkernel_sys/Aio.cpp from main, kept the new test, then rebuilt libkernel_sys.prx and guest_kernel_sys_aio_tests. The test crashes with SIGSEGV on the first new check, the 0x10 aiocb (GuestKernelSysAio.cpp:120). Because the crash ends the run there, this control does not cover the three later new checks one by one. The description reports a separate counter-check for each of them on Windows.

After restoring the merged Aio.cpp and rebuilding, the test passes and git status --porcelain is empty.

Code review notes

  • I compared the order in Queue (core/libs/prx/libkernel_sys/Aio.cpp:158-202) with FreeBSD's aio_aqueue, using the description's quotes and line numbers. My reading of FreeBSD comes from memory; I could not open the source (see Not verified). The order matches:
    • aio.used is set first;
    • the first status, error and kernelinfo stores are unchecked;
    • a full queue gives EAGAIN before the copy-in;
    • a failed copy-in stores EFAULT and returns EFAULT;
    • a failed kernelinfo store gives EINVAL through the aqueue_fail-style error store, and the request is not queued;
    • the EINPROGRESS store is unchecked.
  • Consume (Aio.cpp:140-147) ignores the store results, which matches kern_aio_return and kern_aio_waitcomplete using suword without a check. This answers MarcZX10's question about why the completion path does not check its stores.
  • Store (Aio.cpp:94-99) computes the field offset from a static zero-initialised GuestAiocb and adds it to user as an integer. No member address is ever formed from a null user, which deals with MarcZX10's UB point. The layout is fixed by the static_asserts at Aio.cpp:55-56.
  • Null stays covered: GuestCopyIn_nid_no_patch rejects address 0 (core/libs/prx/libc/src/General.cpp:856-861), and the existing check at GuestKernelSysAio.cpp:119 passed in this run. I confirm the author's reply to MarcZX10's NULL point, now with an executed result.
  • On Linux, GuestCopyOut_nid_no_patch only succeeds when process_vm_writev copies every byte (General.cpp:839-847), so a partial write counts as a failure. The author could not run this Linux path; this run exercises it, including the straddling and read-only-page cases.
  • The debt entry change only adds the remaining gap (a bad pointer passed to aio_error, aio_suspend or aio_waitcomplete). The code backs this up: aio_error reads aiocb->status directly (Aio.cpp:235), and aio_waitcomplete writes *result (Aio.cpp:277). The change adds no code comments, and the checklist lines are all present.

Findings

Blocking

None.

Non-blocking

  • GuestKernelSysAio.cpp:123: the four pages from Pages(page * 4) are never unmapped (munmap/VirtualFree). This does no harm in a short-lived test process, but a matching release helper would keep the test tidy.

Not verified

  • The Windows (VirtualQuery plus HostWrite) and macOS (mach_vm_write) copy paths; only Linux ran here.
  • The three later new checks were not reverted one at a time here (see Negative control).
  • The FreeBSD vfs_aio.c line numbers were not opened here, because there is no network.
  • Console behaviour.
  • The script skipped the Vulkan validation comparison because the change touches no AGC, shader or VideoOut files; it does not apply to this change.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5751198070 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14403#pullrequestreview-5751198070). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-11-03T11:16:40Z. **Review:** APPROVED --- # Reviewed — approved `aio_read`, `aio_write` and `aio_fsync` now use checked copies to read and write the guest aiocb, in FreeBSD `aio_aqueue` order, and `Consume` makes its stores without checking the result. On Linux the PR merges and builds cleanly, the aio test passes, and with `Aio.cpp` reverted the test crashes. ## What I ran Head `aeaf5fda38cb6d60046bdbfa55394004ee694bf0`, `main` `4f41f4c375f5abb487dbd184fbc150f31994d762`, merged tree `a0b9f39c8f5bb2a10c572fa8314fa0198747d569`. Debian 13, GCC 14.2.0, Release, Ninja, `BUILD_TESTING=ON`. ```sh git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...aeaf5fda38cb6d60046bdbfa55394004ee694bf0 python3 tools/check_conventions.py --base 4f41f4c375f5abb487dbd184fbc150f31994d762 ctest --test-dir build -R '^guest_kernel_sys_aio$' --output-on-failure --repeat until-fail:10 # negative control git show 4f41f4c375f5abb487dbd184fbc150f31994d762:core/libs/prx/libkernel_sys/Aio.cpp > core/libs/prx/libkernel_sys/Aio.cpp ninja -C build -j32 -l32 guest_kernel_sys_aio_tests ctest --test-dir build -R '^guest_kernel_sys_aio$' --output-on-failure git show a0b9f39c8f5bb2a10c572fa8314fa0198747d569:core/libs/prx/libkernel_sys/Aio.cpp > core/libs/prx/libkernel_sys/Aio.cpp ninja -C build -j32 -l32 guest_kernel_sys_aio_tests ctest --test-dir build -R '^guest_kernel_sys_aio$' --output-on-failure git status --porcelain ``` ## Results | Check | Result | |---|---| | `git diff --check` | Clean | | `check_conventions.py` | All conventions checks passed | | Build (script) | Configure, build and `libs` succeeded | | Selected tests (script) | 862 ran, 859 passed, 2 expected skips, 0 new failures, 0 timeouts. The one failure, `unwrap_self_UnwrapTest_test_new_output_inherits_the_destination_directory_group`, also fails on `main` and has nothing to do with this change | | `guest_kernel_sys_aio`, 10 runs | 10 of 10 passed, 0.10–0.20 s each | | Negative control | Fails (SEGFAULT) | | Worktree after restore | Clean; the test passes again | <details><summary>Negative control output</summary> ```text 1/1 Test #647: guest_kernel_sys_aio .............***Exception: SegFault 0.01 sec 0% tests passed, 1 tests failed out of 1 647 - guest_kernel_sys_aio (SEGFAULT) ``` </details> ## Negative control I restored `core/libs/prx/libkernel_sys/Aio.cpp` from `main`, kept the new test, then rebuilt `libkernel_sys.prx` and `guest_kernel_sys_aio_tests`. The test crashes with SIGSEGV on the first new check, the `0x10` aiocb (`GuestKernelSysAio.cpp:120`). Because the crash ends the run there, this control does not cover the three later new checks one by one. The description reports a separate counter-check for each of them on Windows. After restoring the merged `Aio.cpp` and rebuilding, the test passes and `git status --porcelain` is empty. ## Code review notes - I compared the order in `Queue` (`core/libs/prx/libkernel_sys/Aio.cpp:158-202`) with FreeBSD's `aio_aqueue`, using the description's quotes and line numbers. My reading of FreeBSD comes from memory; I could not open the source (see Not verified). The order matches: - `aio.used` is set first; - the first `status`, `error` and `kernelinfo` stores are unchecked; - a full queue gives `EAGAIN` before the copy-in; - a failed copy-in stores `EFAULT` and returns `EFAULT`; - a failed `kernelinfo` store gives `EINVAL` through the `aqueue_fail`-style error store, and the request is not queued; - the `EINPROGRESS` store is unchecked. - `Consume` (`Aio.cpp:140-147`) ignores the store results, which matches `kern_aio_return` and `kern_aio_waitcomplete` using `suword` without a check. This answers MarcZX10's question about why the completion path does not check its stores. - `Store` (`Aio.cpp:94-99`) computes the field offset from a static zero-initialised `GuestAiocb` and adds it to `user` as an integer. No member address is ever formed from a null `user`, which deals with MarcZX10's UB point. The layout is fixed by the `static_assert`s at `Aio.cpp:55-56`. - Null stays covered: `GuestCopyIn_nid_no_patch` rejects address 0 (`core/libs/prx/libc/src/General.cpp:856-861`), and the existing check at `GuestKernelSysAio.cpp:119` passed in this run. I confirm the author's reply to MarcZX10's NULL point, now with an executed result. - On Linux, `GuestCopyOut_nid_no_patch` only succeeds when `process_vm_writev` copies every byte (`General.cpp:839-847`), so a partial write counts as a failure. The author could not run this Linux path; this run exercises it, including the straddling and read-only-page cases. - The debt entry change only adds the remaining gap (a bad pointer passed to `aio_error`, `aio_suspend` or `aio_waitcomplete`). The code backs this up: `aio_error` reads `aiocb->status` directly (`Aio.cpp:235`), and `aio_waitcomplete` writes `*result` (`Aio.cpp:277`). The change adds no code comments, and the checklist lines are all present. ## Findings ### Blocking None. ### Non-blocking - `GuestKernelSysAio.cpp:123`: the four pages from `Pages(page * 4)` are never unmapped (`munmap`/`VirtualFree`). This does no harm in a short-lived test process, but a matching release helper would keep the test tidy. ## Not verified - The Windows (`VirtualQuery` plus `HostWrite`) and macOS (`mach_vm_write`) copy paths; only Linux ran here. - The three later new checks were not reverted one at a time here (see Negative control). - The FreeBSD `vfs_aio.c` line numbers were not opened here, because there is no network. - Console behaviour. - The script skipped the Vulkan validation comparison because the change touches no AGC, shader or VideoOut files; it does not apply to this change. <!-- anyps5-bots job=2535 head=aeaf5fda38cb6d60046bdbfa55394004ee694bf0 -->
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!14403
No description provided.