feat(libc): implement getprogname #2218
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2218"
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 MichalSy on 2026-10-09T11:54:34Z.
What
Guest modules importing
getprognamecurrently fail to resolve it, although libkernel already exports the guest__prognamedata. Add the missing libc-internal export and return that existing pointer, matching FreeBSD stable/11 getprogname. This is the getprogname portion of the fork's existing compatibility changes, isolated onto current upstream main.The same implementation runs on Windows and Linux. It introduces no second name store or host process-name lookup. The regression checks the initial guest name, pointer replacement, changes through the returned storage, an empty name, and guest errno preservation.
Duplicate review covered all 510 open PRs targeting main at preparation time, including their fetched heads, changed files, added exports and relevant diffs. No competing getprogname implementation was found. The broad clang-format PR 1128 does not add this function; merging its current head into this branch produces a textual conflict in libc-internal Export.cpp, among its many existing conflicts with current main. Rebase and preserve both changes if that formatting work lands. This branch has no dependency on descriptor-isolation PR 2170.
Tested
Based on upstream
mainatd70b89989473ba1f6ae13e44e079e67f1f8a44b0.all+libsbuild passed.guest_program_nameand adjacentguest_thread_atexitpassed (2/2). Test-registration check passed.guest_program_name,guest_thread_atexitandguest_force_tls_destructorpassed (3/3).Checklist
main; no other open PR implements the same functionImported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-09T20:10:17Z.
Closing: no title is shown stopping at
getprognameon main; #1595 and #1869 were closed for the same reason. Reopen with the title ID and the log line when one does.Imported from boykopovar/AnyPS5. Originally posted by Amoenus on 2026-10-10T18:23:56Z.
PPSA99902: independently validated, observed caller and controlled startup comparison
Replayed this PR's head
0cd6b6c7212727b04174525fc1710f6178cf94c4onto freshly fetched mainbf6e25a1ddc009eb232fdfdb3e6ff58b962df006, local commitd7b10e200b2d710a0b4536973f4111ef45656ebf. Windows 11 Enterprise 26200, WinLibs GCC 15.2.0 r7, Release,BUILD_TESTING=ON.libsbuild passed.guest_program_name,guest_thread_atexitandguest_errorseach passed 5/5."eboot.bin", cache the original pointer, and return null. Source was restored, full libraries rebuilt, and all three tests passed 5/5 again.The returned pointer matches the existing guest name store, as FreeBSD stable/11 getprogname does. This proposal avoids adding a second constant name store; the behavioral test observes pointer replacement and changes to its storage, empty-name readback and errno preservation.
Real title caller. Sonic Unleashed Recompiled, PPSA99902, 01.003.000, unwrapped original executable SHA256
c34f5b0848ef49e96a855076d8254254047e966e4fe56589d0e504fe13828479. With the earlier local diagnostic stack and strict unused-import filtering, the title actually executes, then crashes instrcmp("Project-A.exe", nullptr).Tracing the original ELF established this data flow:
The title's converted guest libc exports
7Psx1DlAyE4at RVA0x10050, with66 0f ef c0 31 c0 c3(zero return). An isolated call of that verified export returned null. PE/ELF address mapping was checked at the getter call, argument store, comparison call and string bytes. This connects the previously audited fallback to an actual executed fault; the issue is the returned null, not evidence thatstrcmpshould accept null input.Controlled comparison. Integrated the exact proposal into the existing diagnostic stack, local commit
f61e0d7768005504fc70ea385534182a2061ebfb. Full libraries built; program-name, thread-exit, error, utime, pthread-attribute and signal tests each passed 5/5. For the game experiment, preserved the earlier immutable 120-PRX profile and replaced onlylibSceLibcInternal.prxwith the rebuilt library. Executable, guest libc and other runtime libraries were identical, verified by manifests and per-run hashes.0xC0000005, same null read through strcmp; no Vulkan device readyAGC driver: graphics program does not belong to a registered shader,0xC0000409Corrected runs took 7.086, 6.512, 6.600, 6.591 and 6.591 seconds. The restored-library control reproduced the original crash in 5.677 seconds. No rendering, physical audio output or gameplay is verified. This is conditional evidence from a stack of local fixes/placeholders using
unused-filter=2and a relinker built at57f96fd2; it is not a result from this proposal alone or unchanged main. The original dump, baseline libraries and guest libc are preserved.The maintainer's unchanged-main first-stop condition remains unmet: the title stops at
dupbefore this call on the pinned baseline. This is validation evidence, not a request to reopen or a new PR. The next graphics stop is covered by existing work in #1732, whose raw-program policy remains under review. AI-assisted investigation: Codex. All additional diagnostic work remains local; no branch push.Current-main confirmation: refreshed the local diagnostic stack onto main
bf6e25a1ddc009eb232fdfdb3e6ff58b962df006(local commit1c2b72a0941314b063e0993f4c74b05dc67d72df) and rebuilt full libraries plus the relinker. All 30 TLS coverage groups and five relevant library tests passed 5/5 each; conventions and test registration passed. Reconverted the original title in both filter modes in an isolated output directory. Five strict-filter startup runs again reached the RTX 5080 Vulkan device/swapchain and the same shader-registration refusal; the default-filter stop remains missingpathconf(oc98+zOImus). The new strict executable and guest libc are bit-for-bit identical to their earlier-main conversion, so the recent TLS change does not change these particular artifacts. Baseline runtime-library and original-source hashes verified after all runs. No rendering/gameplay or standalone-current-main compatibility claim; other local prerequisites remain in this stack.Pull request closed