fix(libkernel): return error codes for failed fixed virtual range reservations #10192

Merged
Mohabbadi11 merged 1 commit from upstream-pr/10192 into main 2026-11-13 05:11:38 +00:00
Mohabbadi11 commented 2026-10-23 12:37:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Mohabbadi11 on 2026-10-23T12:37:15Z.


What

When sceKernelReserveVirtualRange is called with a fixed address that cannot be mapped because it lies outside the guest address space arena, conflicts with an existing reservation under no-overwrite, or overlaps an occupied guest arena range, return SCE_KERNEL_ERROR_EINVAL or SCE_KERNEL_ERROR_ENOMEM instead of terminating the process with an unhandled C++ exception.

Tested

  • Linux (WSL Ubuntu 22.04, GCC 11.4, Release):
    • guest_memory_lifetime: Passed
    • guest_memory: Passed
    • guest_mmap_fixed_anonymous: Passed
    • CTest suite: 3/3 passed cleanly on head 5095176cc
  • Conventions check: tools/check_conventions.py --base origin/main passed (0 errors, 0 warnings).
  • Windows was independently verified on earlier revision 9db8310b48 by contributors; it has not been rerun locally on this head.

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: Fixes #10143
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4982831712 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10192). Originally posted by [Mohabbadi11](https://github.com/Mohabbadi11) on 2026-10-23T12:37:15Z. --- ### What When `sceKernelReserveVirtualRange` is called with a fixed address that cannot be mapped because it lies outside the guest address space arena, conflicts with an existing reservation under no-overwrite, or overlaps an occupied guest arena range, return `SCE_KERNEL_ERROR_EINVAL` or `SCE_KERNEL_ERROR_ENOMEM` instead of terminating the process with an unhandled C++ exception. ### Tested - Linux (WSL Ubuntu 22.04, GCC 11.4, Release): - `guest_memory_lifetime`: Passed - `guest_memory`: Passed - `guest_mmap_fixed_anonymous`: Passed - CTest suite: 3/3 passed cleanly on head `5095176cc` - Conventions check: `tools/check_conventions.py --base origin/main` passed (0 errors, 0 warnings). - Windows was independently verified on earlier revision `9db8310b48` by contributors; it has not been rerun locally on this head. ### 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](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: none - [x] Fixes: Fixes #10143 - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
MarcZX10 commented 2026-10-23 12:40:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T12:40:26Z.

Review: CHANGES_REQUESTED


Reviewed exact head 7ca63e1899e7b667f6def659a3e4c6fe5d975cf4. The error conversion is directionally consistent with #10143, but this head adds no runtime regression test: the reported 898 tools/tests Python tests and conventions check do not exercise DoReserveVirtual or sceKernelReserveVirtualRange, and the hosted checks so far are intake/conventions/labels only. Please add a focused C++ regression that forces a fixed reservation placement failure, asserts a documented guest error and unchanged output/guest mapping state, and run the relevant memory tests on Linux and Windows. The issue discussion also records the handoff to babyhuey for this wrapper/test and title runs; please confirm coordination with them in #10143 so this remains one contribution. I have not approved until the runtime behavior and overlap/ownership are clear.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5628331423 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10192#pullrequestreview-5628331423). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-23T12:40:26Z. **Review:** CHANGES_REQUESTED --- Reviewed exact head `7ca63e1899e7b667f6def659a3e4c6fe5d975cf4`. The error conversion is directionally consistent with #10143, but this head adds no runtime regression test: the reported 898 `tools/tests` Python tests and conventions check do not exercise `DoReserveVirtual` or `sceKernelReserveVirtualRange`, and the hosted checks so far are intake/conventions/labels only. Please add a focused C++ regression that forces a fixed reservation placement failure, asserts a documented guest error and unchanged output/guest mapping state, and run the relevant memory tests on Linux and Windows. The issue discussion also records the handoff to babyhuey for this wrapper/test and title runs; please confirm coordination with them in #10143 so this remains one contribution. I have not approved until the runtime behavior and overlap/ownership are clear.
MarcZX10 commented 2026-10-23 12:57:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T12:57:15Z.

Review: CHANGES_REQUESTED


Re-review of exact head 6dbe5125ac22c671bbd549a1686609e1c3ce8264: the new outside-arena case now exercises the public API and checks the returned guest error, unchanged input pointer, and absent guest mapping. One claimed path is not actually protected by a regression yet. In CheckFixedVirtualReservation, the existing 0x90 conflict check still sets refused = true both when the API returns an error and when it throws; Require(refused) therefore passes under the old exception behavior. Please make this assertion require a nonzero return without accepting an exception (a thrown exception should fail the test), and verify the reservation/output state is unchanged. The issue response says this case returns an error instead of throwing, so pinning that behavior will cover the no-overwrite branch separately from the outside-arena test. Current hosted checks are conventions and labels only; they pass, but the focused C++ test has not yet run in hosted CI.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5628520482 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10192#pullrequestreview-5628520482). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-23T12:57:15Z. **Review:** CHANGES_REQUESTED --- Re-review of exact head `6dbe5125ac22c671bbd549a1686609e1c3ce8264`: the new outside-arena case now exercises the public API and checks the returned guest error, unchanged input pointer, and absent guest mapping. One claimed path is not actually protected by a regression yet. In `CheckFixedVirtualReservation`, the existing `0x90` conflict check still sets `refused = true` both when the API returns an error and when it throws; `Require(refused)` therefore passes under the old exception behavior. Please make this assertion require a nonzero return without accepting an exception (a thrown exception should fail the test), and verify the reservation/output state is unchanged. The issue response says this case returns an error instead of throwing, so pinning that behavior will cover the no-overwrite branch separately from the outside-arena test. Current hosted checks are conventions and labels only; they pass, but the focused C++ test has not yet run in hosted CI.
MarcZX10 commented 2026-10-23 14:38:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T14:38:46Z.

Review: CHANGES_REQUESTED


Re-review of exact head 03f74c5eaff27cc57c768884f7190e3d402847d6. The new CheckFixedVirtualReservation now requires a nonzero conflict result without accepting an exception, checks the caller's pointer is unchanged, and verifies the existing direct mapping remains queryable. The outside-arena case also checks an error result, unchanged pointer, and no guest mapping. That resolves my prior assertion blocker.

The remaining blocker is runtime validation of the new C++ test. The only hosted checks currently reported for this head are conventions and labels; they do not build or execute GuestMemory.cpp. The PR body reports 898 Python tool tests, which do not exercise this API. I attempted a local full Linux configure from this exact checkout, but it cannot proceed because the pinned 3rdparty/SDL2 checkout has no source/CMakeLists and the host lacks XRandR development support. Please run the focused guest-memory test on Linux and Windows (and, if available, the PS5X360 regression from #10143) on this exact head or its refreshed combined head, and report the commands/results. Current main also changed the touched files since the merge base, so please refresh before the final rerun.

I have not approved this head pending that runtime evidence. No request to close either contribution.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5629829220 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10192#pullrequestreview-5629829220). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-23T14:38:46Z. **Review:** CHANGES_REQUESTED --- Re-review of exact head `03f74c5eaff27cc57c768884f7190e3d402847d6`. The new `CheckFixedVirtualReservation` now requires a nonzero conflict result without accepting an exception, checks the caller's pointer is unchanged, and verifies the existing direct mapping remains queryable. The outside-arena case also checks an error result, unchanged pointer, and no guest mapping. That resolves my prior assertion blocker. The remaining blocker is runtime validation of the new C++ test. The only hosted checks currently reported for this head are conventions and labels; they do not build or execute `GuestMemory.cpp`. The PR body reports 898 Python tool tests, which do not exercise this API. I attempted a local full Linux configure from this exact checkout, but it cannot proceed because the pinned `3rdparty/SDL2` checkout has no source/CMakeLists and the host lacks XRandR development support. Please run the focused guest-memory test on Linux and Windows (and, if available, the PS5X360 regression from #10143) on this exact head or its refreshed combined head, and report the commands/results. Current main also changed the touched files since the merge base, so please refresh before the final rerun. I have not approved this head pending that runtime evidence. No request to close either contribution.
ahmadmuj commented 2026-10-25 12:37:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ahmadmuj on 2026-10-25T12:37:45Z.

Review: COMMENTED


Checked head 0ec885c89973 merged onto main 29ce6d87eb5b (clean merge). Linux, GCC 13.3, Release.

What I ran:

  • built guest_memory_tests; ctest -R '^guest_(memory|mmap_fixed_anonymous)$' is 2/2 green, 3 runs. So the :1073 failure from the earlier run is gone with the 0x4000 address
  • red control: main plus only this PR's GuestMemory.cpp aborts with unhandled exception 'St13runtime_error' ... fixed mapping 0x200104000+0x8000 overlaps a registered guest allocation, so the 0x90 check really pins the new return
  • small probes, main vs this PR: null output, bad alignment 0x3000, fixed at 0x4000 all go from a throw to EINVAL; fixed 0x10 on a free arena range still returns 0 on both

Things to change:

  1. A fixed 0x10 reserve (no 0x80) that only partly overlaps a live mapping now returns ENOMEM. Probe: direct map 2 pages at 0x200000000, then reserve 2 pages fixed at 0x200004000. Main throws overlaps a registered guest allocation; this PR returns 0x8002000c and leaves the old mapping in place. A full overlap still replaces (the existing test case). FreeBSD 11.4 vm_map_fixed deletes the old range when MAP_CHECK_EXCL isn't set (vm_map.c#L1457-L1458, already cited in libkernel.md), and DoMapDirect, DoMapAnon and the file-backed map do that through ReplaceFixedOverlap (DirectMemory.cpp:997). So that's an emulator gap, and the catch at DirectMemory.cpp:1440 turns it into a silent error. I'd catch only the no-overwrite case there, or replace like ReplaceFixedOverlap does.

  2. The debt entry doesn't match the code anymore:

    • "fails with EINVAL ... when the host refuses the placement": the Windows case from #10143 (fixed guest mapping 0x10000+0x150000 overlaps a host region) is a std::runtime_error from KernelArena::MarkUsed, so it hits the last catch (const std::exception&) (DirectMemory.cpp:1454) and returns ENOMEM. Read only, I didn't run Windows.
    • "Placing such ranges is #6469": #6469 is merged in this base, the Linux/Windows arena starts at 0x10000 now, and 0x40000000/0x50000000 are inside it. Outside the arena only means below 0x10000 (or below 0x200000000 on macOS).
  3. The catch-alls hide more than placement failures. In Export.cpp:343 the null-output std::invalid_argument from ValidateOutput becomes EINVAL, and so do internal ones like a failed mutation.Add. A null output is a caller bug, and the console's answer for it isn't sourced, so per the throw-on-unknown rule I'd let those throw and only catch what DoReserveVirtual maps itself. (Guarded() in MemoryPoolExport.cpp does the same thing, so this one is your call.) The empty catch (...) around _releaseFlexible (Export.cpp:349) can only see bad_alloc or a mutex error, and the sibling exports at Export.cpp:263-281 call it bare. I'd drop it.

Not checked: Windows, macOS, PS5X360 (no dump here), what the console returns for a partial fixed overlap.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5643226223 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10192#pullrequestreview-5643226223). Originally posted by [ahmadmuj](https://github.com/ahmadmuj) on 2026-10-25T12:37:45Z. **Review:** COMMENTED --- Checked head `0ec885c89973` merged onto main `29ce6d87eb5b` (clean merge). Linux, GCC 13.3, Release. What I ran: - built `guest_memory_tests`; `ctest -R '^guest_(memory|mmap_fixed_anonymous)$'` is 2/2 green, 3 runs. So the `:1073` failure from the earlier run is gone with the `0x4000` address - red control: main plus only this PR's `GuestMemory.cpp` aborts with `unhandled exception 'St13runtime_error' ... fixed mapping 0x200104000+0x8000 overlaps a registered guest allocation`, so the `0x90` check really pins the new return - small probes, main vs this PR: null output, bad alignment `0x3000`, fixed at `0x4000` all go from a throw to `EINVAL`; fixed `0x10` on a free arena range still returns 0 on both Things to change: 1. A fixed `0x10` reserve (no `0x80`) that only *partly* overlaps a live mapping now returns `ENOMEM`. Probe: direct map 2 pages at `0x200000000`, then reserve 2 pages fixed at `0x200004000`. Main throws `overlaps a registered guest allocation`; this PR returns `0x8002000c` and leaves the old mapping in place. A full overlap still replaces (the existing test case). FreeBSD 11.4 `vm_map_fixed` deletes the old range when `MAP_CHECK_EXCL` isn't set ([vm_map.c#L1457-L1458](https://github.com/freebsd/freebsd-src/blob/8c639945a44588f6cfdddfb057bb5aad88735da0/sys/vm/vm_map.c#L1457-L1458), already cited in `libkernel.md`), and `DoMapDirect`, `DoMapAnon` and the file-backed map do that through `ReplaceFixedOverlap` (`DirectMemory.cpp:997`). So that's an emulator gap, and the `catch` at `DirectMemory.cpp:1440` turns it into a silent error. I'd catch only the no-overwrite case there, or replace like `ReplaceFixedOverlap` does. 2. The debt entry doesn't match the code anymore: - "fails with `EINVAL` ... when the host refuses the placement": the Windows case from #10143 (`fixed guest mapping 0x10000+0x150000 overlaps a host region`) is a `std::runtime_error` from `KernelArena::MarkUsed`, so it hits the last `catch (const std::exception&)` (`DirectMemory.cpp:1454`) and returns `ENOMEM`. Read only, I didn't run Windows. - "Placing such ranges is #6469": #6469 is merged in this base, the Linux/Windows arena starts at `0x10000` now, and `0x40000000`/`0x50000000` are inside it. Outside the arena only means below `0x10000` (or below `0x200000000` on macOS). 3. The catch-alls hide more than placement failures. In `Export.cpp:343` the null-output `std::invalid_argument` from `ValidateOutput` becomes `EINVAL`, and so do internal ones like a failed `mutation.Add`. A null output is a caller bug, and the console's answer for it isn't sourced, so per the throw-on-unknown rule I'd let those throw and only catch what `DoReserveVirtual` maps itself. (`Guarded()` in `MemoryPoolExport.cpp` does the same thing, so this one is your call.) The empty `catch (...)` around `_releaseFlexible` (`Export.cpp:349`) can only see `bad_alloc` or a mutex error, and the sibling exports at `Export.cpp:263-281` call it bare. I'd drop it. Not checked: Windows, macOS, PS5X360 (no dump here), what the console returns for a partial fixed overlap.
MarcZX10 commented 2026-10-25 21:36:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T21:36:54Z.

Review: COMMENTED


Re-reviewed exact head 969089d9393c63a9fd9f7ff19c06bd83a6f08335. This update addresses the earlier behavior concerns I can verify in the diff: partial overlaps without the no-overwrite flag now retain the existing RequireAvailable exception path, the broad wrapper catch and _releaseFlexible catch are removed, and the debt entry now distinguishes outside-arena EINVAL from placement ENOMEM.

The current hosted checks are conventions and labels only. The Linux guest_memory_tests/ctest results in the discussion were run on parent head 0ec885c89973915275cf218afb6285e31899985b, before these changes; the PR body’s Python suite does not exercise this C++ API. Please rerun the focused guest-memory test on this exact head and include the command/result, especially the fixed partial-overlap behavior and the 0x90 no-overwrite error case. I did not have a configured local build available for this revision, so this is a comment-only follow-up, not an approval.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5645442654 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10192#pullrequestreview-5645442654). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-25T21:36:54Z. **Review:** COMMENTED --- Re-reviewed exact head `969089d9393c63a9fd9f7ff19c06bd83a6f08335`. This update addresses the earlier behavior concerns I can verify in the diff: partial overlaps without the no-overwrite flag now retain the existing `RequireAvailable` exception path, the broad wrapper catch and `_releaseFlexible` catch are removed, and the debt entry now distinguishes outside-arena `EINVAL` from placement `ENOMEM`. The current hosted checks are conventions and labels only. The Linux `guest_memory_tests`/`ctest` results in the discussion were run on parent head `0ec885c89973915275cf218afb6285e31899985b`, before these changes; the PR body’s Python suite does not exercise this C++ API. Please rerun the focused guest-memory test on this exact head and include the command/result, especially the fixed partial-overlap behavior and the `0x90` no-overwrite error case. I did not have a configured local build available for this revision, so this is a comment-only follow-up, not an approval.
adriadam10 commented 2026-10-26 15:31:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-26T15:31:50Z.

Review: DISMISSED


Thanks for the update; the 0x90 and 0x4000 cases are pinned well. Remaining points:

  • core/libs/prx/libkernel/DirectMemory/DirectMemory.cpp:1450: catch (const std::exception&) (and the std::bad_alloc one above it) turns any failure of MapAligned into ENOMEM, for non-fixed reservations too, which previously threw. Please scope the conversion to the fixed case and the exceptions MapAligned is known to throw for a placement failure; anything else should keep throwing.
  • DirectMemory.cpp:1447: a std::system_error on a fixed reservation returns EINVAL, but the docs/dev/debt/libkernel.md entry says host placement failure returns ENOMEM. Make code and entry agree and say which reference the errno follows (FreeBSD vm_map_find failure on a fixed range is ENOMEM).
  • The host placement failure branch has no test (only the outside-arena and no-overwrite cases do). Either add one that forces it, or drop the branch.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5654615475 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10192#pullrequestreview-5654615475). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-26T15:31:50Z. **Review:** DISMISSED --- Thanks for the update; the `0x90` and `0x4000` cases are pinned well. Remaining points: - `core/libs/prx/libkernel/DirectMemory/DirectMemory.cpp:1450`: `catch (const std::exception&)` (and the `std::bad_alloc` one above it) turns any failure of `MapAligned` into `ENOMEM`, for non-fixed reservations too, which previously threw. Please scope the conversion to the fixed case and the exceptions `MapAligned` is known to throw for a placement failure; anything else should keep throwing. - `DirectMemory.cpp:1447`: a `std::system_error` on a fixed reservation returns `EINVAL`, but the `docs/dev/debt/libkernel.md` entry says host placement failure returns `ENOMEM`. Make code and entry agree and say which reference the errno follows (FreeBSD `vm_map_find` failure on a fixed range is `ENOMEM`). - The host placement failure branch has no test (only the outside-arena and no-overwrite cases do). Either add one that forces it, or drop the branch.
MarcZX10 commented 2026-10-29 08:05:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T08:05:27Z.

Review: CHANGES_REQUESTED


Rechecked exact head 7960d91da67ba02f30ae3af0d7fc4e7a82693ec1 against current main 4c7d275bef89.

Findings

Blocking — the native placement-error conversion is untested. The new hostOccupied case does not reach the std::system_error catch around MapAligned: the implementation detects the occupied guest-arena range first with GuestArenaNextUsed_nid_no_patch and returns SCE_KERNEL_ERROR_ENOMEM before calling MapAligned. The author’s 10/28 note confirms that this is the path the test exercises. Thus the regression proves the preflight collision response, but not that an actual host placement failure is translated correctly. Please either add a deterministic test that reaches the MapAligned std::system_error catch, or remove that conversion if it cannot be exercised and supported. Keep the separate preflight collision test.

The earlier review concerns about limiting conversion to fixed reservations, letting unrelated runtime errors propagate, the 0x90 result, and the FreeBSD-derived ENOMEM documentation are addressed in this head. The current-main merge preview is clean and git diff --check passes.

Validation

The author reports the focused Linux memory tests passing 3/3 on this head. Windows has not been rerun after the latest change. I did not build or run these tests locally, and I did not test console behavior.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5694538659 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10192#pullrequestreview-5694538659). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T08:05:27Z. **Review:** CHANGES_REQUESTED --- Rechecked exact head `7960d91da67ba02f30ae3af0d7fc4e7a82693ec1` against current `main` `4c7d275bef89`. ### Findings **Blocking — the native placement-error conversion is untested.** The new `hostOccupied` case does not reach the `std::system_error` catch around `MapAligned`: the implementation detects the occupied guest-arena range first with `GuestArenaNextUsed_nid_no_patch` and returns `SCE_KERNEL_ERROR_ENOMEM` before calling `MapAligned`. The author’s 10/28 note confirms that this is the path the test exercises. Thus the regression proves the preflight collision response, but not that an actual host placement failure is translated correctly. Please either add a deterministic test that reaches the `MapAligned` `std::system_error` catch, or remove that conversion if it cannot be exercised and supported. Keep the separate preflight collision test. The earlier review concerns about limiting conversion to fixed reservations, letting unrelated runtime errors propagate, the `0x90` result, and the FreeBSD-derived `ENOMEM` documentation are addressed in this head. The current-main merge preview is clean and `git diff --check` passes. ### Validation The author reports the focused Linux memory tests passing 3/3 on this head. Windows has not been rerun after the latest change. I did not build or run these tests locally, and I did not test console behavior.
MarcZX10 commented 2026-11-10 19:31:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-10T19:31:44Z.

Review: APPROVED


Reviewed — looks good

Reviewed exact head 5095176ccd95c0feacf66663a81ed264e2e5b3cc against current main 56c80b0917c40b08248be1a0e172e56690678df5; the earlier behavior, regression-test, and validation concerns are addressed.

What I ran

Environment: Linux 6.1, Python 3.11.2, GCC-compatible c++ 12.2.0. The exact head merges cleanly in a preview against the current main tip.

git diff --check refs/review/session20261110s/main...refs/review/session20261110s/pr-10192
python3 tools/pr_precheck.py --base refs/review/session20261110s/main --head refs/review/session20261110s/pr-10192 --title 'fix(libkernel): return error codes for failed fixed virtual range reservations' --body-file /tmp/anyps5-pr10192-body.md --output-dir /tmp/anyps5-pr10192-review-final
git merge-tree --write-tree refs/review/session20261110s/main refs/review/session20261110s/pr-10192
gh pr checks 10192 --repo boykopovar/AnyPS5
gh pr checks 10192 --repo boykopovar/AnyPS5 --required

Results

Check Result Note
Diff and conventions passed Exact head against current main.
Guest-memory regression tests passed Linux and Windows results reported on this exact head.
Negative control passed Restoring the old implementation makes the regression fail, per Windows report.
Hosted CI passed Current conventions and labels checks pass; no required checks are configured for this branch.
Full build and console behavior not run I did not run a full build or PS5 test.
Full no-build precheck results and evidence
Precheck Result Note
build_and_compile not run No-build pass.
diff_check passed No whitespace errors.
conventions_and_pr_template passed PR body and conventions check passed.
changed_export_abi_audit not applicable No changed export declaration or alias was recognized.
python_syntax not applicable No Python implementation changed.
related_python_unit_tests not applicable No Python tool changed.
python_test_registration not applicable No Python tests changed.
live_dependency_and_mergeability_check not applicable Local SHA-pinned precheck; merge preview run separately.
build_dependent_cpp_tests not run No build in this pass; focused test runs are reported below.
test_quality_heuristics passed Its registration warning is a false positive; CMake registers GuestMemory.cpp in guest_memory_tests and CTest's guest_memory.
negative_controls not applicable Python-only control helper did not apply.
Diff check: exit 0; no output.
Conventions: All conventions checks passed.
ABI audit: no changed APS5_VABI declaration/definition or APS5_EXPORT alias was recognized.
Test-quality heuristic: possible-unregistered-cpp-test for GuestMemory.cpp.
GitHub checks: conventions pass; labels pass.
Required GitHub checks: no required checks reported for this branch.
Merge preview tree: ca7204c9f9f8215cd8fee5a16a7d894cfb0daadf (created without conflicts).

The author reports Linux WSL Ubuntu 22.04 / GCC 11.4 Release runs on this head: guest_memory_lifetime, guest_memory, and guest_mmap_fixed_anonymous each passed 3/3. B-Howell and JJenkx report Windows runs on this head: guest_memory and guest_mmap_fixed_anonymous each passed 3/3. These are contributor-reported, not runs I performed. B-Howell's Windows control kept the test but restored DirectMemory.cpp to the main implementation; guest_memory then aborted while the fixed-anonymous test passed. The same failure split is reported on Linux.

Negative control

Contributor reports on exact head 5095176ccd95c0feacf66663a81ed264e2e5b3cc say the test fails when the old DirectMemory.cpp implementation is restored, so the regression detects the original failure. I did not execute this control locally.

Findings

Blocking

None in the reviewed three-file diff.

Non-blocking

None.

Sources

Not verified

I did not compile or run the C++ tests locally, and no PS5/title behavior was tested. Contributor test runs were on the exact head but their merge previews used earlier main tips than this review's current-base preview.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5848094500 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10192#pullrequestreview-5848094500). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-10T19:31:44Z. **Review:** APPROVED --- # Reviewed — looks good Reviewed exact head `5095176ccd95c0feacf66663a81ed264e2e5b3cc` against current `main` `56c80b0917c40b08248be1a0e172e56690678df5`; the earlier behavior, regression-test, and validation concerns are addressed. ## What I ran Environment: Linux 6.1, Python 3.11.2, GCC-compatible `c++` 12.2.0. The exact head merges cleanly in a preview against the current `main` tip. ```sh git diff --check refs/review/session20261110s/main...refs/review/session20261110s/pr-10192 python3 tools/pr_precheck.py --base refs/review/session20261110s/main --head refs/review/session20261110s/pr-10192 --title 'fix(libkernel): return error codes for failed fixed virtual range reservations' --body-file /tmp/anyps5-pr10192-body.md --output-dir /tmp/anyps5-pr10192-review-final git merge-tree --write-tree refs/review/session20261110s/main refs/review/session20261110s/pr-10192 gh pr checks 10192 --repo boykopovar/AnyPS5 gh pr checks 10192 --repo boykopovar/AnyPS5 --required ``` ## Results | Check | Result | Note | |---|---|---| | Diff and conventions | passed | Exact head against current `main`. | | Guest-memory regression tests | passed | Linux and Windows results reported on this exact head. | | Negative control | passed | Restoring the old implementation makes the regression fail, per Windows report. | | Hosted CI | passed | Current `conventions` and `labels` checks pass; no required checks are configured for this branch. | | Full build and console behavior | not run | I did not run a full build or PS5 test. | <details> <summary>Full no-build precheck results and evidence</summary> | Precheck | Result | Note | |---|---|---| | build_and_compile | not run | No-build pass. | | diff_check | passed | No whitespace errors. | | conventions_and_pr_template | passed | PR body and conventions check passed. | | changed_export_abi_audit | not applicable | No changed export declaration or alias was recognized. | | python_syntax | not applicable | No Python implementation changed. | | related_python_unit_tests | not applicable | No Python tool changed. | | python_test_registration | not applicable | No Python tests changed. | | live_dependency_and_mergeability_check | not applicable | Local SHA-pinned precheck; merge preview run separately. | | build_dependent_cpp_tests | not run | No build in this pass; focused test runs are reported below. | | test_quality_heuristics | passed | Its registration warning is a false positive; CMake registers `GuestMemory.cpp` in `guest_memory_tests` and CTest's `guest_memory`. | | negative_controls | not applicable | Python-only control helper did not apply. | ```text Diff check: exit 0; no output. Conventions: All conventions checks passed. ABI audit: no changed APS5_VABI declaration/definition or APS5_EXPORT alias was recognized. Test-quality heuristic: possible-unregistered-cpp-test for GuestMemory.cpp. GitHub checks: conventions pass; labels pass. Required GitHub checks: no required checks reported for this branch. Merge preview tree: ca7204c9f9f8215cd8fee5a16a7d894cfb0daadf (created without conflicts). ``` The author reports Linux WSL Ubuntu 22.04 / GCC 11.4 Release runs on this head: `guest_memory_lifetime`, `guest_memory`, and `guest_mmap_fixed_anonymous` each passed 3/3. B-Howell and JJenkx report Windows runs on this head: `guest_memory` and `guest_mmap_fixed_anonymous` each passed 3/3. These are contributor-reported, not runs I performed. B-Howell's Windows control kept the test but restored `DirectMemory.cpp` to the main implementation; `guest_memory` then aborted while the fixed-anonymous test passed. The same failure split is reported on Linux. </details> ## Negative control Contributor reports on exact head `5095176ccd95c0feacf66663a81ed264e2e5b3cc` say the test fails when the old `DirectMemory.cpp` implementation is restored, so the regression detects the original failure. I did not execute this control locally. ## Findings ### Blocking None in the reviewed three-file diff. ### Non-blocking None. ## Sources - [Fixed-reservation error handling at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/5095176ccd95c0feacf66663a81ed264e2e5b3cc/core/libs/prx/libkernel/DirectMemory/DirectMemory.cpp#L1451-L1490) - [Regression cases at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/5095176ccd95c0feacf66663a81ed264e2e5b3cc/core/libs/tests/GuestMemory.cpp#L1038-L1085) - [Guest-memory test target and CTest registration](https://github.com/boykopovar/AnyPS5/blob/5095176ccd95c0feacf66663a81ed264e2e5b3cc/core/libs/prx/libkernel/CMakeLists.txt#L1795-L1812) - [Author's Linux results on this head](https://github.com/boykopovar/AnyPS5/pull/10192#issuecomment-6498271654) - [Windows results and negative control on this head](https://github.com/boykopovar/AnyPS5/pull/10192#issuecomment-6614546249) and [independent Windows rerun](https://github.com/boykopovar/AnyPS5/pull/10192#issuecomment-6720612526) ## Not verified I did not compile or run the C++ tests locally, and no PS5/title behavior was tested. Contributor test runs were on the exact head but their merge previews used earlier `main` tips than this review's current-base preview.
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!10192
No description provided.