gh-141976: Check stack bounds in JIT optimizer#142201
gh-141976: Check stack bounds in JIT optimizer#142201Fidget-Spinner merged 9 commits intopython:mainfrom
Conversation
markshannon
left a comment
There was a problem hiding this comment.
One piece of code left from the earlier version that should be removed.
Otherwise, LGTM.
| def emit_save(self, storage: Storage) -> None: | ||
| storage.flush(self.out) | ||
|
|
||
| def sync_sp( |
There was a problem hiding this comment.
This is now just a copy of the overridden method, so it can be removed.
|
When you're done making the requested changes, leave the comment: |
|
Actually, there's a serious flaw with this approach. It should be checking the stack bound before we write and increment the stack pointer. Otherwise, we might be writing to invalid memory. |
|
I have made the requested changes; please review again |
|
Thanks for making the requested changes! @markshannon: please review the changes made to this pull request. |
markshannon
left a comment
There was a problem hiding this comment.
LGTM.
The extra checks probably aren't strictly necessary for safety, since we are writing into the middle of a huge buffer.
But, they're not wrong and a bit of extra safety is a good thing.
I verified this fixes the repro given in the issue. I'm not adding the repro because it's not self-contained, and so might change if asyncio changes.
WITHIN_STACK_BOUNDS()inoptimize_uops#141976