Skip to content

winch: Check for stack overflow#7774

Merged
elliottt merged 5 commits into
bytecodealliance:mainfrom
elliottt:trevor/winch-stack-overflow
Jan 17, 2024
Merged

winch: Check for stack overflow#7774
elliottt merged 5 commits into
bytecodealliance:mainfrom
elliottt:trevor/winch-stack-overflow

Conversation

@elliottt
Copy link
Copy Markdown
Member

@elliottt elliottt commented Jan 12, 2024

Add stack overflow checking to the x64 backend in winch, and enable the runtime test for overflow. The method for checking for overflow is to compare sp against the stack limit from vmctx after the stack pointer has been adjusted to hold the locals for the function.

@elliottt elliottt requested review from a team as code owners January 12, 2024 20:37
@elliottt elliottt requested review from abrown, pchickey and saulecabrera and removed request for a team January 12, 2024 20:37
@elliottt elliottt force-pushed the trevor/winch-stack-overflow branch from 3b28906 to b11b526 Compare January 12, 2024 21:38
@github-actions github-actions Bot added the winch Winch issues or pull requests label Jan 12, 2024
@github-actions
Copy link
Copy Markdown

Subscribe to Label Action

cc @saulecabrera

Details This issue or pull request has been labeled: "winch"

Thus the following users have been cc'd because of the following labels:

  • saulecabrera: winch

To subscribe or unsubscribe from this label, edit the .github/subscribe-to-label.json configuration file.

Learn more.

Copy link
Copy Markdown
Member

@saulecabrera saulecabrera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks! Just a comment regarding tests, and after that this should be ready to land.

Regarding filetests and disassembly, -- as mentioned offline -- I think it's a very reasonable thing to do. I just couldn't come up with a straightforward and sound way to do it, in the brief exploration that I did for this. I'd like to keep labels around for filetests that require jumps and such, if possible. Perhaps we can continue the discussion in #7552?

Comment thread tests/misc_testsuite/winch/call.wast
@elliottt elliottt force-pushed the trevor/winch-stack-overflow branch from b11b526 to 1d86e5d Compare January 16, 2024 17:41
@elliottt elliottt added this pull request to the merge queue Jan 16, 2024
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jan 16, 2024
@saulecabrera
Copy link
Copy Markdown
Member

I think this is due to incomplete unwind information encoding in Windows. All test that involve traps, currently fail on Windows for this reason. I think it's fine to ignore the tests introduced in this PR, temporarily in https://github.com/bytecodealliance/wasmtime/blob/main/build.rs#L210

@elliottt
Copy link
Copy Markdown
Member Author

I think this is due to incomplete unwind information encoding in Windows. All test that involve traps, currently fail on Windows for this reason. I think it's fine to ignore the tests introduced in this PR, temporarily in https://github.com/bytecodealliance/wasmtime/blob/main/build.rs#L210

Thank you for tracking this down! I was really dreading having to debug a windows failure 😅

@elliottt elliottt requested a review from a team as a code owner January 16, 2024 23:32
@elliottt
Copy link
Copy Markdown
Member Author

Also in an argument for merging #7782 first, removing instruction offsets cuts the diff of this PR in half 👍

@elliottt elliottt force-pushed the trevor/winch-stack-overflow branch from 796e743 to c255c98 Compare January 17, 2024 18:03
@elliottt elliottt added this pull request to the merge queue Jan 17, 2024
Merged via the queue into bytecodealliance:main with commit 3f52cff Jan 17, 2024
@elliottt elliottt deleted the trevor/winch-stack-overflow branch January 17, 2024 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

winch Winch issues or pull requests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants