fix(libc): use the default heap for an executable without process parameters #6713
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6713"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by karimibrahim07 on 2026-10-16T06:33:06Z.
What
An ELF without a
PT_SCE_PROCPARAMsegment, such as a ps5-payload-dev SDK program, got no.procparsection when relinked for Windows. Its first allocation then stopped withapplication heap: process metadata is missing; relink the executable. That message exists for executables relinked before the section was introduced, but such an ELF has no process parameters to record.WindowsPePatchernow writes a.procparsection with address 0 and size 0 when the ELF has noPT_SCE_PROCPARAMsegment.ApplicationProcessParameters_nid_no_patchreturns null for that record.ApplicationHeapInitialize_nid_no_patch(nullptr)registers the heap's existing default allocator, as it already does for an all-null replacement table.sceKernelGetProcParamreturns null.An executable without any
.procparsection still gets the relink message (application_heap_stats_missingstill passes). On the console such a program runs inside its launcher's process, whose parameters aren't modelled. The new entry indocs/dev/debt/libc.mdrecords that, and that Linux output still stops for such an ELF.Tested
Windows 11 Pro (26300), WinLibs GCC 15.2.0 r7, Ninja Release,
BUILD_TESTING=ON, onmain5d9dcc42d:application_heap_without_parameterstest (Windows). It installs the zero record, then allocates throughoperator newandposix_memalign(64-byte aligned) without calling the test's allocator table, and frees. With the runtime change reverted, it fails withapplication heap: process parameters exceed the image.windows_process_parametersrelinker test. An ELF withoutPT_SCE_PROCPARAMconverted with--windowshas exactly one.procparsection, and it holds zeros. Onmainthere is none.application_heap*tests pass, 9 of 9. The full suite passes, 1302 tests (oneconventions_function_bodiesshard timed out while the machine was busy and passed alone).python tools/check_conventions.py --base origin/mainpasses.The Quake homebrew (#6698), with #6697, #6702, #6707 and this PR, relinked with
--windows --to-intel --trap-sdk-syscall-stubs --registry:application heap: process metadata is missing; relink the executable._startthen expects the launcher'spayload_args_t. How AnyPS5 could start such programs is the design question in #6712, where a prototype that also patches the entry reaches Quake's main menu.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-17T11:37:34Z.
Cross-validation on Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2, PR head
668d51adb, scratch-merged onto main673f7406c(no conflict; #6681 merges with it without conflict too). Windows only, no GPU involved. No local title lacksPT_SCE_PROCPARAM, so there is no title run.application_heap_without_parametersandwindows_process_parameters,--repeat until-fail:3: 3 of 3, together with the other 8application_heap*tests (11 tests, all 3 of 3). The 102 relinker tests also pass 3 of 3 on the merged tree.ApplicationHeap.cppandApplicationProcessParameters.cppfrom main (test kept)application_heap_without_parametersfails withapplication heap: process parameters exceed the image, as you describe. WithWindowsPePatcher.cppfrom mainwindows_process_parametersfails (AssertionError: [], no.procparsection). With the changes both pass.tools/check_conventions.py --base origin/mainandgit diff --check: pass.eboot.elfinputs I have (51 titles) contain aPT_SCE_PROCPARAMsegment, so none exercises this path. Relinking all 51 for Windows with main's relinker and with this one gives identical SHA-256 for all 312 output files (PPSA99995 stops with the same TLS-instructionFAILin both). I did not scan guest modules or secondary executables.PT_SCE_PROCPARAMheader of one local eboot (PPSA69420) toPT_NULLand relinked it with--windows: main's relinker output has no.procparsection, this PR's has one with virtual size 8 and raw size 0. I did not run that executable.Not checked: Quake or other SDK payloads (not available here), Linux, macOS, a full-tree build, the full non-GPU suite.
Written with Claude Code assistance (validation by a subagent, reviewed in this session).
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T13:34:56Z.
Review: CHANGES_REQUESTED
Follow-up after manually merging this PR with #10947: your debt entry for application heap without process parameters combines cleanly, but the resulting libc debt file contains contradictory
nearbyintfobservations (this branch says it uses the host rounding mode; #10947 records console measurements where MXCSR controlled rounding) and two_Thrd_sleepentries with differing behavior. Please coordinate with #10947’s author and reconcile those existing notes against their evidence while preserving both PRs’ distinct implementation notes. Update the overlap/dependency checklist as needed. I found no conflicting code paths; this request is limited to making the combined documentation accurate and non-duplicated.Pull request closed