test(libc): keep Windows exception cleanup coverage on guest frames #3415
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3415"
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 MarcZX10 on 2026-10-11T09:53:33Z.
What
The Windows
windows_exceptionstest usedstd::call_onceto make an exception cross WinLibs runtime DLL frames. On the reported WinLibs GCC 15.2 toolchain,libstdc++-6.dllandlibwinpthread-1.dllhave empty.eh_framesections and carry SEH unwind metadata in.pdata/.xdata; AnyPS5's Itanium unwinder reads.ehmetaand.ehfram, so it cannot unwind those frames. The priorVirtualQueryimage lookup change did not solve that gap and has been removed.The test now throws through recursive guest frames with supported unwind tables and checks that all 65 stack guards are destroyed at depths 0, 1, 7 and 64. TechnicalDebt records that stepping through SEH-only runtime frames and their cleanup handlers remains unimplemented. This change corrects the regression test; it does not claim SEH unwinder support. Refs #3411; #3411 stays open. Exceptions still cannot cross the reported SEH-only runtime frames, and this test no longer covers that path.
Tested
python3 tools/check_conventions.py --base upstream/mainpassed.git diff --check upstream/main...HEADpassed.windows_exceptionsexecutable could not be run locally because this workspace has no MinGW toolchain or Windows runtime. A manual full Build run on this PR is pending.Checklist
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T10:12:18Z.
Review: CHANGES_REQUESTED
Thanks for looking at #3411. A few things before this can go in:
VirtualQueryfallback is what @oneandonlydean asked to drop in #1423 ("fallbacks aren't allowed here. Which images does the loader not know?"). This brings it back without saying which imagesRtlPcToFileHeadermisses.objdump -h) points elsewhere: the WinLibslibstdc++-6.dll/libwinpthread-1.dllonly carry SEH data (.pdata/.xdata) and an empty 4-byte.eh_frame, whileDecodeFrameonly reads.ehmetaand.ehfram. Even withimageresolved byVirtualQuery, the section loop inUnwind.cppfinds no FDE for those frames, so the walk still stops. Nothing here shows the test passing with this change.windows_exceptionswith the change (or have one of the reporters do it) and post the output, plus the result of theRtlPcToFileHeaderfailing/succeeding for thepthread_onceframe (e.g. a log of which images hit the fallback).If the cause is the missing DWARF data, the fix is in the unwinder (e.g. stepping over SEH-only frames with
RtlLookupFunctionEntry+RtlVirtualUnwind) or in the test, not in the image lookup. Happy to re-review once there is evidence for one of them.Imported from boykopovar/AnyPS5. Originally posted by Zurisen on 2026-10-11T10:19:41Z.
Ran this on native Windows, since the description says it could not be:
5f4d0a7dmerged intomainf0c6cf27(clean), Windows 11 Home (26200), WinLibs GCC 15.2.0 r7 (15.2.0posix-14.0.0-ucrt-r7), Release, full build.windows_exceptionsloads the rebuiltbuild/core/libs/libs/unpatched/libc.prx(itsPATHprepend).windows_exceptionsstill fails 5/5 with this change, with the same stop as onmain:So the
VirtualQueryfallback does not get the exception through thestd::call_onceframes here. That fits @AchrafReyani's note on #3411 thatlibstdc++-6.dllandlibwinpthread-1.dllcarry a 4-byte.eh_frameand only.pdata/.xdataunwind data, so finding their image does not give the DWARF unwinder anything to walk.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-11T11:02:22Z.
You and Zurisen are right: the
VirtualQueryfallback does not fix the runtime-frame unwind and should not be presented as a fix. I updated the PR description to state that clearly and to restore the required What/Depends on fields. I have not pushed another code change; a real fix still needs SEH-only frame support or a test change with equivalent cleanup coverage.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-11T14:59:17Z.
I replaced the
std::call_oncereproducer with a regression that throws through 0, 1, 7 and 64 recursive guest frames and verifies every guard destructor. This retains cleanup coverage for frames carrying the unwind tables this library reads while removing the unsupported assumption that an Itanium exception can cross the WinLibslibwinpthread/libstdc++SEH-only frames.The ineffective
VirtualQueryfallback is gone, and the remaining SEH-only limitation is recorded in TechnicalDebt. This does not implement SEH unwinding. The changed regression is Windows-only and I do not have a Windows/MinGW runtime here; conventions and diff checks pass. Could you review whether this is the equivalent cleanup coverage you had in mind?Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T15:03:44Z.
Review: DISMISSED
Thanks for reworking this. The diagnosis now matches #3411 and @Zurisen's run, and the TechnicalDebt line is accurate. Two things before merging:
testUnwindThroughGuestFramesis Windows-only and hasn't been run anywhere (PR CI skips Windows). Could someone with the WinLibs setup (@Zurisen ran the previous head) confirm thatwindows_exceptionspasses with this head? A Windows run (build.ymlwithpr=3415) also works.libstdc++-6.dll/libwinpthread-1.dllframes is still unsupported and, with thecall_oncereproducer gone, no longer covered by any test.Once the Windows run is green this is fine to merge.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-11T15:06:59Z.
I added the requested wording: Refs #3411; #3411 stays open, and the description now says the runtime-DLL exception path is not covered by this test change.
I tried the documented manual workflow dispatch for PR #3415 (
gh workflow run build.yml --ref main --field pr=3415), but GitHub rejected it with HTTP 403: “Must have admin rights to Repository.” The automatic PR workflow has passed its applicable checks, but it skips the full Windows build, sowindows_exceptionshas not run on this head.@Zurisen, could you or another Windows runner with the required workflow permission run the updated PR, or confirm
windows_exceptionson this head? I’ll keep the PR marked pending until that Windows result is available.Imported from boykopovar/AnyPS5. Originally posted by Zurisen on 2026-10-11T15:09:29Z.
@adriadam10 Ran this head on Windows:
f942de36merged intomaina11c8f7f(clean), Windows 11 Home (26200), WinLibs GCC 15.2.0 r7 (15.2.0posix-14.0.0-ucrt-r7), Release, full build.windows_exceptionspasses 5/5:testUnwindThroughGuestFrames()runs before that line, so all four depths (0, 1, 7, 64) caught the exception and ran every guard destructor. Onmainthe same test fails 5/5 here (through runtime frames).Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-11T15:24:43Z.
Windows validation of
f942de36merged ontomaina11c8f7f(Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release,BUILD_TESTING=ON, Developer Mode on, full build includinglibs):windows_exceptionspasses 3/3 with--repeat until-fail:3, and it is gone from the suite failures.ctest -j8 -E "^agc_driver_|^video_out_flip": 532/536, the remaining failures being the knownguest_kernel_sys(#3510) andguest_filesystem(#3518) and the two load flakesagc_driver(#3171) andguest_ampr_markers(#3371), this run being made while seven other builds were running on the host. So #3411 is fixed on this host by this branch.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-11T16:07:15Z.
Requested Windows validation is now available
On head
f942de36, Windows 11/WinLibs Release runs reportwindows_exceptionspassing 5/5, including the 0, 1, 7, and 64 guest-frame cleanup cases. A second report confirms 3/3 repeated runs; the full suite's remaining failures were identified as existing issues or load flakes. The PR description now says “Refs #3411; #3411 stays open.”@adriadam10, could you re-review the current head against your two requested items?