Repository navigation
Conversation
…ute queries pthread_attr_get_np and scePthreadAttrGet never wrote the guard size into the destination attribute, so a thread created with guard size 0 reported whatever the caller's attribute already held. FreeBSD 11.4 _pthread_attr_get_np copies the thread's creation attribute, guard size included, with a page-size default. PthreadPrivate now stores the guard size of the attribute the thread was created with (0x1000 for default-attr and adopted threads), and both queries report it. New guest_pthread_guard_size test: threads created with guard sizes 0, 1, 100, 0x1000 and 0x10000 report exactly those values through both queries (from inside the thread and after join, against a destination attribute pre-filled with a stale value); a default-attr thread and the adopted main thread report 0x1000. Fixes boykopovar#6891
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
|
Three things, from a Windows build of this PR merged onto
AI-assisted: yes (Claude Code); results above were run on this machine. |
|
Thanks. The attribute change itself looks right, but the new test doesn't compile on Windows, so CI fails before it runs (run 39370718241):
static void* APS5_VABI ProbeEntry(void* opaque) {With that change, the file compiles cleanly for Windows here (llvm-mingw, |
|
Re-checked head
AI-assisted: yes (Claude Code); results above were run on this machine. |
|
@plokmklo The latest run confirms the existing Windows entry-ABI problem and explains the failure after that is fixed. The current test queries the thread again after scePthreadJoin, while current main rejects queries for an ended thread; it already checks both getters inside ProbeEntry. Please use a live-thread check, add APS5_VABI to ProbeEntry, and give guest_pthread_guard_size the Windows libkernel PATH entry before rerunning it on Linux and Windows. The supplied-stack result also needs reconciling: the report gets the requested 0x2000 guard, while the cited FreeBSD 11.4 create_stack explicitly sets guardsize_attr to zero for a caller-provided stack. Please establish the intended contract and cover that case, keeping any unmeasured console behavior explicit. |
|
Data for the supplied-stack question, from the disassembly of firmware 13.42's
|
|
Windows result for head Host: Windows 11 26300, Intel i7-12700K, WinLibs GCC 15.2.0 (x86_64-ucrt-posix-seh, r6), Release, Three things stop
Not run on a PS5. AI-assisted: yes (Claude Code), the runs and the numbers above are from this machine. |
|
@plokmklo the remaining |
|
Windows check of head Setup: Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release.
AI-assisted: yes. |
|
The new test does not compile on Windows on current
Setup: tested head Whole batch (this PR was one of 11 applied together on AI-assisted: yes (Claude Code) |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — no blocking findings
The guard size is copied from the creation attribute into each thread and returned by both query functions; the prepared bundle includes all six changed files, and I found no verified blocking defect.
What I ran
Reviewed head 0d8f38812afa0b39ff117cbf7a16561889f08be0 using the prepared diff and repo_read.py targeted reads. No tests or build commands were run. The author reports running six tests on Ubuntu 24.04; I did not independently verify those results.
Results
| Check | Result | Note |
|---|---|---|
| Diff and changed code | passed | All six changed files are included and reviewed |
| Build and tests | not run | Results in the PR description are author reported |
| Security and performance | passed | No concrete concern found in inspected changes |
Negative control
Not run. No assertion or code mutation was applied.
Findings
Blocking
None.
Non-blocking
None.
Sources
Reviewed core/libs/prx/libkernel/CMakeLists.txt, core/libs/prx/libkernel/Pthread/Posix/Attr.cpp, core/libs/prx/libkernel/Pthread/include/Pthread.hpp, core/libs/prx/libkernel/Pthread/src/Attr.cpp, core/libs/prx/libkernel/Pthread/src/Thread.cpp, and core/libs/tests/GuestPthreadGuardSize.cpp against the prepared diff at the pinned head.
Not verified
Build and test results were not independently verified. The reviewed bundle listed no excluded changed files; I read the relevant changed code and test source shown in the diff and targeted repository ranges for surrounding implementation.
To get this to a good state
Nothing is required.
|
Current-main validation on machine The four changes needed on top of the rebased PR are:
My local-only candidate is
This preserves the PR's core approach (copy the creation guard into |
|
@plokmklo: follow-up to the earlier local-only review. The candidate has now been rebased onto canonical Windows 11 / MSYS2 UCRT64 GCC 16.2 Release: I did not push or rewrite your contributor-owned branch. The PR description still has unchecked |
|
I am closing this for now. The open review point is that the new test does not compile on Windows because ProbeEntry has no APS5_VABI while the pthread entry is sysv_abi, and the joins also run before RequireProbe. There has been no push since 25 Oct. Feel free to reopen or push a fixed branch at any time and we will look at it again. |
|
@plokmklo @oneandonlydean I’m keeping the guard-size recovery on this existing #8041 route rather than opening another PR. The Dec 3 closure points are understood: the refresh must add I have preserved the local recovery material and routed a fresh manual reconciliation against current upstream main (now No duplicate PR will be created. #6893 stays closed as the duplicate, and I’m leaving #9938 alone because its latest maintainer note says the next step there is maintainer-side. I’m not asking to reopen #8041 yet; the corrected current-main candidate and validation should come back here first. |
What
pthread_attr_get_npandscePthreadAttrGetnever wrote the guard size into the destination attribute, so a thread created with a guard size of 0 still reported whatever the caller's attribute already held. FreeBSD 11.4_pthread_attr_get_np(thr_attr.c) copies the thread's creation attribute, guard size included, and the default is the page size (_thr_guard_default).PthreadPrivatenow stores the guard size of the attribute the thread was created with (0x1000 for default-attribute and adopted threads), and both queries report it. A newguest_pthread_guard_sizetest creates threads with guard sizes 0, 1, 100, 0x1000 and 0x10000 and requires both queries to report exactly those values — from inside the live thread and after join, against a destination attribute pre-filled with a stale value — while a default-attribute thread and the adopted main thread report 0x1000. It fails on main (the stale value survives) and passes with this change.Tested
Ubuntu 24.04 (GCC 13.3, sandbox build):
guest_pthread_guard_size,guest_pthread_attr,guest_pthread_attr_stack,guest_pthread_attr_errors,guest_pthread_stack,guest_pthread_join_detachall pass; the PthreadPrivate field default keeps adopted threads at 0x1000.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)