feat(libSceDbgThreadSanitizer): declare the TSan annotation calls and report the sanitizer disabled #4960
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4960"
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 fdfawef324 on 2026-10-13T06:37:40Z.
What
Black Myth: Wukong (PPSA23226) exits at start-up with
0xC0000135(STATUS_DLL_NOT_FOUND):Why the library is loaded at start-up. The executable does not reference it:
eboot.bin's DT_NEEDED has no libSceDbgThreadSanitizer and no libSceJobManager, andapp.registry.jsonhas no import from either. The title's ownsce_module/libSceJobManager_nosubmission.prxlistslibSceDbgThreadSanitizer.prxin its DT_NEEDED (the plainlibSceJobManager.prxdoes not), and its registry imports__tsan_acquire(XyX1104ACcU),__tsan_release(IkoI44e0OXc) andsceKernelIsThreadSanitizerEnabled(LzoM-wVLJDE, libkernel). In GuestModuleBuilder.cpp every ELF insce_moduleis converted and loaded at start-up (deferredapplies only to--module-dirdirectories), and each module's own DT_NEEDED (image.Dependencies) goes intohostLibraries, which becomes the executable's DT_NEEDED. The Windows start-up stub (WindowsEntryStubBuilder.cpp) then loads it. A missing library is skipped only when nothing imports from it (#3129), and this one has imports, so the load fails.Change.
core/libs/prx/libSceDbgThreadSanitizer. It is anExport.cpp-only directory, which theprx/*glob incore/libs/CMakeLists.txtregisters andnid_patcherpatches, as for libSceXml. It declares__tsan_acquireand__tsan_releasewith thevoid(void* addr)signatures from LLVM compiler-rttsan_interface.hat llvm-project 87f0227 (LLVM 20.1.8), lines 24-25. The names hash to the imported NIDs. Both throw throughNotImplemented_nid_no_patch, because AnyPS5 runs no race detector.sceKernelIsThreadSanitizerEnabledin libkernel (Sanitizer.cpp) returns 0. A converted title never runs under the sanitizer. It sits next tosceKernelIsAddressSanitizerEnabled, which also returns 0.sceKernelIsThreadSanitizerEnabled.int(void)is assumed from the address-sanitizer counterpart and from how the module uses it, and is recorded under Unknown function info indocs/dev/debt/libkernel.md. The constant result is also listed there under Silent stubs, because the conventions check requires that for ansce*export whose body only returns a constant (as forsceKernelGetMainSocId). The TSan signature assumption is in the newdocs/dev/debt/libSceDbgThreadSanitizer.md.Behaviour of the module (from reading it locally; no code is reproduced here). One initialisation routine calls
sceKernelIsThreadSanitizerEnabledwithout setting up arguments. If the 32-bit result is nonzero, it sets a module-wide flag. That routine is the only writer of the flag. All 60 call sites of__tsan_acquire/__tsan_releasecheck the flag first and skip the call when it is clear. With the kernel reporting 0, the throwing stubs are never reached.Tested
Windows Server 2025, MinGW-w64 GCC 15.2.0,
build-dev(Release).guest_thread_sanitizertest: the guest callssceKernelIsThreadSanitizerEnabledand requires 0. It passes with the change. WithSanitizer.cppreverted and libkernel rebuilt, it fails with0xC0000139(entry point not found); a clean build fails to link. No export-only test was added for libSceDbgThreadSanitizer (CONTRIBUTING).patched_librariesandguest_software_versionpass. Exports were checked on the patchedlibSceDbgThreadSanitizer.prx(IkoI44e0OXc,XyX1104ACcU) and onlibkernel.prx(LzoM-wVLJDE).tools/import_audit.pyon the 41 PPSA23226 registries, with the title'ssce_moduleandprxas modules:absent 3 imports(the two TSan NIDs andLzoM-wVLJDE)libs:absent 0 imports,implemented 1088,stub 49(the two new throwing stubs count as stubs)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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-13T06:38:03Z.
Progress report (
ea2bbef→0f77f3e)📉 System libraries: 87.93% (-0.05%, +1 implemented, +2 declared functions)
✅ 1 implemented
sceKernelIsThreadSanitizerEnabled⚪ 1 behaviourally empty (constant return or throw)
sceKernelIsThreadSanitizerEnabled🆕 2 declared as stubs
__tsan_acquire__tsan_releaseImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-13T06:50:46Z.
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.
main)docs/dev/debt/libkernel.mdL89Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-13T08:34:01Z.
Checked build and ctest (145 tests,
guest_thread_sanitizerincluded) on Linux; the new test fails to build without the change; the technical debt entries sit under the right sections and the branch merges cleanly withmain. Merging.