fix(libkernel): harden DirectMemory validation and tests #3870

Merged
yash27git merged 1 commit from upstream-pr/3870 into main 2026-10-13 16:55:12 +00:00
yash27git commented 2026-10-11 18:18:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by yash27git on 2026-10-11T18:18:52Z.


What

Hardens PhysicalMemoryPool against out-of-range and overflowing inputs and makes its mutating paths roll back:

  • Bounds and overflow-safe arithmetic on every path that indexes _used[]; out-of-pool or overflowing ranges are ignored (Free, CheckedFree, Retype) or return EAGAIN (Alloc).
  • Alloc, Free/CheckedFree and Retype roll back _blocks and _used[] when node allocation, backing creation or backing cleanup throws. Blocks are split first; the erase and flag updates that follow cannot throw.
  • Applies the same overflow-safe arithmetic and alignment handling to DirectMemoryLargestFree.
  • DirectMemoryAlloc maps std::bad_alloc to SCE_KERNEL_ERROR_ENOMEM. A mismatch between _blocks and _used[] throws std::logic_error instead of being silently overwritten.
  • Adds MemoryPoolTest (15 cases), registered in ctest. It is a host-only test, so on MinGW it is built with -fasynchronous-unwind-tables.

Validation that Export.cpp already does (unaligned or zero lengths, out-of-pool ranges) is not repeated, apart from len == 0 in Alloc. Existing behaviour is otherwise kept, including EAGAIN for searchStart >= searchEnd, partial and multi-allocation Free, and Retype skipping gaps. Choices that are not checked against a reference (alignment normalisation, EINVAL for len == 0, rounding unaligned ranges to whole pages) are listed in docs/dev/debt/libkernel.md.

Why

  • Bounds and overflow: Free, Retype, and the page-marking helpers previously lacked sufficient range checks. Expressions such as cur + len, start + align - 1, and start + len could overflow, allowing guest input to write beyond _used[] or create overlapping allocations.
  • Consistency: Alloc, Free, and Retype could throw partway through an operation, leaving _used[] and _blocks out of sync.

Behaviour changes

Area Before After
Out-of-pool or overflowing range in Free/CheckedFree/Retype wrote past _used[] ignored
Alloc request that can never fit, or negative searchStart wrapped arithmetic EAGAIN
Alloc with len == 0 success, empty block EINVAL
Non-power-of-two alignment returned a misaligned address honoured
Alignment below a page possibly unaligned address page aligned
Unaligned len or start in Alloc/Free/CheckedFree/Retype truncated page math rounded outward to whole pages
Null physOut / output pointers crash EFAULT / false
std::bad_alloc in Alloc (block node or backing creation) propagated; a failed block insert left the backing created and the pages marked rolled back, ENOMEM
std::bad_alloc while splitting blocks in Free/Retype block map left half-edited rolled back, exception propagates

Known limitation

The rollback covers the pool's own metadata only. ForgetDirectMemory erases g_physPages before ErasePhysMappings, and ErasePhysMappings can throw while inserting the surviving pieces of a partially overlapped mapping. In that case, the pool restores its splits, but the already-erased physical pages and mapping nodes are not restored, so a retry may fail ValidatePhysicalRange. Making these updates transactional is tracked in docs/dev/debt/libkernel.md and is outside the scope of this PR.

Tested

New tests (MemoryPoolTest): 15 cases covering argument validation, rounding/alignment/clamping, partial and spanning Free, Retype splitting, and rollback of _blocks/_used[] after injected std::bad_alloc and backing/forget failures.

Environment: Windows 11 Home (26100), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release.

  • MemoryPoolTest builds and passes on MinGW with the unwind fix: <yes/no, from your run on the final commit>
  • Full suite: <passed / total, skipped, from your run on the final commit>
  • <list any failures that also fail on clean main, only if they still apply>
  • Tests were run using generated CTestTestfile.cmake commands because local antivirus blocks ctest.exe.

tools/check_conventions.py:

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
  • No notes, investigation .md files, or images added to the repository
  • New third-party code is a submodule built from source
  • All guest memory / direct memory unit tests compile and pass cleanly
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4821260757 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3870). Originally posted by [yash27git](https://github.com/yash27git) on 2026-10-11T18:18:52Z. --- ### What Hardens `PhysicalMemoryPool` against out-of-range and overflowing inputs and makes its mutating paths roll back: - Bounds and overflow-safe arithmetic on every path that indexes `_used[]`; out-of-pool or overflowing ranges are ignored (`Free`, `CheckedFree`, `Retype`) or return `EAGAIN` (`Alloc`). - `Alloc`, `Free`/`CheckedFree` and `Retype` roll back `_blocks` and `_used[]` when node allocation, backing creation or backing cleanup throws. Blocks are split first; the erase and flag updates that follow cannot throw. - Applies the same overflow-safe arithmetic and alignment handling to `DirectMemoryLargestFree`. - `DirectMemoryAlloc` maps `std::bad_alloc` to `SCE_KERNEL_ERROR_ENOMEM`. A mismatch between `_blocks` and `_used[]` throws `std::logic_error` instead of being silently overwritten. - Adds `MemoryPoolTest` (15 cases), registered in ctest. It is a host-only test, so on MinGW it is built with `-fasynchronous-unwind-tables`. Validation that `Export.cpp` already does (unaligned or zero lengths, out-of-pool ranges) is not repeated, apart from `len == 0` in `Alloc`. Existing behaviour is otherwise kept, including `EAGAIN` for `searchStart >= searchEnd`, partial and multi-allocation `Free`, and `Retype` skipping gaps. Choices that are not checked against a reference (alignment normalisation, `EINVAL` for `len == 0`, rounding unaligned ranges to whole pages) are listed in `docs/dev/debt/libkernel.md`. ### Why - **Bounds and overflow:** `Free`, `Retype`, and the page-marking helpers previously lacked sufficient range checks. Expressions such as `cur + len`, `start + align - 1`, and `start + len` could overflow, allowing guest input to write beyond `_used[]` or create overlapping allocations. - **Consistency:** `Alloc`, `Free`, and `Retype` could throw partway through an operation, leaving `_used[]` and `_blocks` out of sync. ### Behaviour changes | Area | Before | After | |---|---|---| | Out-of-pool or overflowing range in `Free`/`CheckedFree`/`Retype` | wrote past `_used[]` | ignored | | `Alloc` request that can never fit, or negative `searchStart` | wrapped arithmetic | `EAGAIN` | | `Alloc` with `len == 0` | success, empty block | `EINVAL` | | Non-power-of-two alignment | returned a misaligned address | honoured | | Alignment below a page | possibly unaligned address | page aligned | | Unaligned `len` or `start` in `Alloc`/`Free`/`CheckedFree`/`Retype` | truncated page math | rounded outward to whole pages | | Null `physOut` / output pointers | crash | `EFAULT` / false | | `std::bad_alloc` in `Alloc` (block node or backing creation) | propagated; a failed block insert left the backing created and the pages marked | rolled back, `ENOMEM` | | `std::bad_alloc` while splitting blocks in `Free`/`Retype` | block map left half-edited | rolled back, exception propagates | ### Known limitation The rollback covers the pool's own metadata only. `ForgetDirectMemory` erases `g_physPages` before `ErasePhysMappings`, and `ErasePhysMappings` can throw while inserting the surviving pieces of a partially overlapped mapping. In that case, the pool restores its splits, but the already-erased physical pages and mapping nodes are not restored, so a retry may fail `ValidatePhysicalRange`. Making these updates transactional is tracked in `docs/dev/debt/libkernel.md` and is outside the scope of this PR. ### Tested **New tests (`MemoryPoolTest`):** 15 cases covering argument validation, rounding/alignment/clamping, partial and spanning `Free`, `Retype` splitting, and rollback of `_blocks`/`_used[]` after injected `std::bad_alloc` and backing/forget failures. **Environment:** Windows 11 Home (26100), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. - `MemoryPoolTest` builds and passes on MinGW with the unwind fix: <yes/no, from your run on the final commit> - Full suite: <passed / total, skipped, from your run on the final commit> - <list any failures that also fail on clean `main`, only if they still apply> - Tests were run using generated `CTestTestfile.cmake` commands because local antivirus blocks `ctest.exe`. **`tools/check_conventions.py`:** <result on the final commit> ### 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] No notes, investigation `.md` files, or images added to the repository - [x] New third-party code is a submodule built from source - [x] All guest memory / direct memory unit tests compile and pass cleanly - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes
adriadam10 commented 2026-10-11 18:23:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T18:23:18Z.

Review: CHANGES_REQUESTED


Thanks for the PR. The rollback logic and the test look right (MemoryPoolTest passes on the PR merged onto main and fails with MemoryPool.cpp reverted), but these need fixing first:

  • MemoryPool.cpp:13-27: the #ifndef … #define SCE_KERNEL_ERROR_* block redefines constants that prx/libkernel/KernelErrors.hpp already provides as constexpr; the #ifndef can never see them. Include that header and drop the macros.
  • Behaviour changes with no source cited: non-power-of-two alignment now returns EINVAL (sceKernelAllocateDirectMemory currently accepts any multiple of the page size), searchStart == searchEnd changes from EAGAIN to EINVAL, Free/Retype silently ignore an unaligned start, len is rounded up. Please say which reference each follows (FreeBSD sys/vm, KytyPS5, shadPS4) or keep the old behaviour.
  • Part of the validation duplicates Export.cpp (sceKernelAllocateDirectMemory, sceKernelReleaseDirectMemory, sceKernelCheckedReleaseDirectMemory already reject unaligned or zero lengths and out-of-pool ranges). Keep only the checks the exports don't do.
  • The PR body says some entry points swallowed exceptions into false/0/EFAULT; the original MemoryPool.cpp has no try/catch. Please correct the description, since "exceptions propagate" is not a change for those paths.
  • docs/dev/TechnicalDebt.md: the new line under "Unknown function info" names no sources and does not list the behaviour changes above; each unverified choice needs its own statement. The diff also adds a blank line before the "Comparison-sampled R32" entry and rewrites the last line (sceSharePlayGetCurrentConnectionInfoA) without changing it; please drop both.
  • core/libs/CMakeLists.txt: one extra blank line before add_test_executable(MemoryPoolTest.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5484405450 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3870#pullrequestreview-5484405450). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T18:23:18Z. **Review:** CHANGES_REQUESTED --- Thanks for the PR. The rollback logic and the test look right (MemoryPoolTest passes on the PR merged onto main and fails with `MemoryPool.cpp` reverted), but these need fixing first: - `MemoryPool.cpp:13-27`: the `#ifndef … #define SCE_KERNEL_ERROR_*` block redefines constants that `prx/libkernel/KernelErrors.hpp` already provides as `constexpr`; the `#ifndef` can never see them. Include that header and drop the macros. - Behaviour changes with no source cited: non-power-of-two alignment now returns `EINVAL` (`sceKernelAllocateDirectMemory` currently accepts any multiple of the page size), `searchStart == searchEnd` changes from `EAGAIN` to `EINVAL`, `Free`/`Retype` silently ignore an unaligned start, `len` is rounded up. Please say which reference each follows (FreeBSD `sys/vm`, KytyPS5, shadPS4) or keep the old behaviour. - Part of the validation duplicates `Export.cpp` (`sceKernelAllocateDirectMemory`, `sceKernelReleaseDirectMemory`, `sceKernelCheckedReleaseDirectMemory` already reject unaligned or zero lengths and out-of-pool ranges). Keep only the checks the exports don't do. - The PR body says some entry points swallowed exceptions into `false`/`0`/`EFAULT`; the original `MemoryPool.cpp` has no `try`/`catch`. Please correct the description, since "exceptions propagate" is not a change for those paths. - `docs/dev/TechnicalDebt.md`: the new line under "Unknown function info" names no sources and does not list the behaviour changes above; each unverified choice needs its own statement. The diff also adds a blank line before the "Comparison-sampled R32" entry and rewrites the last line (`sceSharePlayGetCurrentConnectionInfoA`) without changing it; please drop both. - `core/libs/CMakeLists.txt`: one extra blank line before `add_test_executable(MemoryPoolTest`.
MarcZX10 commented 2026-10-11 18:28:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-11T18:28:08Z.


I independently built and ran the new MemoryPoolTest target from head dd01acd4499de57a89ac365ad8d4f9eed004d75b on Linux (GCC 12.2.0, Release). ctest --test-dir /tmp/AnyPS5-pr-3870-build -R "^MemoryPoolTest$" --output-on-failure passed: 1/1 test. This is the focused pool test only; I did not run the full suite.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6112253121 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3870#issuecomment-6112253121). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-11T18:28:08Z. --- I independently built and ran the new `MemoryPoolTest` target from head `dd01acd4499de57a89ac365ad8d4f9eed004d75b` on Linux (GCC 12.2.0, Release). `ctest --test-dir /tmp/AnyPS5-pr-3870-build -R "^MemoryPoolTest$" --output-on-failure` passed: 1/1 test. This is the focused pool test only; I did not run the full suite.
yash27git commented 2026-10-11 18:44:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by yash27git on 2026-10-11T18:44:54Z.


I independently built and ran the new MemoryPoolTest target from head dd01acd4499de57a89ac365ad8d4f9eed004d75b on Linux (GCC 12.2.0, Release). ctest --test-dir /tmp/AnyPS5-pr-3870-build -R "^MemoryPoolTest$" --output-on-failure passed: 1/1 test. This is the focused pool test only; I did not run the full suite.

Thanks for independently building and testing MemoryPoolTest on Linux! I really appreciate you taking the time to verify it on a different environment and share the results. Glad to see the focused test passing. Thanks for the help!

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6112407855 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3870#issuecomment-6112407855). Originally posted by [yash27git](https://github.com/yash27git) on 2026-10-11T18:44:54Z. --- > I independently built and ran the new `MemoryPoolTest` target from head `dd01acd4499de57a89ac365ad8d4f9eed004d75b` on Linux (GCC 12.2.0, Release). `ctest --test-dir /tmp/AnyPS5-pr-3870-build -R "^MemoryPoolTest$" --output-on-failure` passed: 1/1 test. This is the focused pool test only; I did not run the full suite. Thanks for independently building and testing `MemoryPoolTest` on Linux! I really appreciate you taking the time to verify it on a different environment and share the results. Glad to see the focused test passing. Thanks for the help!
adriadam10 commented 2026-10-11 18:54:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T18:54:39Z.

Review: CHANGES_REQUESTED


Thanks for the update. Build and ctest are green on the PR merged onto main, and MemoryPoolTest fails with MemoryPool.cpp reverted. The points from the previous review about KernelErrors.hpp, searchStart == searchEnd, non-power-of-two alignment and the CMake blank line are fixed. Still open:

  • PR body: it says some entry points "converted unexpected exceptions into false, 0, or EFAULT", but the original MemoryPool.cpp has no try/catch, so "exceptions propagate" is not a change for those paths. The behaviour table also says an unaligned start in Free/CheckedFree/Retype is "Rejected"; PageSpan floors start and ceils the end to whole pages instead. The checklist says a single-commit history, but the branch has 4 commits; please squash.
  • Behaviour changes without a cited reference (FreeBSD sys/vm, KytyPS5, shadPS4) or a TechnicalDebt.md statement: DirectMemoryAlloc mapping std::bad_alloc to ENOMEM (previously it propagated), LargestFree treating a negative searchEnd as unbounded (previously false), and len rounded up to whole pages. Either cite where each comes from or keep the old behaviour.
  • docs/dev/TechnicalDebt.md: the new "Unknown function info" line says invalid ranges are "rejected with EINVAL or EFAULT", but Free/Retype return a bool that DirectMemoryFree/DirectMemoryRetype discard. Describe what the code does, one statement per unverified choice. The diff also still adds a blank line before the "Comparison-sampled R32" entry and rewrites the last line (sceSharePlayGetCurrentConnectionInfoA) without changing it; please drop both.
  • Export.cpp (sceKernelAllocateDirectMemory, sceKernelReleaseDirectMemory, sceKernelCheckedReleaseDirectMemory) already rejects unaligned or zero lengths and out-of-pool ranges; keep only the checks the exports don't do, or say which guest path reaches the extra ones.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5484502170 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3870#pullrequestreview-5484502170). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T18:54:39Z. **Review:** CHANGES_REQUESTED --- Thanks for the update. Build and ctest are green on the PR merged onto main, and `MemoryPoolTest` fails with `MemoryPool.cpp` reverted. The points from the previous review about `KernelErrors.hpp`, `searchStart == searchEnd`, non-power-of-two alignment and the CMake blank line are fixed. Still open: - PR body: it says some entry points "converted unexpected exceptions into `false`, `0`, or `EFAULT`", but the original `MemoryPool.cpp` has no `try`/`catch`, so "exceptions propagate" is not a change for those paths. The behaviour table also says an unaligned `start` in `Free`/`CheckedFree`/`Retype` is "Rejected"; `PageSpan` floors `start` and ceils the end to whole pages instead. The checklist says a single-commit history, but the branch has 4 commits; please squash. - Behaviour changes without a cited reference (FreeBSD `sys/vm`, KytyPS5, shadPS4) or a `TechnicalDebt.md` statement: `DirectMemoryAlloc` mapping `std::bad_alloc` to `ENOMEM` (previously it propagated), `LargestFree` treating a negative `searchEnd` as unbounded (previously `false`), and `len` rounded up to whole pages. Either cite where each comes from or keep the old behaviour. - `docs/dev/TechnicalDebt.md`: the new "Unknown function info" line says invalid ranges are "rejected with `EINVAL` or `EFAULT`", but `Free`/`Retype` return a `bool` that `DirectMemoryFree`/`DirectMemoryRetype` discard. Describe what the code does, one statement per unverified choice. The diff also still adds a blank line before the "Comparison-sampled R32" entry and rewrites the last line (`sceSharePlayGetCurrentConnectionInfoA`) without changing it; please drop both. - `Export.cpp` (`sceKernelAllocateDirectMemory`, `sceKernelReleaseDirectMemory`, `sceKernelCheckedReleaseDirectMemory`) already rejects unaligned or zero lengths and out-of-pool ranges; keep only the checks the exports don't do, or say which guest path reaches the extra ones.
adriadam10 commented 2026-10-11 22:12:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T22:12:33Z.

Review: APPROVED


Checked the PR merged onto main: build and ctest (113 tests in core/libs and libkernel, including guest_kernel_sys and MemoryPoolTest) are green, and MemoryPoolTest fails with MemoryPool.cpp reverted. The earlier points (KernelErrors.hpp, alignment, searchStart == searchEnd, TechnicalDebt statements) are fixed.

Added on your branch:

  • Moved the Functional TechnicalDebt line off the top of the section; it conflicted with #3669 and #3691, which add there too.

Left as is, please keep in mind (the description is not part of the code, so we are not editing it):

  • "Tested" says 14 cases, the file has 15.
  • The description says some entry points converted exceptions into false/0/EFAULT; the original had no try/catch, so that is not a change.
  • The checklist says a single-commit history; the branch has 5 commits.

Merging once CI is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5485231817 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3870#pullrequestreview-5485231817). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T22:12:33Z. **Review:** APPROVED --- Checked the PR merged onto main: build and ctest (113 tests in core/libs and libkernel, including `guest_kernel_sys` and `MemoryPoolTest`) are green, and `MemoryPoolTest` fails with `MemoryPool.cpp` reverted. The earlier points (`KernelErrors.hpp`, alignment, `searchStart == searchEnd`, TechnicalDebt statements) are fixed. Added on your branch: - Moved the `Functional` TechnicalDebt line off the top of the section; it conflicted with #3669 and #3691, which add there too. Left as is, please keep in mind (the description is not part of the code, so we are not editing it): - "Tested" says 14 cases, the file has 15. - The description says some entry points converted exceptions into `false`/`0`/`EFAULT`; the original had no `try`/`catch`, so that is not a change. - The checklist says a single-commit history; the branch has 5 commits. Merging once CI is green.
oneandonlydean commented 2026-10-12 03:06:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-12T03:06:51Z.


Passed our title check together with the other queued PRs. It conflicts with main in core/libs/CMakeLists.txt only (main added the guest_acm block where this adds MemoryPoolTest; keep both); please rebase so the full build can run, then it can go in.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6117016557 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3870#issuecomment-6117016557). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-12T03:06:51Z. --- Passed our title check together with the other queued PRs. It conflicts with main in `core/libs/CMakeLists.txt` only (main added the `guest_acm` block where this adds `MemoryPoolTest`; keep both); please rebase so the full build can run, then it can go in.
yash27git commented 2026-10-12 06:33:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by yash27git on 2026-10-12T06:33:36Z.


Checked the PR merged onto main: build and ctest (113 tests in core/libs and libkernel, including guest_kernel_sys and MemoryPoolTest) are green, and MemoryPoolTest fails with MemoryPool.cpp reverted. The earlier points (KernelErrors.hpp, alignment, searchStart == searchEnd, TechnicalDebt statements) are fixed.

Added on your branch:

  • Moved the Functional TechnicalDebt line off the top of the section; it conflicted with #3669 and #3691, which add there too.

Left as is, please keep in mind (the description is not part of the code, so we are not editing it):

  • "Tested" says 14 cases, the file has 15.
  • The description says some entry points converted exceptions into false/0/EFAULT; the original had no try/catch, so that is not a change.
  • The checklist says a single-commit history; the branch has 5 commits.

Merging once CI is green.

Thanks for the review and for resolving the CMake conflict. I've merged the latest main changes into my branch, and the rebase label is now cleared. I'll wait for the remaining workflows to be approved and completed.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6119051094 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3870#issuecomment-6119051094). Originally posted by [yash27git](https://github.com/yash27git) on 2026-10-12T06:33:36Z. --- > Checked the PR merged onto main: build and ctest (113 tests in core/libs and libkernel, including `guest_kernel_sys` and `MemoryPoolTest`) are green, and `MemoryPoolTest` fails with `MemoryPool.cpp` reverted. The earlier points (`KernelErrors.hpp`, alignment, `searchStart == searchEnd`, TechnicalDebt statements) are fixed. > > Added on your branch: > > * Moved the `Functional` TechnicalDebt line off the top of the section; it conflicted with #3669 and #3691, which add there too. > > Left as is, please keep in mind (the description is not part of the code, so we are not editing it): > > * "Tested" says 14 cases, the file has 15. > * The description says some entry points converted exceptions into `false`/`0`/`EFAULT`; the original had no `try`/`catch`, so that is not a change. > * The checklist says a single-commit history; the branch has 5 commits. > > Merging once CI is green. Thanks for the review and for resolving the CMake conflict. I've merged the latest `main` changes into my branch, and the rebase label is now cleared. I'll wait for the remaining workflows to be approved and completed.
yash27git commented 2026-10-12 06:34:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by yash27git on 2026-10-12T06:34:42Z.


**oneandonlydean **

Thanks, oneandonlydean, for pointing out the CMake conflict. I've merged the latest main changes into my branch, and the rebase label has been cleared. I appreciate your help buddy!

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6119064120 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3870#issuecomment-6119064120). Originally posted by [yash27git](https://github.com/yash27git) on 2026-10-12T06:34:42Z. --- > **[oneandonlydean](/oneandonlydean) ** Thanks, [oneandonlydean](/oneandonlydean), for pointing out the CMake conflict. I've merged the latest `main` changes into my branch, and the rebase label has been cleared. I appreciate your help buddy!
yash27git commented 2026-10-12 09:27:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by yash27git on 2026-10-12T09:27:03Z.


Hi oneandonlydean, thanks for your help with the rebase and CMake conflict. The PR already has an approval, and I've merged the latest main changes into my branch. Is anything else needed from my side to get the full build running? I'm happy to address any remaining issues. Thanks once agaiin!

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6121474115 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3870#issuecomment-6121474115). Originally posted by [yash27git](https://github.com/yash27git) on 2026-10-12T09:27:03Z. --- Hi [oneandonlydean](/oneandonlydean), thanks for your help with the rebase and CMake conflict. The PR already has an approval, and I've merged the latest `main` changes into my branch. Is anything else needed from my side to get the full build running? I'm happy to address any remaining issues. Thanks once agaiin!
yash27git commented 2026-10-12 13:06:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by yash27git on 2026-10-12T13:06:16Z.


Resolved the TechnicalDebt.md conflict with main and corrected the description (15 test cases, removed the inaccurate exception bullet, fixed the history line in the checklist). The branch has merge commits from updating through the web UI, so a squash merge would be ideal. Thanks again for the reviews.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6124871282 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3870#issuecomment-6124871282). Originally posted by [yash27git](https://github.com/yash27git) on 2026-10-12T13:06:16Z. --- Resolved the `TechnicalDebt.md` conflict with main and corrected the description (15 test cases, removed the inaccurate exception bullet, fixed the history line in the checklist). The branch has merge commits from updating through the web UI, so a squash merge would be ideal. Thanks again for the reviews.
oneandonlydean commented 2026-10-12 20:34:37 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-12T20:34:37Z.


The Windows build of this branch does not link, and 0d859c27 still has the same target (https://github.com/boykopovar/AnyPS5/actions/runs/38239471765):

ld.exe: MemoryPoolTest.cpp.obj: undefined reference to `__gxx_personality_v0'
ld.exe: MemoryPool.cpp.obj: undefined reference to `__gxx_personality_v0'

core/libs compiles everything with -fno-asynchronous-unwind-tables on MinGW, and that symbol then comes from the guest libc, which MemoryPoolTest does not link. It is a host-only test, so in core/libs/CMakeLists.txt do what patched_libraries_tests and host_thread_local_tests do, in place of configure_windows_unwind(MemoryPoolTest):

if(MINGW)
    target_compile_options(MemoryPoolTest PRIVATE -fasynchronous-unwind-tables)
endif()

Please also rebase onto main as one commit and force-push instead of merging main again; the branch has 11 merge commits.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6132153554 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3870#issuecomment-6132153554). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-12T20:34:37Z. --- The Windows build of this branch does not link, and 0d859c27 still has the same target (https://github.com/boykopovar/AnyPS5/actions/runs/38239471765): ``` ld.exe: MemoryPoolTest.cpp.obj: undefined reference to `__gxx_personality_v0' ld.exe: MemoryPool.cpp.obj: undefined reference to `__gxx_personality_v0' ``` `core/libs` compiles everything with `-fno-asynchronous-unwind-tables` on MinGW, and that symbol then comes from the guest `libc`, which `MemoryPoolTest` does not link. It is a host-only test, so in `core/libs/CMakeLists.txt` do what `patched_libraries_tests` and `host_thread_local_tests` do, in place of `configure_windows_unwind(MemoryPoolTest)`: ```cmake if(MINGW) target_compile_options(MemoryPoolTest PRIVATE -fasynchronous-unwind-tables) endif() ``` Please also rebase onto main as one commit and force-push instead of merging main again; the branch has 11 merge commits.
yash27git commented 2026-10-13 05:40:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by yash27git on 2026-10-13T05:40:17Z.


The Windows build of this branch does not link, and 0d859c2 still has the same target (https://github.com/boykopovar/AnyPS5/actions/runs/38239471765):

ld.exe: MemoryPoolTest.cpp.obj: undefined reference to `__gxx_personality_v0'
ld.exe: MemoryPool.cpp.obj: undefined reference to `__gxx_personality_v0'

core/libs compiles everything with -fno-asynchronous-unwind-tables on MinGW, and that symbol then comes from the guest libc, which MemoryPoolTest does not link. It is a host-only test, so in core/libs/CMakeLists.txt do what patched_libraries_tests and host_thread_local_tests do, in place of configure_windows_unwind(MemoryPoolTest):

if(MINGW)
    target_compile_options(MemoryPoolTest PRIVATE -fasynchronous-unwind-tables)
endif()

Please also rebase onto main as one commit and force-push instead of merging main again; the branch has 11 merge commits.

oneandonlydean You all just sexually harassing me now 😭, But Ok I'll Rebase it. Thanks for supporting me.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6139069600 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3870#issuecomment-6139069600). Originally posted by [yash27git](https://github.com/yash27git) on 2026-10-13T05:40:17Z. --- > The Windows build of this branch does not link, and [0d859c2](https://github.com/boykopovar/AnyPS5/commit/0d859c2729b43cf5a35b751fe49d6b6a8df25b76) still has the same target (https://github.com/boykopovar/AnyPS5/actions/runs/38239471765): > > ``` > ld.exe: MemoryPoolTest.cpp.obj: undefined reference to `__gxx_personality_v0' > ld.exe: MemoryPool.cpp.obj: undefined reference to `__gxx_personality_v0' > ``` > > `core/libs` compiles everything with `-fno-asynchronous-unwind-tables` on MinGW, and that symbol then comes from the guest `libc`, which `MemoryPoolTest` does not link. It is a host-only test, so in `core/libs/CMakeLists.txt` do what `patched_libraries_tests` and `host_thread_local_tests` do, in place of `configure_windows_unwind(MemoryPoolTest)`: > > ```cmake > if(MINGW) > target_compile_options(MemoryPoolTest PRIVATE -fasynchronous-unwind-tables) > endif() > ``` > > Please also rebase onto main as one commit and force-push instead of merging main again; the branch has 11 merge commits. [oneandonlydean](https://github.com/oneandonlydean) You all just sexually harassing me now 😭, But Ok I'll Rebase it. Thanks for supporting me.
oneandonlydean commented 2026-10-13 10:31:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-13T10:31:59Z.


The CMake fix is in. The branch still merges main instead of rebasing (18 merge commits now); please squash it into one commit on top of main and force-push. docs/dev/debt/libkernel.md also lost its final newline.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6143598729 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3870#issuecomment-6143598729). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-13T10:31:59Z. --- The CMake fix is in. The branch still merges main instead of rebasing (18 merge commits now); please squash it into one commit on top of main and force-push. `docs/dev/debt/libkernel.md` also lost its final newline.
yash27git commented 2026-10-13 11:44:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by yash27git on 2026-10-13T11:44:14Z.


Dear oneandonlydean,
Squashed into one commit on top of main and force-pushed; no merge commits remain. docs/dev/debt/libkernel.md ends with a newline again, and the CMake fix (-fasynchronous-unwind-tables under if(MINGW)) is included.

Dear oneandonlydean,
Squashed into one commit on top of main and force-pushed; no merge commits remain. docs/dev/debt/libkernel.md ends with a newline again, and the CMake fix (-fasynchronous-unwind-tables under if(MINGW)) is included.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6144788391 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3870#issuecomment-6144788391). Originally posted by [yash27git](https://github.com/yash27git) on 2026-10-13T11:44:14Z. --- > Dear [oneandonlydean](https://github.com/oneandonlydean), > Squashed into one commit on top of main and force-pushed; no merge commits remain. `docs/dev/debt/libkernel.md` ends with a newline again, and the CMake fix (-fasynchronous-unwind-tables under if(MINGW)) is included. Dear [oneandonlydean](https://github.com/oneandonlydean), Squashed into one commit on top of main and force-pushed; no merge commits remain. docs/dev/debt/libkernel.md ends with a newline again, and the CMake fix (-fasynchronous-unwind-tables under if(MINGW)) is included.
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!3870
No description provided.