feat(libkernel_sys): implement pthread_attr_setstackaddr and pthread_attr_getsolosched_np #14798
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/14798"
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 Zyylon on 2026-11-01T18:07:39Z.
What
Implement
pthread_attr_setstackaddrandpthread_attr_getsolosched_npinlibkernel_sysand add unit test coverage inGuestKernelSysPthreadNp.Provenance and Limits (per
docs/dev/REVERSE_ENGINEERING.md:80-86):libkernel_sys.sprx(SHA-25660921322b155ba649cfa29ea5e6d358ca0229424b4f73fd5c30ae7f7ce7c304c).pthread_attr_setstackaddr(NIDsuCrEbr0xIQ) at0x4ed0: validates attribute pointer, handle, and stack address (returningEINVALif any are null) and stores the stack address at attribute offset0x18.pthread_attr_getsolosched_np(NIDApMLfJ527Ag) at0x51b0: validates attribute pointer, handle, and output pointer (returningEINVALif any are null), writing the attribute field at+0x10masked with0x10.docs/dev/debt/libkernel_sys.md.Landing Order Coordination (per
CONTRIBUTING.md:71):main. Once #14798 lands, #15111 rebases cleanly by appending its mode toGUEST_KERNEL_SYS_PTHREAD_NP_MODES.Depends on: noneis correctly declared as this PR has no prerequisite.Tested
python tools/check_conventions.py --base origin/main: passed (clean).python core/libs/tests/test_public_headers.py --audit-only: passed (399 libraries, 26,743 exports verified).git diff --check origin/main...HEAD: passed (0 diff/whitespace errors).cmake --build build --target guest_kernel_sys_pthread_np_tests: passed (clean build, 0 warnings/errors).22c9156417:ctest --test-dir build -R guest_kernel_sys_pthread_np -V:-DANYPS5_ENABLE_SPIRV_TOOLS=ON).ctest --test-dir build -E '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 12 --output-on-failure.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 MarcZX10 on 2026-11-01T18:11:28Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
The implementation matches the recorded firmware disassembly, but the PR does not report a test run or the required test environment.
What I ran
Reviewed head
e96e16593d6c7773446e35310985249ee1cd01d3against basef2d874c1fdccf781c0fa5d86619bb5dd8894b958; the merge preview was clean. Environment: Linux 6.1, Python 3.11.2, Git 2.39.5; no C++ compiler invocation.Command results and complete precheck table
git diff --checkexited 0 with empty stdout. Conventions output:ABI audit JSON summary:
Test-quality heuristic output:
I checked the CMake
foreachregistration directly; it registers theattrmode, so the heuristic's literal-path warning is a false positive.Public-header audit output:
Complete precheck table (the
failedhelper rows below are launch errors in this local isolated checkout, not PR findings):The precheck deliberately does not configure, build, or compile AnyPS5.git diff --check f2d874c1fdccf781c0fa5d86619bb5dd8894b958...e96e16593d6c7773446e35310985249ee1cd01d3/usr/bin/python3 tools/check_conventions.py --base f2d874c1fdccf781c0fa5d86619bb5dd8894b958 --head e96e16593d6c7773446e35310985249ee1cd01d3 --title feat(libkernel_sys): implement pthread_attr_setstackaddr and pthread_attr_getsolosched_np --body /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-14798-e96e16593d6c/pr-body.md/usr/bin/python3 tools/pr_abi_audit.py --base f2d874c1fdccf781c0fa5d86619bb5dd8894b958 --head e96e16593d6c7773446e35310985249ee1cd01d3 --jsonNo changed Python implementation files.No changed tools/ module has an existing sibling tools/tests/test_<module>.py suite.No changed test_*.py files./usr/bin/python3 /marc/AnyPS5/tools/pr_stack_check.py 14798 --repo boykopovar/AnyPS5 --output-dir /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-14798-e96e16593d6c/stackNot run: C++ tests need exact-head binaries, which require a build; the precheck does not build./usr/bin/python3 /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-14798-e96e16593d6c/head-e96e16593d6c-a0ad4816/tools/pr_test_quality.py --root /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-14798-e96e16593d6c/head-e96e16593d6c-a0ad4816 --json core/libs/CMakeLists.txt core/libs/prx/libkernel_sys/Export.Discovery.cpp core/libs/prx/libkernel_sys/include/Api.hpp core/libs/tests/GuestKernelSysPthreadNp.cpp docs/dev/debt/libkernel_sys.mdNo changed Python test module in tools/ can be run as a no-build base-source control.Raw precheck stderr for the missing local helper files:
Hosted check output at review time:
Results
attrtest mode.Negative control
Not run: the new C++ test requires a built target. No negative-control result is claimed.
Findings
Blocking
The PR's
### Testedsection says only “Unit test coverage inGuestKernelSysPthreadNp”; it does not state whether the test ran or give the OS and result. The repository requires tests to be run before opening and the tested OS to be described. Please run the newguest_kernel_sys_pthread_np_attrCTest case and updateTestedwith the OS, command and result, or correct the section if the test was not run. This is a reporting and test-evidence blocker; I found no source-level defect in the reviewed implementation.Non-blocking
None.
Sources
attrCTest registration at the reviewed headNot verified
No build or C++ test execution was performed by me. The PR's current hosted checks cover conventions, intake and labels only and were pending; no hosted test result was available. I did not test on Windows, macOS or PS5 hardware. The firmware behavior was read from the repository's recorded disassembly evidence, not independently remeasured.
To get this to a good state
Add the actual OS, command and result for
guest_kernel_sys_pthread_np_attrtoTested. I will re-check the exact new head, rerun the same no-build checks and review any new test evidence.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-02T10:54:11Z.
Review: CHANGES_REQUESTED
Re-checked — new head, changes requested
At head
5d15238de265f5a8133c7a202123115e2d5d6322, the implementation and firmware provenance match the prior review, but the newly registeredattrtest has no run result for this head.What I ran
Reviewed all five changed files against base
5bae1a4bc2cffc66c13e37ce8e63ae48b1b5dd1e. Environment: Debian Linux 6.1, Python 3.11.2, GCC 12.2.0; no build or C++ test execution. The AMD CI run cited in the discussion is for prior heade96e16593d6c7773446e35310985249ee1cd01d3; the new test registration and test cases were added after that head.Results
mainattrmode is registeredPrecheck table and relevant raw output
Negative control
Not run. The new C++ test requires a built target; no negative-control result is claimed.
Findings
Blocking
guest_kernel_sys_pthread_np_attrwas registered after the AMD CI run one96e165; the current hosted checks are conventions and labels only. Please run this CTest case on the current head and add its OS, command, and result toTested. The implementation itself matches the firmware behavior recorded in the existing debt entry; this request is specifically for evidence that covers the newly added test.Non-blocking
None.
Sources
Not verified
No local build or C++ test was run. The AMD run is for the earlier head and therefore does not cover the added
attrtest. Console runtime behavior remains unverified as the PR description states.To get this to a good state
Run
guest_kernel_sys_pthread_np_attron this head and record the OS, exact command, and result. I will recheck the new head and the same test evidence.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-02T18:54:01Z.
Review: CHANGES_REQUESTED
Re-checked — same head, changes requested
The author's exact-head Windows test report resolves the earlier test-evidence request, but two unresolved overlaps still need an agreed landing order under the repository rules.
What I ran
Reviewed all five changed files at head
5d15238de265f5a8133c7a202123115e2d5d6322, against PR base5bae1a4bc2cffc66c13e37ce8e63ae48b1b5dd1e. The precheck's merge preview against currentmaina4eca2a056bf3bbbec98ab42e9d28163e4ea9cb8was clean. Pairwise previews used the current heads of #15111 (e5322eaed8f4c87d59a47fb674b2d854dc4e84dd) and #9156 (550810d74a304089683fd7f6994315974df0aaa1) and found conflicts. Environment: Debian 12, Linux 6.1.0-54-amd64, Python 3.11.2, Git 2.39.5; no compiler or local build was used.The author reports, but I did not independently run, this exact-head Windows test:
Reported environment: Windows 11 AMD64, AMD Ryzen 7 H 250 with Radeon 780M, GCC 16.2.0 MinGW-W64, CMake 4.4.4, Ninja 1.13.2. The author reports the
attrtest passed 1/1 and thepthread_np_group passed 3/3.Results
mainattris registered; the heuristic warning is a false positive.Full precheck table and relevant raw output
The precheck deliberately does not configure, build, or compile AnyPS5.git diff --check 5bae1a4bc2cffc66c13e37ce8e63ae48b1b5dd1e...5d15238de265f5a8133c7a202123115e2d5d6322/usr/bin/python3 tools/check_conventions.py --base 5bae1a4bc2cffc66c13e37ce8e63ae48b1b5dd1e --head 5d15238de265f5a8133c7a202123115e2d5d6322 --title feat(libkernel_sys): implement pthread_attr_setstackaddr and pthread_attr_getsolosched_np --body /tmp/review-14798-followup/pr-body.md/usr/bin/python3 tools/pr_abi_audit.py --base 5bae1a4bc2cffc66c13e37ce8e63ae48b1b5dd1e --head 5d15238de265f5a8133c7a202123115e2d5d6322 --jsonNo changed Python implementation files.No changed tools/ module has an existing sibling tools/tests/test_<module>.py suite.No changed test_*.py files./usr/bin/python3 /marc/AnyPS5/tools/pr_stack_check.py 14798 --repo boykopovar/AnyPS5 --output-dir /tmp/review-14798-followup/stackNot run: C++ tests need exact-head binaries, which require a build; the precheck does not build./usr/bin/python3 /tmp/review-14798-followup/head-5d15238de265-7886d066/tools/pr_test_quality.py --root /tmp/review-14798-followup/head-5d15238de265-7886d066 --json core/libs/CMakeLists.txt core/libs/prx/libkernel_sys/Export.Discovery.cpp core/libs/prx/libkernel_sys/include/Api.hpp core/libs/tests/GuestKernelSysPthreadNp.cpp docs/dev/debt/libkernel_sys.mdNo changed Python test module in tools/ can be run as a no-build base-source control.The two precheck failures above are missing-helper errors in its isolated snapshot; I reran both helpers from the workspace. The ABI audit returned
passed, 507 symbols and no findings. The test-quality heuristic returned this warning, which manual inspection disproved becauseattris in the CMake mode list:Pairwise merge-tree output (both commands exited 1):
Hosted check output for the current head:
Author-reported CTest output excerpt:
Negative control
TestAttrchecks invalid handles and outputs plus stack-address and solo-scheduling round trips.Findings
Blocking
CONTRIBUTING.mdrequires authors of PRs that overlap in changed lines or exports to agree on order and record it withDepends on. The current checklist saysDepends on: none, but #9156 implements the same two named exports inlibkernel, and its branch conflicts with this head inlibkernel_sys/Export.Discovery.cppand a debt file. Separately, #15111 changes the same CMake mode list and test source; the exact-head pairwise merge preview conflicts in both files. I found no public agreement between these PR authors or dependency declaration covering these overlaps. Please coordinate the intended order/scope with the affected authors and updateDepends onaccordingly before this PR proceeds.Non-blocking
None.
Sources
libkernel_sysimplementationslibkernelattrNot verified
No local build, CTest or negative control was run. The Windows test results are author-reported. No PS5 console runtime test was reported. Current hosted checks show conventions and labels only; they do not provide hosted product-build or C++ test evidence for this head.
To get this to a good state
Agree with the authors of #9156 and #15111 which PRs go first, record the applicable dependencies in the checklist, and resolve the resulting branch integration conflicts. I will rerun the precheck and pairwise merge previews and recheck the exact head after that update.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-03T00:04:17Z.
Review: CHANGES_REQUESTED
Re-checked — same head, changes requested
The exact-head test evidence now covers the earlier test request, but the two overlapping PRs still lack an agreed landing order.
What I ran
Refreshed open PR #14798 at head
5d15238de265f5a8133c7a202123115e2d5d6322, base5bae1a4bc2cffc66c13e37ce8e63ae48b1b5dd1e; no code changes have been pushed since my prior full review of this exact head. Environment: Debian Linux 6.1, Python 3.11.2, Git 2.39.5. I did not build or run CTest locally.Results
main.main, 58 skipped, and no new Vulkan validation IDs.Check output
The precheck’s diff, conventions and current-base stack checks passed. Its isolated snapshot lacked the optional ABI and test-quality scripts; the same-head ABI audit had already passed with no findings in my prior review. The precheck did not build or run C++ tests.
Negative control
Not run locally. The reported Windows and AMD runs used the unmodified PR head; they are not negative controls.
Findings
Blocking
The proposed landing order is still not agreed. #14798 conflicts pairwise with #15111 in the shared CMake registration and test file, and with #9156 in the
libkernel_sysexport and debt files. The author has proposed landing #14798 first on both PR discussions, but neither affected author has replied; the current checklist still saysDepends on: none. Please agree the order with the affected authors and record the dependency/order in the checklist. The new Windows and AMD evidence resolves the prior test-evidence request; it does not resolve these overlap conflicts.Non-blocking
None.
Sources
Not verified
I did not independently reproduce the author’s Windows or AMD runs, build locally, run CTest, or test PS5 console behavior. Current hosted checks cover conventions and labels; no hosted C++ test job is shown for this head.
To get this to a good state
Get agreement on the landing order from the affected authors and update
Depends onaccordingly. I will rerun the exact-head precheck and pairwise merge previews after the order or either head changes.