Repository navigation
Conversation
db28524 to
c2912d7
Compare
c2912d7 to
9b8fe84
Compare
…e on Windows Windows writes an exception frame directly below RSP, so a fault resumed on a guest thread overwrites values a System V leaf function keeps in its red zone. With --frame-red-zone, a leaf function with a push rbp; mov rbp, rsp; push ... prologue that reads or writes below its pushes gets two kinds of trampoline: the prologue lowers RSP by 128 bytes after its pushes, and each pop ...; pop rbp; ret exit raises it back first. Sites a branch enters, sites shorter than a jump and sites over a --to-intel stub are skipped; the conversion reports the framed and skipped counts.
9b8fe84 to
fab7d20
Compare
|
Tested PR #5052 on ASTRO BOT (PPSA21567), the title from my earlier data point on #361. The The test used Windows Server 2025 build 26100, Ryzen 9 5900X, and NVIDIA GeForce RTX 3060. I applied PR commit 9b8fe84 to a local integration branch based on main fc1f063. The older relinker layout needed the framing call moved into its existing conversion entry point and the build sources adapted. The framing implementation itself was unchanged. All 86 relinker tests passed, including The relinker examined 311,729 functions and found 455 red-zone leaf functions. It framed zero: 454 were outside the supported frame-pointer prologue shape, and one had another unsupported stack-pointer use. The executable and both guest modules were byte-identical with and without the flag. The crashing limiter falls within the PR's documented limitation for frameless leaves whose red-zone slots use the stack pointer directly. Three runs used the same libraries and scripted inputs:
All three failed in the same limiter and at the same two crash sites previously reported in #361. The flag neither fixes nor regresses this title, because it frames no function and produces identical binaries. ASTRO BOT needs support for the documented frameless shape before this approach can address its crash. This evidence is for the tested implementation at 9b8fe84, with the integration adaptations described above; it does not establish a runtime result for the newer PR head. GPUs tested: NVIDIA GeForce RTX 3060 12 GB, driver 591.86 (32.0.15.9186), Vulkan 1.4.325, Windows Server 2025 10.0.26100. AI-assisted: yes. |
|
Thanks @fdfawef324, that's a useful data point. It matches the limitation recorded in |
|
@parl0v a data point from GTA V (PPSA04264), the title behind #361's inflate crash. I relinked its eboot with this PR on So none of GTA's red-zone leaves has the RBP prologue this PR frames. The leaf we traced in #361 is zlib's AI-assisted (Claude Code). |
|
Function starts here are direct call targets plus 16-byte-aligned code after int3 padding ( |
|
@oneandonlydean thanks, you're right. A function reached only through a pointer and not preceded by I'll also take the boot count you suggested: PPSA25344 on |
|
@oneandonlydean here's the count you asked for. Closing this one: #5596 fixed it at the source. PPSA25344 on
Before #5596, the same title crashed at I also made the fix you described: function bounds from So on SotS, the safe version of the flag can't reach the code that crashed, and the unsafe version isn't worth carrying now that the race is gone. If another title still shows the red-zone clobber on current main, the |
|
@parl0v a heads-up and a question. Grand Theft Auto V (PPSA04264) hits the same red-zone clobber in zlib's Some leaves can't be framed in place, so we'd relocate those whole functions, and that needs exact bounds. Your |
|
@EagleBearerYS go ahead and use 3ff74b9 in #5640, with the authorship kept and the credit to #5052 as you describe. It sits on |
What
Windows has no red zone: when a guest thread takes a hardware exception that AnyPS5 resumes (write tracking of shared views, retargets, SSE4a), the kernel writes the exception frame directly below RSP before any handler runs. System V leaf functions keep live values there (#361), so a resumed fault can zero a pointer a leaf is about to use.
--frame-red-zone(Windows only, opt-in) gives those leaves a frame at relink time, so the values sit above RSP and a fault's frame lands below them:push rbp; mov rbp, rsp; push ..., it reads or writes below its pushes through RBP, and it has no other use of RSP and no indirect jump.lea -0x80(%rsp), %rsp.pop ...; pop rbp; retexit runslea 0x80(%rsp), %rsp, then the pops and theret.--to-intelstub are skipped. The relinker prints what it framed and why it skipped the rest.DecodedInstructionInfogainsModRmOffsetso the framer can read memory operands.What it doesn't cover (frameless leaves addressing below RSP directly, short exits) is recorded in the relinker's technical debt.
Tested
red_zone_framertest (a framed leaf's exact stub bytes; leaves without red-zone use and functions that call are left alone; a site over another stub is skipped). Rebased on main after feat(relinker): support fixed Windows guest image bases #4140; the usage line lists both flags. 119 of 120 relinker tests pass:windows_import_modulesfails the same way on plainmainon this machine (its Windows DLL stdout probe prints nothing).--to-intel --frame-red-zone: 604 leaves keep values below RSP, 137 are framed (139 exits), including0x1437f74c0, the function of its boot crash. The same counts come out of this branch and of the SotS working-group base.mainto reach its menu), the boot crash atapp.exe+0x37f77b3happened in 6 of 23 boots without the flag and 0 of 42 with it, at the same 40,960 resumed write faults per boot. Main menu speed is unchanged: 8.09 FPS framed vs 7.91 / 7.97. The menu renders correctly.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)