fix(libkernel): answer the thread atexit references as measured on a PS5 #10243
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10243"
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 orezraey on 2026-10-23T15:17:59Z.
What
_sceKernelRtldThreadAtexitIncrementand_sceKernelRtldThreadAtexitDecrementmeasured on a retail PS5 (firmware 13.60) throughlibkernel_sys.sprxfrom a payload process, on a watchdog thread. The source and console log are in this gist (prtldat).main, as a payload is not an rtld module)The console's Decrement returns nothing:
raxheld the same leftover value (0xe6a75fc1) in every case, so it is avoidfunction. AnyPS5 keeps returning 0. An unbalanced Decrement on a module's address was not measured (every unbalanced Decrement in the log is outside every module), so it still throws, and the debt entry says so. The module'sref_countfromsceKernelGetModuleInfoFromAddrstayed 5 through two Increments and two Decrements, so the console counts these apart from module references; AnyPS5 still pins the image, as fpPS4 does. The variants without the leading underscore are not exported by firmware 13.60'slibkernel_sys; the debt entry says so.#9298 edits the same debt line; whichever lands second keeps both.
Tested
Windows 11, MinGW (winlibs), and Linux (WSL Ubuntu, GCC), at head
b3b0760369(mainmerged after #9298 landed; only the debt entry met, keeping this PR's measured wording andmain's newpthread_cleanup_pushentry). At this headguest_dynamic_loaderpasses three runs in a row on both.guest_dynamic_loaderchecks -1 for a stack and a null address, 0 for Decrements outside every module, and a throw for an unbalanced Decrement on a module's address. It fails onmainand passes three runs in a row with the change, as do the 73 other loader, TLS, atexit and module tests.tools/check_conventions.pypasses.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 harisibrar1 on 2026-10-24T05:35:57Z.
Review: COMMENTED
Checked against main
7c2400d29band the prtldat gist (source and log, fw 13.60):0xfffffffffor null, 0x1000, stack and heap, and 0 for libSceLibcInternal. Decrement'sraxis always0xe6a75fc1, so it does look void,ref_countstays 5, and the non-underscore names are unexported.&Requirecase at GuestDynamicLoader.cpp:232 and the case this PR changes from a throw to a log line, isn't measured yet. Could you adddec(libc_addr)with no Increment to prtldat (and maybe a dec after the two balanced ones)? Otherwise the debt line could say that this case is unmeasured.mainalso returned -1, presumably because a payload isn't an rtld module. It might be worth adding to the table.Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.