test(libc): reset errno after the worker thread in guest_errors #1712
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1712"
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 LuisBiceps on 2026-10-08T17:21:49Z.
What
guest_errorsaborts on Ubuntu 26.04 under WSL2, at its last errno check.strerror_ris not the cause. Guest errno is the host's errno (__errorreturns&errno), and the test creates and joins astd::threadbetween setting errno to 13 and that check. Since glibc 2.42,pthread_createfirst triesmadvise(MADV_GUARD_INSTALL)for the new thread's stack guard. Kernels before 6.13, including WSL2's 6.6, reject it, and glibc falls back tomprotectwith errno left atEINVAL:A program without any AnyPS5 code shows the same: errno is 22 after the first
std::threadis joined; set back to 13, it stays 13 across a second one. POSIX leaves errno unspecified after a successful call, so the test relied on something no host guarantees. CI'subuntu-latestrunner (Ubuntu 24.04, glibc 2.39) does not hit it.The test now checks errno right after the
strerrorcalls, before the thread, and sets it to 13 again after the join, so every errno check covers onlystrerrorandstrerror_r.Tested
BUILD_TESTING=ON,ANYPS5_ENABLE_SPIRV_TOOLS=ON:guest_errorsaborts onmain4b005b22and passes with this change (--repeat until-fail:3).strerror_rleavesEINVALin errno for an unknown number, and whenstrerror(78)does.15.2.0posix-14.0.0-ucrt-r7), Release:guest_errorspasses (--repeat until-fail:3).python3 tools/check_conventions.py --base upstream/mainpasses.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)