revert: undo #1156's bundled libc lifecycle suppression #1515

Merged
oneandonlydean merged 1 commit from upstream-pr/1515 into main 2026-10-08 10:58:39 +00:00
oneandonlydean commented 2026-10-08 10:50:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-08T10:50:02Z.


What

Reverts #1156 (merge 2d6aff7a1). The revert applies cleanly to current main.

Why

Since #1156, a title's bundled sce_module/libc.prx stays loaded for its exports but its init/fini is suppressed. Titles still call that copy's malloc, which returns NULL because its mspace is never set up (#1500). On Linux this breaks titles that bundle libc at launch:

  • one segfaults within 0.2 s of start;
  • another stops with St9bad_alloc;
  • #1500: Silksong (PPSA12544) segfaults in a module initialiser.

Bisected over 0e173a463..b36718214: e82e03f11 (#1156's parent) is good, 2d6aff7a1 is the first bad commit. With #1156 reverted locally, the first title passes its full run again and the bad_alloc is gone.

The double heap handshake from #693 comes back with this revert. Fixing that needs the bundled copy either initialised, or its allocator routed to ours, so it can be redone in a new PR together with a test that runs a title's bundled malloc.

Tested

  • Linux (CachyOS, x86-64, GCC 16, RTX 4090): main 73ac9ef7f with this revert: ctest 432/432; game runs as above.
  • This branch is the same revert on current main 4b2413fb5. CI on this PR.

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 in TechnicalDebt
  • 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 #1500)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4785612036 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1515). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-08T10:50:02Z. --- ### What Reverts #1156 (merge 2d6aff7a1). The revert applies cleanly to current `main`. ### Why Since #1156, a title's bundled `sce_module/libc.prx` stays loaded for its exports but its init/fini is suppressed. Titles still call that copy's `malloc`, which returns NULL because its mspace is never set up (#1500). On Linux this breaks titles that bundle libc at launch: - one segfaults within 0.2 s of start; - another stops with `St9bad_alloc`; - #1500: Silksong (PPSA12544) segfaults in a module initialiser. Bisected over `0e173a463..b36718214`: e82e03f11 (#1156's parent) is good, 2d6aff7a1 is the first bad commit. With #1156 reverted locally, the first title passes its full run again and the `bad_alloc` is gone. The double heap handshake from #693 comes back with this revert. Fixing that needs the bundled copy either initialised, or its allocator routed to ours, so it can be redone in a new PR together with a test that runs a title's bundled `malloc`. ### Tested - Linux (CachyOS, x86-64, GCC 16, RTX 4090): main 73ac9ef7f with this revert: `ctest` 432/432; game runs as above. - This branch is the same revert on current `main` 4b2413fb5. CI on this PR. ### 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 in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [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 (fixes #1500) - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-08 10:53:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-08T10:53:51Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#1503 core/relinker/relinker/src/guest/GuestModuleBuilder.cpp L88-107
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6058290757 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1515#issuecomment-6058290757). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-08T10:53:51Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #1503 | `core/relinker/relinker/src/guest/GuestModuleBuilder.cpp` [L88-107](https://github.com/boykopovar/AnyPS5/blob/615262f3cdbe4644d725303c64137cb6c50e7cee/core/relinker/relinker/src/guest/GuestModuleBuilder.cpp#L88-L107) | | |
klosixgaming-arch commented 2026-10-08 10:54:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by klosixgaming-arch on 2026-10-08T10:54:03Z.

Review: COMMENTED


This revert addresses a real regression introduced by #1156 where bundled libc copies fail to initialize properly, causing malloc failures. The bisect analysis in the PR description is thorough and convincing.

The changes are extensive but conceptually simple - removing the replacement module ownership tracking that was causing issues. Good testing documentation showing the specific games affected (Silksong segfaulting, bad_alloc errors).

One question: the PR mentions "The double heap handshake from #693 comes back with this revert" - is there a follow-up plan to address that separately, or should it be noted in TechnicalDebt.md?

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5455464967 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1515#pullrequestreview-5455464967). Originally posted by [klosixgaming-arch](https://github.com/klosixgaming-arch) on 2026-10-08T10:54:03Z. **Review:** COMMENTED --- This revert addresses a real regression introduced by #1156 where bundled libc copies fail to initialize properly, causing malloc failures. The bisect analysis in the PR description is thorough and convincing. The changes are extensive but conceptually simple - removing the replacement module ownership tracking that was causing issues. Good testing documentation showing the specific games affected (Silksong segfaulting, bad_alloc errors). One question: the PR mentions "The double heap handshake from #693 comes back with this revert" - is there a follow-up plan to address that separately, or should it be noted in TechnicalDebt.md?
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!1515
No description provided.