PRAGMATA (PPSA02530 v01.200.000) on Windows: the title's libc rejects its allocator's mspace buffer in the ASLR-relocated image above 1 TiB, so the first malloc returns NULL and start-up faults #3043
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 xXPBSXx on 2026-10-10T20:59:07Z.
PRAGMATA (PPSA02530 v01.200.000) on Windows: the title's libc rejects its allocator's mspace buffer in the ASLR-relocated image above 1 TiB, so the first
mallocreturns NULL and start-up faultsWhat happens
All libraries load and the title reaches
Transferring control to ELF entry point, then:The write is
mov [r15+0x20], ebxright aftercall mallocreturned 0 (malloc(0x70)). Thatmallocis not the host's: the title ships its ownlibc.prx(converted aslibc.prx.guest.prx).Cause (traced with gdb on the running process)
ApplicationHeapInitializereads, callback at table+0x10).sceLibcMspaceCreate(name, buffer, 0x40000, 0)with a 256 KiB static buffer inside the executable's image (buffer = 0x7ff66b500690in this run) and treats a NULL result as failure.sceLibcMspaceCreatevalidates the buffer against the 40-bit PS5 address window (constants around0xfc00000000, testsbuffer >> 40and>> 43). An address of 2^40 or more is accepted only ifsceKernelIsAddressSanitizerEnabled()returns non-zero. Ours always returns 0 (core/libs/prx/libkernel/System/src/Sanitizer.cpp).DYNAMIC_BASE(DllCharacteristics0x140), and Windows 10 (19045) loadsapp.exenear0x7ff6..., far above 2^40. The mspace creation fails, the callback returns an error, libc raises0xA0020014and0xA0020013and carries on, and the firstmallocreturns NULL.sceKernelDebugRaiseExceptiononly logs here, so start-up continues into the fault. The other titles I tried import the samesceKernelIsAddressSanitizerEnabled, but they do not pass a static buffer inside the image to mspace creation, so they do not hit this.Two experiments
sceKernelIsAddressSanitizerEnabledreturning 1 (a local test only, not a proposal; it would also change what libc believes about sanitizers): the title passes the allocator init, opens/app0/natives/PS5/runtime.args, starts itsFileReaderthread and stops atsce::Json::InitParameter2::setSpecialFloatFormatType not implemented, the same stop as Resident Evil 4 (#2776).DllCharacteristics0x100, loads at0x140000000), sanitizer query unchanged: same result,RunThread entry=0x140a03c90.Fix: the second experiment as one commit on my fork, based on
mainat262c0316:https://github.com/xXPBSXx/AnyPS5/tree/fix/relinker-windows-fixed-image-base
WindowsPeWriter.cppalways writesDllCharacteristics0x100, andwindows_address_spaceexpects NX_COMPAT only. Its startup-stack check is unchanged.Tested: the ten
windows_*ctest tests pass (includingwindows_address_space, which runs the relinked guest eight times and checks the stack stays below0x200000000), andtools/check_conventions.pypasses. Ad Infinitum (PPSA10600, 0 absent imports) behaves as before with the new relinker: no abort in 100 s. PRAGMATA as above.Not verified / limits
*.guest.prx) are still placed by Windows, so a title that gives mspace creation a static buffer from a module's data would still be rejected.823c3cafexpected the relocated image to sit "near the bottom of the address space"; on this machine it sits at0x7ff6.... If a different approach is preferred (for example a low preferred base for each module, or a sanitizer answer that depends on the address), I did not try those.Exports needed to get this far. On
mainthe title does not start: the import audit (executable andlibc.prx, 885 unique imports) shows 27 absent. 19 of them are the stubs from my branch for #2776 (fix/export-ppsa07411-imports), 1 issce_net_in6addr_linklocal_allnodes(#1808, also in that branch), and the other 7 are in a second branch on top of it, with a test and a TechnicalDebt entry:https://github.com/xXPBSXx/AnyPS5/tree/fix/export-ppsa02530-imports
Those seven are
sceAcmBatchJobPriority,sceNpEntitlementAccessGetGameTrialsFlag,scePadVrControllerGetTriggerEffectStates,sceRazorCpuSync,sceSharePlayProhibitController,sceVideoOutDeleteOutputModeEventand one without a known name,-q-vbO859Twin libSceVideoOut. With them the audit shows 658 implemented, 65 stubs and 0 absent.Windows 10 (19045), NVIDIA GeForce RTX 4080 SUPER, MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. The executable and module were relinked from ELF files rebuilt from the dump's containers. Dump from my own digital copy; no game files shared. AI-assisted.
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-11T00:39:56Z.
Retest of PRAGMATA (PPSA02530) on Windows with my current local stack (current
main, fixed image base, TLS thread pointer #3136, direct memory #3143, the library-skip branch from #2591, AGC window offset bit #3163). No audit gaps: 0 absent imports. The title now gets past start-up into the video-out and input layers and stops on two throwing stubs in a row:sceVideoOutGetOutputStatusWithVrr not implemented(statusis an untypedvoid*). A local experiment answering with 0x48 zero bytes got past it. The caller then reads a few fields of that buffer and compares one 16-bit value against 0x3c (60) and others against 0x30 and 0x78; I did not find a public layout for this struct and am not guessing one, so I did not propose a change.sceConvertKeycodeGetCharacter not implemented(declared without parameters inlibSceConvertKeycode, signature unknown).So the null-object crash after the swapchain that I described earlier is not reached in this run. I have not looked further than these two stops. If anyone knows the layout of the VRR output status or the arguments of
sceConvertKeycodeGetCharacter, that is what blocks this title now.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by LeandroSSB on 2026-10-11T01:12:00Z.
Your second experiment is implemented on my fork:
LeandroSSB/AnyPS5:fix/relinker-fixed-image-base(one commit,bc28d55a, onmain06da1176).WindowsPeWritertakes adynamicBaseflag (default true); the main-executable patcher passes false, so the convertedapp.exegetsDllCharacteristics0x100(NX only) and loads at the fixedImageBase0x140000000(WindowsPeFormat.hpp), which is below the guest arena start0x200000000— inside the window the title's libc accepts. Guest modules keep0x140with relocations, so they still relocate around the fixed executable. Base relocations are still emitted for the executable; only the loader flag changes.test_windows_address_space.pynow asserts the executable has a non-empty.relocand0x100and an image base below the arena start, and a new module case asserts a converted module with a relative relocation still gets0x140. The Windows-gated runtime assertions are unchanged.Validated on Linux (GCC, relinker-only build,
BUILD_TESTING=ON): 104/105 ctest, the only failure beingimport_audit, which fails identically onmainin this environment. The Windows 10 runtime behavior is the one you measured (fixed base → allocator init passes); what I could not validate is newer Windows: as recorded in the TechnicalDebt entry, on a machine where the low region is unavailable (Windows 11 build 26200 reserves it, #1955), a non-DYNAMIC_BASEexecutable at an occupied base is refused or relocated back above the window. If you get a chance to rerun PRAGMATA on this branch, that would confirm the start-up path end to end.Not opened as a PR because of the intake pause; a maintainer is welcome to carry the commit.
AI-assisted (Claude Code); I reviewed the change and ran the Linux validation above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-11T02:03:33Z.
@LeandroSSB I ran PRAGMATA (PPSA02530) with your commit
bc28d55aon top of my other local branches, relinked from scratch. The convertedapp.exehasDllCharacteristics0x100 and image base 0x140000000, and the title gets past allocator start-up: it stops later atsceVideoOutGetOutputStatusWithVrr not implemented(the stop I described above). That is the same result I get with my own fixed-base branch (fix/relinker-windows-fixed-image-base, tracked in this issue), which does the same job; so the two are interchangeable for this title, and a maintainer only needs to carry one of them.Limits: Windows 10 22H2 (build 19045) only, so I can not say anything about Windows 11 builds that reserve the low region (#1955).
AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-11T05:06:38Z.
The layout of
sceVideoOutGetOutputStatusWithVrris in #2746 (80 bytes written), and ThatsLeo'sfeat/videoout-output-status-vrr(e893efad) implements it. Could you run PPSA02530 with that branch and post the next stop on #2746?Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-11T07:35:25Z.
Follow-up on PRAGMATA (PPSA02530) on Windows: I went through the remaining stops with local experiments (not proposed as changes), on a test branch with current
main, ThatsLeo's VRR branch (#2746), LeandroSSB's fixed base and my other branches. What the title actually calls after the video-out check, in order:sceConvertKeycodeGetCharacter, called repeatedly with the first argument counting up (0x4,0x5,0x6, ...), second0x4000000, third0, fourth a pointer; with the same "invalid address, signature unknown" answer thatmaingivessceConvertKeycodeGetVirtualKeycode, the title carries on.sceRazorCpuSync: answering 0 and doing nothing was enough to carry on (the othersceRazorCpu*calls inmainare no-ops without a capture).sceNpEntitlementAccessGetGameTrialsFlag: called once; I logged four register values but cannot tell which are arguments. Answering 0 without writing anything carried on.Then the title reaches the first draw and stops on the GPU side:
I did not search for what that state means beyond noticing that it is a graphics-state check, not a library call. So after these three guesses the title is blocked by a graphics feature, not by unknown library signatures. The guesses are not mine to propose as fixes without a reference; the signatures are still unknown.
AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-11T08:24:09Z.
Refreshed the PRAGMATA export branch on current
main(1be0a7ce), independent of my RE4 branch: https://github.com/xXPBSXx/AnyPS5/tree/fix/export-ppsa02530-imports-v2 (one commit, six declared-only imports:sceAcmBatchJobPriority,sceNpEntitlementAccessGetGameTrialsFlag,scePadVrControllerGetTriggerEffectStates,sceRazorCpuSync,sceSharePlayProhibitController,sceVideoOutUnknown_q_vbO859Tw;guest_ppsa02530_exportsand the conventions check pass).sceVideoOutDeleteOutputModeEventfrom the old branch is implemented onmainnow, so it is gone from this one. These only stop the load failure; as described above, the title calls some of them later and needs their real behavior.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-11T15:45:14Z.
Decoding the PRAGMATA stop
VGT_SHADER_STAGES_EN=0x82030: unsupported geometry routing, fast launch or wave-ID state(the check is the geometry-path mask inDecodeShaderStages,core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp,(value & ~0x0047ec30u) == 0):gc_10_1_0_sh_mask.h,VGT_SHADER_STAGES_EN__*)Only bit 19 (
GS_FAST_LAUNCH, mask0x00180000; Mesa'ssrc/amd/registers/gfx10.jsonlists the same bits [19, 20]) is outside the accepted mask, so the title draws with GS fast launch. Mesa programs this for mesh shaders on GFX10:radv_cmd_buffer.csetsGS_EN | GS_FAST_LAUNCH(1) | NGG_WAVE_ID_ENfor the mesh case on GFX10 (2 on GFX11), and the mesh-NGG comment inradv_shader_info.csays that withGS_FAST_LAUNCH=1every lane's VGPRs hold the same input vertex index and one input vertex launches one workgroup. So this is not the normal NGG vertex or geometry launch the mesh path models; it needs its own input-VGPR and launch semantics, and widening the mask would silently run the wrong launch. I have not tried to implement it and did not find a draw of this title that I could check against hardware.Related, not the same: #868 (NGG producer without position export), #1825 and #2293 (merged, other cases), #2261 (registered NGG workgroups through mesh, open). These are Linux/Mesa register definitions for GFX10, not PS5-specific documentation.
AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-11T23:13:37Z.
PRAGMATA (PPSA02530) on
maina672688e9+ #4021 (Windows build fix) + the branch of #3799 (its six exports), relinked fromPPSA02530_elf, 60 s run: it does not get as far as the graphics. The loader stops immediately withFAIL: unresolved ELF import 84MgU4MMTLQ from libSceNet.prx, whichaerolib.csvnamessce_net_in6addr_linklocal_allnodes(a data object, not a function). The import audit for this build lists 18 absent imports in total:sce::Jsonhandlers andInitParameter2::setSpecialFloatFormatType(4),sceConvertKeycodeGetCharacter,sceNpSessionSignalingGetGroupFromSessionId, sixsceSsl*calls: these look like the set in #3773 (its description listslibSceSsl,libSceJson2,libSceConvertKeycode,libSceNpSessionSignaling); I did not merge it to check.sceRazorCpuSync,sceSharePlayProhibitController: implemented in the open #3791 (per the review on #3799).scePadVrControllerSetVibration,scePadVrControllerReadCombinedState,scePadVrControllerSetVibrationMode: I found no open PR for them.sce_net_in6addr_linklocal_allnodes: a data export; I know of no PR for it.So the earlier AGC stop in this thread (
VGT_SHADER_STAGES_EN=0x82030,GS_FAST_LAUNCH, see my comment above) is not reachable on plainmainuntil these exist; I did not test it again here.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-11T23:33:26Z.
Still open, status on
mainf9905068b: the Windows executable written by the relinker still carriesDllCharacteristics 0x140(dynamic base), so it can still be relocated above 1 TiB, which is the cause described here. PRAGMATA cannot be run onmainto confirm the symptom: 9 imports are absent in the import audit of its relinked executable (8 named:setSpecialFloatFormatType,sceAcmBatchJobPriority,scePadVrController*x4,sceRazorCpuSync,sceSharePlayProhibitController), and the Windows run stops atunresolved ELF import Ax7NjOzctIM(sceRazorCpuSync) before the title's libc starts. The export PR #3799 is open.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by LeandroSSB on 2026-10-12T00:29:33Z.
Right — the branch above was still based on this morning's
main. It is now rebased onto currentmain(bca7a29d2):LeandroSSB/AnyPS5:fix/relinker-fixed-image-base, still one commit (6bac77806, cherry-pick clean), and the relinker suite passes 124/124 in a Linux relinker-only build (the only failure-free difference frommainremains the executable'sDllCharacteristics0x100 vs 0x140 — guest modules keep 0x140). If a collaborator wants to carry it, it is ready; your nine-import stack (#3767 and follow-ups) is orthogonal to it.Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-12T09:13:42Z.
Test of LeandroSSB's branch
fix/relinker-fixed-image-base(commit6bac77806, "fix(relinker): load converted Windows executables at a fixed low base"), cherry-picked onto currentmainc36fd0a0e(clean). Windows 10, MinGW GCC, RTX 4080 SUPER, PPSA02530 relinked fromeboot.bin+sce_module/libc.prxin a fresh work directory with the cherry-picked relinker; for the title's missing exports I also merged #3791 and #3799 locally (main alone stops atunresolved ELF import Ax7NjOzctIM,sceRazorCpuSync), so the comparison with the earlier crash below is not between identical stacks. One run each, 150 s limit.mainatd06c06565+ open PRs):FATAL: unhandled exception 0xc0000005atapp.exe+0x26917, a stderr log of 31 lines.what(): sceVideoOutGetOutputStatusWithVrr not implemented(FATAL: abort() (SIGABRT)), i.e. the title passes the point where it faulted and reaches the video-out status query of #2746.So in this one run the fixed image base moves the title past
app.exe+0x26917. I did not repeat it or try the commit on other titles, and I did not look at the picture.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by LeandroSSB on 2026-10-12T23:53:53Z.
That confirms the mechanism end to end — thanks for running it on real hardware. With your Windows run (crash at
app.exe+0x26917gone, title proceeds to the #2746 stop) and our Linux relinker suite (124/124, cherry-pick clean onc36fd0a0e), the branch now has both platforms independently validated:LeandroSSB/AnyPS5:fix/relinker-fixed-image-base6bac77806, still one commit, carry-ready.Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-14T04:16:13Z.
Tested #4237 against this: with its fixed low base the title no longer faults in
malloc.Windows 10 (19045), MinGW-w64 GCC 15.2.0, Release. PPSA02530 v01.200.000 converted with
relinker --windows --registry --trace-imports, run for 90 s:mainwithout #4237:app.exehasDllCharacteristics 0x140(DYNAMIC_BASE) and the run ends in themallocfault described above (app.exe+0x26917).maina5f493f90+ #4237 head808b2a83d(clean merge):app.exehasImageBase 0x140000000andDllCharacteristics 0x100, sosceLibcMspaceCreategets a buffer below 2^40 and the firstmallocsucceeds. The title starts its threads, opens/app0/natives/PS5/runtime.argsand stops atwhat(): sceVideoOutGetOutputStatusWithVrr not implemented(that function has since been implemented by #3972).main00f4b3351(includes #3972) + #4237 head808b2a83d, libraries rebuilt from that tree: the title runs on and now stops at(
core/libs/prx/libSceConvertKeycode/Export.cpp, the function takes no arguments there because its signature is not known; no open PR covers it). Log:run_060924.err, lines 109-111.The same result without #4237 is reached with
relinker --windows-fixed-base 0x400000000(run_050831.err, stop atsceVideoOutGetOutputStatusWithVrr).I did not see the
setSpecialFloatFormatTypestop of the experiment above in these runs; the stops come earlier, at the video-out and keycode functions.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-14T04:43:18Z.
Correction to the last comment: "libraries rebuilt from that tree" was only true for some of the libraries.
For the run on
main00f4b3351+ #4237 (run_060924.err) I rebuiltlibkernel,libcandlibSceVideoOut, and the relinker, from that tree; the otherlibs/*.prxwere still from an oldermainbuild (03:28 that day). The stop atsceConvertKeycodeGetCharacter(lines 109-111) is not affected by that, because that function throws the same way in the older build and inmain, but the runs before it used the old libraries for everything else.A run with all 126
libs/*.prxrebuilt from the tree (maine33258a64+ #4237808b2a83d,run_063225.err) shows the same two results, and what follows oncesceConvertKeycodeGetCharacterreturns an error locally (a local log stub, not a proposal): the title continues to(line 115). An earlier stop at
VGT_SHADER_STAGES_EN=0x82030in an intermediate run came from the oldlibSceAgcDriver.prxand does not occur with a rebuilt one.The
mallocresult (fault without #4237, no fault with it) was measured with the relinker built from the same tree in every run and does not depend on the library build.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-14T05:07:34Z.
Test conditions for the three runs mentioned in the last two comments (what I can state from the logs; the file dates of the libraries and of
relinker.exeused by those runs were overwritten by later builds in the same directory, so they are not given):main00f4b3351+ #4237808b2a83dlibkernel,libc,libSceVideoOutandrelinkerbuilt from this tree; all otherlibs/*.prxstill from an oldermainbuild (03:28 that day)PPSA02530_rI,run_060924.errmaine33258a64+ #4237808b2a83dninja -C build -j4 relinkerplus all 126core/libs/libs/*.prxtargets from this tree (trace_vrr5_PPSA02530.txt: 126 targets 06:28:47, run start 06:32:21, local time)PPSA02530_rK,run_063225.err391f1b32b(-X theirs, see the #5457 comment)trace_vrr6_PPSA02530.txt: 06:34:48, run start 06:38:28)PPSA02530_rL,run_063830.errrK and rL also contain a local log stub that makes
sceConvertKeycodeGetCharacterreturn an error (the function throws onmain); rI does not.Relink for all three:
relink_title_trace.ps1 -Id PPSA02530 -ElfDir I:\AnyPS5\Games\PPSA02530_elf -Repo K:\AnyPS5\wt-sockets, which runsrelinker.exe --windows --registry --trace-imports in\eboot.elf app.exewith the relinker built in that tree, no-ModuleDir, no--windows-fixed-base. Run:run_title.ps1 -Seconds 90,APS5_TRACE_CALLS=all. The relinker-only comparison (fault without #4237, none with it) used the relinker of the respective tree.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T05:11:20Z.
Closing: fixed on main by #4237 (converted Windows executables now load at their preferred base
0x140000000, inside the 40-bit window the title's libc checks); thanks @xXPBSXx for the runs with every library rebuilt. The next stops you found (sceConvertKeycodeGetCharacter, then the tessellation lowering with no LDS per control point) are worth their own issues on current main.