fix(libSceFiber): unpoison the stack a contextless fiber abandons under ASan #20009
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/20009"
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 Kal0s-design on 2026-11-14T11:36:42Z.
What
fiber_contextlessis red in the Sanitizers nightly since 2026-11-14 (run 43553066656,main072e08e338; it passed on 11-13):The store is into
localInfo, a local ofsceFiberGetInfoitself. Its shadow byte isf1, a left redzone, left there by an earlier frame at the same address.Why. A fiber without a context runs on the calling thread's stack, below the frame that ran it. When it returns to the thread or switches to another fiber, its frames are abandoned: no epilogue runs, so the redzones they poisoned stay in the shadow. GCC's instrumented prologue writes only the redzone bytes of the new frame and relies on the variable bytes being zero, so the next function at the same stack address stores into a local that the shadow still marks as a redzone.
a6073c813a(#19385) gavesceFiberGetInfoits first locals, which is why the test turned red then;maintoday fails the same way asunknown-crashon the same store.The change.
CompletePendingSuspendunpoisons[savedStack, threadStack)when the suspended fiber has no context: that is exactly the range its frames occupied, from the stack pointer saved at the switch up to the thread's saved stack pointer. Compiled only under ASan (__SANITIZE_ADDRESS__orANYPS5_ENABLE_ASAN); the other builds get an empty function. Fibers with a context keep their frames, since they resume.Tested
Linux, GCC 16, ASan + UBSan with the Sanitizers workflow's flags,
mainf0c9b11f91and this head:fiber_contextless: fails onmainwith the CHECK above (the same store, reported asunknown-crashsince #19856); passes 3 of 3 with this change, throughctest.fiber: passes.-DANYPS5_ENABLE_TSAN=ON): both tests pass, no report.Windows 11, MinGW GCC 15, Release:
fiberandfiber_contextlesspass (the change compiles to nothing there).check_conventions.pypasses.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)🤖 Generated with Claude Code
Pull request closed