linux CI: guest_kernel_stack_protect aborts on main since #2982 (libc unwinder, GCC 13 only) #3459
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 orishamir on 2026-10-11T10:59:09Z.
guest_kernel_stack_protect(added by #2982, merged 07:52Z Oct 11) aborts in CI'slinuxjob in every completed run onmainsince, from 38123701690 (08:07Z,f60923bf) to 38131389299 (10:16Z,e7827eb4), and in contributors' fork CI runs (#3394 and #3451-#3453 list it as a failure frommain):It fails the same way in a container that mirrors the job (ubuntu 24.04, GCC 13.3, glibc 2.39) on
main74981fab, in 6 of 6 full-suite runs. It passes on Arch with GCC 16.2.1 (@fma-rc's run on #2982), so it depends on the toolchain.The abort is libc's own unwinder:
_Unwind_Resumeinlibc.prxcannot step (LibcUnwind::Stepreturns false) out of the GCC 13 cold partition ofGuestAllocations::replaceRangewhile resuming the exception thatmprotectfrom the test's worker thread is expected to report. The frames and the FDE are in my comment on #2982. I have not found the cause in the unwinder and have no fix.@TheAggie, since the test is yours.
AI-assisted: yes (Claude Code Opus 5.5 xhigh)
Imported from boykopovar/AnyPS5. Originally posted by LeandroSSB on 2026-10-11T13:33:23Z.
The root cause is not the cold partition's FDE — it is mixed host/guest unwinding — and a fix is on my fork:
LeandroSSB/AnyPS5:fix/libc-unwind-cold-partition(one commit,d8b0e3410, cherry-picked clean onto currentmaina11c8f7f7).What actually fails. Non-Apple executables link
-static -static-libgcc -static-libstdc++(CMakeLists.txt:36-38), and the ones that linklibkernel.prxend up defining the host exception runtime in the executable: the link map showseh_ptr.opulled forlibkernel.prx, so the exe exports__cxa_throw/__gxx_personality_v0. A throw from insidelibc.prx(replaceRange) therefore raises aGNUC++-class exception through the host runtime (LD_DEBUG=bindings:libc.prx → exefor__cxa_throw), while the landing pad's_Unwind_Resumestill binds to libc's own export (→ libc.prx). libc's personality cannot type-match the foreign class at the typed handler inGuestAllocationsProtect→_URC_FATAL_PHASE2_ERROR→ abort. I traced the cold FDE first: it is found viaeh_frame_hdrand stepped correctly, so the issue's FDE premise was a red herring — which also explains why-fno-reorder-blocks-and-partitionchanged nothing, and why the frame shows the cold partition at all (host phase 2 parked the cleanup there). The GCC 16/Arch pass is the same coin: which static libstdc++ members the linker pulls differs by toolchain — merely adding a try/catch to a test TU flips the bindings (recorded in TechnicalDebt; don't "fix" such tests by editing them).Fix.
_Unwind_Resume_nid_postfixdelegates only the hostGNUC++class pair (0x474e5543432b2b00and its dependent) to the host unwinder that follows libc in the link map (dlsym(RTLD_NEXT, ...), native fallback when there is none); every other class resumes natively as before, so class-0 forced unwinds stay on libc's stop protocol._Unwind_RaiseExceptionand_Unwind_Resume_or_Rethrownever delegate — the host unwinder would call the personality recorded in the CIE with a host_Unwind_Contextwhose layout libc's personality does not share (verified by experiment). Two lines plus two helpers;ExceptionPersonalitypins the class predicate; the constraints and the residual guest-rethrow-of-host-class gap are in TechnicalDebt.Tested in a container mirroring the CI job (ubuntu 24.04, GCC 13.3, glibc 2.39):
guest_kernel_stack_protectaborts on puremaina11c8f7f7and passes with the commit; the exception/cancel set (exception_personality,exception_runtime,c_cleanup,guest_pthread_cancel*,kernel_errors) passes 8/8; the full suite's failure set is identical before and after on a pristine rebuild (import_auditplus the environment's agc lavapipe flakes;guest_truncatealso aborts on pristine main in this container, in an in-exestd::filesystem.cold— unwinder-unrelated, may deserve its own look).Not opened as a PR because of the intake pause; a maintainer is welcome to carry the commit.
AI-assisted (Claude Code); I reviewed the change and ran everything above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by LeandroSSB on 2026-10-11T15:19:09Z.
Small nudge in case this slipped past: the commit above is cherry-pick-clean onto current
mainand turns the last unaddressed red of the Linux CI job green — verified in a CI-mirror container (ubuntu 24.04, GCC 13.3, lavapipe): puremaina11c8f7f7abortsguest_kernel_stack_protect,main+d8b0e3410passes it and the exception/cancel set 8/8, with the full-suite failure set otherwise identical. The other two current reds are covered by open PRs (#3526 → #3532, #3630 → #3418), so this one is what is missing for main to go green again. If a collaborator wants to carry it (intake is paused for me), the branch is one commit on top of current main.Imported from boykopovar/AnyPS5. Originally posted by Silverash-i8 on 2026-10-11T18:01:13Z.
@LeandroSSB I checked
d8b0e3410on top ofmaina11c8f7fon both platforms.Linux (WSL2 Ubuntu 22.04, glibc 2.35, GCC 13.4.0 from the toolchain PPA, Release,
BUILD_TESTING=ON), so a different GCC 13 build and glibc from your CI-mirror container:main:guest_kernel_stack_protectaborts (Subprocess aborted), as in your run.--repeat until-fail:5), andexception_runtime,exception_personality,exception_c_cleanup, the threeguest_pthread_cancel*tests andguest_kernel_errorspass 7 of 7.agc_driver*: 533 of 535. The two failures come from this environment and don't reach AnyPS5 code:pr_overlap_encodingusessubprocess._text_encoding, which Python 3.10 doesn't have, andlinux_executable_exportsstops compiling its own C probe (RTLD_DEFAULTundeclared).Windows (11 Home 26200, WinLibs GCC 15.2.0 r7, Release):
HostUnwindEntryreturns null there, so_Unwind_Resumekeeps its native path, and the results matchmain. All tests exceptagc_driver*: 537 of 540, failing onlywindows_exceptions(#3411),guest_filesystem(#3518) andguest_kernel_sys(#3510), as onmain.guest_kernel_stack_protect, theguest_pthread_cancel*tests andguest_kernel_errorspass. The threeexception_*tests above aren't registered on Windows.I can't carry it either (intake), but from both runs it does what you describe, with no change on Windows.
AI-assisted (Claude Code); I ran the above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by LeandroSSB on 2026-10-11T18:09:11Z.
Thanks for the cross-check — and the Windows half settles a designed-in assumption: the TechnicalDebt entry's fallback ("with no host unwinder after libc it also falls back to the native path") was reasoning, and your run measures it —
HostUnwindEntrynull → native resume → results byte-identical tomain, so the commit is a strict Linux-only behavior change by construction, not just by observation. With your GCC 13.4 build and my CI-mirror 13.3 both red→green and Windows unchanged, the commit is carry-ready as it stands (d8b0e3410, cherry-pick-clean ona11c8f7f).