Repository navigation
feat(relinker): frame red-zone leaves without a frame pointer by moving their rsp operands - #4
Closed
EagleBearerYS wants to merge 3 commits into
Closed
EagleBearerYS wants to merge 3 commits into
EagleBearerYS wants to merge 3 commits into
Conversation
…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.
…ng their rsp operands
… start A leaf's body ran from its start to the next known start or int3 padding, so a function reached only through a pointer, placed right after the leaf without int3 padding, was framed as part of the leaf: its rsp operands were moved and its exits raised rsp although nothing had lowered it. The body now also ends at 16-byte-aligned code after a ret or ud2, and at the target of a jmp when only padding lies between them (a tail call to the next function). Code past such a point is framed only from a real start. A leaf whose code continues past it is skipped as branching out of the function. Aligned code after any other jmp stays in the body: loop headers are aligned there, and cutting after every jmp skipped 2,129 of 2,131 framed leaves in PPSA01556. With this cut 2,132 are framed, and none of them has rewritten bytes in another function of the unwind table.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fork-internal PR to run the full Build workflow on a PR candidate. Not for review.