Repository navigation
Conversation
…pthread_attr_get_np pthread_attr_get_np and scePthreadAttrGet left the guard size of the destination attribute untouched, so a thread created with a guard size of 0 reported whatever the caller's attribute held. FreeBSD 11 libthr copies the thread's creation attribute, guard size included.
|
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.
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.
|
|
@MarcZX100 thanks for carrying this. One case differs from the FreeBSD 11.4 libthr behavior the new debt entry cites: a thread created with a caller-supplied stack ( In FreeBSD 11.4, if ((pattr->stackaddr_attr) != NULL) {
pattr->guardsize_attr = 0;
pattr->flags |= THR_STACK_USER;
Following FreeBSD, if (attr) guardSize = attr->stackAddress ? 0 : attr->_guardsize;With that line the probe reports Separately, the PR body says the test covers queries made "while the thread is running and after join".
Setup: Linux x86-64, lavapipe (Mesa 26.2.4) clean env, AI-assisted: yes |
|
Thanks for the FreeBSD source trace and the user-stack probe. I applied the reported rule: |
|
@MarcZX100 since you couldn't build it locally: I built and ran the new head 2969fb4 on Linux x86-64. My user-stack probe, which queries from the creating thread rather than from inside the worker, also reports guard 0 from both Setup: the 3x rows ran AI-assisted: yes |
|
Thanks for the current-head run and the creating-thread probe. This confirms the caller-supplied stack case returns guard size 0 through both query exports, while the library-allocated stack retains 0x1000. The focused guard-size, attribute, and stack tests pass 3/3 each, and the Thread.cpp negative control fails the guard-size test as expected. I have recorded this runtime confirmation; the hosted Linux/Windows jobs remain skipped on this head. |
|
Windows build check of the current head 2969fb4 (the hosted Windows jobs were skipped on it): the new test does not compile with MinGW. Windows 11 10.0.26200.9711, WinLibs GCC 15.2.0 posix UCRT r7, Release, BUILD_TESTING=ON, PR merged onto main f3263df (no conflicts):
Using C++17 aligned new/delete instead builds and passes: +#include <new>
...
- void* stack = std::aligned_alloc(0x1000, USER_STACK_SIZE);
+ void* stack = ::operator new(USER_STACK_SIZE, std::align_val_t{0x1000});
...
- std::free(stack);
+ ::operator delete(stack, std::align_val_t{0x1000});With that change on the same merge: guest_pthread_guard_size, guest_pthread_attr and guest_pthread_stack pass 3/3 each (ctest --repeat until-fail:3). I did not run the Thread.cpp negative control on Windows, and did not check the change on Linux. AI-assisted: yes |
|
Thanks for catching the MinGW portability issue and for testing the aligned allocation replacement. I applied it in |
jotitadev
left a comment
There was a problem hiding this comment.
Linux runtime run of the current head ece11f830, since the author's host stops at the CPU-feature guard and the MinGW check did not cover Linux.
Machine: Linux x86_64, i7-8700, Ubuntu 26.04, GCC 15.2, Release, BUILD_TESTING=ON.
Head ece11f830 merged onto main 20a84154f (clean merge).
tree -> result
ece11f830 + main -> guest_pthread_guard_size, guest_pthread_attr, guest_pthread_stack: 3/3 pass each
same, Thread.cpp guard line reverted (test kept) -> guest_pthread_guard_size aborts (attr and stack still pass)
guard_size binary, 12 copies at once x 10 rounds -> 0/120 fail
So the aligned operator new/operator delete stack builds and runs on Linux, and the caller-stack case still catches the Thread.cpp change.
Setup: ctest --no-tests=error -R '^<test>$' --repeat until-fail:3 per test under env -i with a fresh XDG_CACHE_HOME; the parallel row ran guest_pthread_guard_size_tests directly.
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
|
Thanks for running the current head on Linux. The three focused tests pass 3/3 each, and the reverted Thread.cpp control fails only the guard-size check as intended. That confirms the aligned stack allocation works on Linux as well as the earlier Windows result. I’ve recorded this validation on the PR. AI-assisted: yes (Codex); report reviewed. |
|
Thanks for the independent Linux run on the current head |
|
Windows run of the current head Radeon 860M (RDNA 3.5), Ryzen AI 7 350, Windows 11 26300, WinLibs GCC 15.2.0 r7, Release,
AI-assisted |
|
Thanks for the Windows run on head |
What
Carries Hussein Kadhim's two commits from #6891, preserving his original commit authorship.
pthread_attr_get_npandscePthreadAttrGetnow copy the thread's guard-size attribute into the destination attribute.PthreadPrivaterecords the value used at creation, including the existing 0x1000 default. This reports the recorded attribute; it does not claim that the host stack applies that guard size.Adds
guest_pthread_guard_sizecoverage for the default and explicit sizes, for both query exports, while the thread is running and for apthread_attr_get_npround trip. A caller-supplied stack reports a zero guard size, matching FreeBSD libthr behavior.The current open #5918 changes the reported bounds of adopted host-thread stacks on Windows. It shares
Thread.cppand test registration, but does not implement either attribute query; the merge preview is clean.Tested
main66e290f1c:python3 tools/check_conventions.py --base upstream/main --head HEADandgit diff --check upstream/main...HEADpass.BUILD_TESTING=ON:guest_pthread_guard_size_testsbuilds successfully. CTest was attempted but the process aborts at the emulator's host CPU guard before assertions: this Xeon E5-1620 v2 lacks LZCNT, BMI1/2, MOVBE, AVX2 and FMA.guest_pthread_attrandguest_pthread_stackalso pass. The reporter's probe covers requested sizes 0, 1, 100, 4096 and 65536, default size, running and finished threads, and the round trip. I did not run these Windows tests.Checklist
main; no other open PR implements the same functions