Skip to content

test(libkernel): pin the module answers of the thread-atexit reference pair - #21091

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
olegon85:test/libkernel-thread-atexit-module-answers
Nov 15, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
olegon85:test/libkernel-thread-atexit-module-answers

Conversation

@olegon85

Copy link
Copy Markdown
Contributor

What

docs/dev/debt/libkernel.md records for _sceKernelRtldThreadAtexitIncrement / _sceKernelRtldThreadAtexitDecrement that "As in a payload process on a PS5 (firmware 13.60), Increment returns -1 for an address outside every module (null, stack, heap) and 0 otherwise, and Decrement never fails on an address outside every module or after a matching Increment; the console's Decrement returns nothing, here 0. An unmatched Decrement on a module's address did not fault there and changes nothing here", and that "The variants without the leading underscore are not exported by firmware 13.60's libkernel_sys; here they match" the underscored ones. The new test pins those recorded answers for both spellings: null, stack and heap addresses answer -1 from Increment and 0 from Decrement, an address inside a loaded image takes and releases cleanly (0 then 0), and an unmatched Decrement on that same module address answers 0. Timeout, refcount and console-return-value semantics are not asserted beyond the recorded text. No console measurement is claimed beyond what the debt file records.

Tested

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

@PrivacyOnion PrivacyOnion left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 962ee0f504:

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: guest_kernel_thread_atexit_tests built cleanly.
  • CTest (guest_kernel_thread_atexit):
    1/1 Test #5298: guest_kernel_thread_atexit .......   Passed    0.01 sec
    100% tests passed, 0 tests failed out of 1
    
  • Code reading:
    • Verified core/libs/tests/GuestKernelThreadAtexit.cpp tests null, stack, and heap pointers against both sceKernelRtldThreadAtexitIncrement and _sceKernelRtldThreadAtexitIncrement_nid_postfix returning -1.
    • Verified core/libs/tests/GuestKernelThreadAtexit.cpp tests null, stack, and heap pointers against sceKernelRtldThreadAtexitDecrement and _sceKernelRtldThreadAtexitDecrement_nid_postfix returning 0.
    • Verified core/libs/tests/GuestKernelThreadAtexit.cpp checks a valid loaded module address (&sceKernelRtldThreadAtexitIncrement) for matched increment/decrement (0 then 0) and unmatched decrement (0).
    • Verified core/libs/prx/libkernel/CMakeLists.txt properly registers guest_kernel_thread_atexit_tests with libkernel and libc linkage, Windows unwind configuration, 20s timeout, and WIN32 PATH modification.
    • Verified strict compliance with AGENTS.md (no comments in code, no extra files, C++20 and LP64/LLP64 portability).

Looks Good To Me

@oneandonlydean
oneandonlydean merged commit 13a18a5 into boykopovar:main Nov 15, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants