fix(libkernel): reject overlong POSIX thread names #2230
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2230"
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 QRMOE on 2026-10-09T12:30:50Z.
What
Rejects
pthread_rename_npnames of 32 bytes or more with guestENAMETOOLONG(63), before changing the stored or native thread name. Names up to 31 bytes continue to succeed.This matches the published PS5 firmware 13.60 probe and raw output: 31 bytes succeed; 32 and 40 bytes return 63 and preserve the previous 31-byte name. That measurement was made by the author of #1798, not locally for this PR. This fixes an existing export; no title-unblocking or new-export claim is made.
The dedicated test avoids changing
GuestThreadSelf.cpp. Local merges with the inspected heads of #1798, #1739, #1676 and #2184 are clean. Actual library diffs of 522 open PR heads were inspected; no competing rename-length implementation was found. The latest additional PRs were checked before publication.Tested
Windows 11, WinLibs MinGW-w64 GCC 15.2.0 UCRT/POSIX/SEH, Ninja Release,
BUILD_TESTING=ON,ANYPS5_ENABLE_SPIRV_TOOLS=ON; based on maind70b89989473ba1f6ae13e44e079e67f1f8a44b0.guest_pthread_rename,guest_thread_self,guest_pthread_attr,guest_kernel_errors,guest_errors,guest_thread_atexit,host_thread_localandguest_thread_callback_abi.guest_pthread_renamechecks empty, 1-, 11- and 31-byte names, rejects 32-, 40- and 1024-byte names, verifies the old name survives rejection, checks that a later valid rename succeeds, and checks output guards and errno preservation. It runs on both the adopted main thread and a created guest thread. Final runtime: 0.02 s.32-byte name returned 0; expected ENAMETOOLONG=63). It also detects three deliberate faults: rejecting 31 bytes, returning EINVAL, and changing the name before reporting the error. The final source was restored and rebuilt afterward.Linux, a new console run, games and the full CTest suite have not been run. No new dependency, silent stub or code comment is added.
AI-assisted: yes — OpenAI Codex assisted with implementation, testing and this description.
Checklist
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-10T03:19:21Z.
This conflicts with main after today's merges; could you rebase? It passed testing and is otherwise ready.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T07:56:50Z.
Rebased onto current main as @oneandonlydean asked (only conflict: adjacent test registrations in
libkernel/CMakeLists.txt, kept both). Rebuilt and ranguest_pthread_renameplus the libkernel/libs tests on Linux: green, and the new test fails without the length check inThread.cpp; merging on green CI.