fix(relinker): frame red-zone leaves past an int3 in the middle #19336
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/19336"
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 zorde23 on 2026-11-13T04:14:55Z.
What
In
--frame-red-zone, the framer decodes each function from its FDE start and stops the body at its first single-byteint3, taking it as padding. Anint3in the middle of a function (an inline breakpoint or trap before more code) therefore cuts the body short: a frame-pointer leaf with one is analyzed only up to it, and its exit after theint3is never seen, so the leaf is not framed and keeps its red zone.The body now stops at an
int3only when nothing butint3follows it up to the FDE end, which is the "int3 padding before it" thatdocs/dev/debt/relinker.mdalready describes.int n(0xcd) was never a stop and is still decoded through.core/relinker/codegen/src/x86/RedZoneFramer.cpp: the trailing-padding check.framesAFramePointerLeafPastAnInterruptInTheMiddleinRedZoneFramerTests.cpp: a frame-pointer leaf with anint3, and one withint 0x41, in the middle of its body must be framed up to itsret, and the exit after the interrupt must raiserspbeforepop rbp. Onmaintheint3case fails with "a frame-pointer leaf with an interrupt in the middle was not framed up to its ret".Tested
Relinker-only build as in CI (
-DANYPS5_RELINKER_ONLY=ON -DBUILD_TESTING=ON, Release),mainata6606d5baband this PR on top of it, on two hosts:Ubuntu 24.04, g++ 13.3.0
main(a6606d5bab)output_fifo_macosoutput_fifo_macosred_zone_framerred_zone_framer_executionWindows 11, MinGW-w64 GCC 15.2.0 (WinLibs, as in CI)
main(a6606d5bab)conventions_git_errors,test_script_registration,web_library_assetsred_zone_framerred_zone_framer_executionOn Linux,
output_fifo_macosfails the same way onmainin that environment (AssertionError: regularintest_output_fifo.py) and passes on Windows. The three Windows failures callgit, and the sources there were exported without.git; they fail the same way onmain. Neither touches the framer. On Linux the full suite ran only for this PR; formainonlyred_zone_framerandoutput_fifo_macoswere run.Not tested on a macOS host, and not with a title.
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
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-15T20:59:58Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
d46ab37d57:tools/check_conventions.pypassed;git diff --checkclean.red_zone_framer_testsbuilt cleanly.red_zone_framer,red_zone_framer_execution):core/relinker/codegen/src/x86/RedZoneFramer.cppreverted tomainand the new tests kept, the suite fails: Restoring the change makes it pass again.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-23T01:43:49Z.
Review: APPROVED
Reviewed — looks good
The change at head
d46ab37d57c33bbf4b3e44ce9416bda422055a7dconditionally treats trailingint3instructions as padding; the implementation and focused regression test support the stated fix. I reviewed both changed files; no checks were run by me.What I ran
No commands or tests were run. I inspected the prepared diff and the changed files at the pinned head using
repo_read.py.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
I did not run the test suite or verify behavior on macOS or a physical console. The description reports test runs on Ubuntu and Windows; these were not performed by me. Both files listed in the manifest as reviewed were read. No files were excluded in
files.jsonbecause it was not provided in the prepared materials.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T11:55:30Z.
Review: COMMENTED
Built this head with
ANYPS5_RELINKER_ONLY=ONand ranred_zone_framerandred_zone_framer_executionon Linux. Both passed, covering the generated frame and its native execution.AI-assisted: yes.