Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix possible access to fromspace when autoboxing return values #1624

Merged
merged 1 commit into from Dec 22, 2021

Conversation

niner
Copy link
Contributor

@niner niner commented Dec 20, 2021

If the target frame (e.g. tc->cur_frame) is a heap frame that lives in the
nursery, the return value is a native value (e.g. return_i or a native call),
the caller expects an object and boxing happens to trigger a GC run, the
target frame could be moved before we dereference the target pointer to get
the return_value register. This would lead to a segfault with GC_DEBUG 3.

Fix by dereferencing target first instead of having the autobox(_int) macros
doing it after boxing.

Fixes GH #1621

If the target frame (e.g. tc->cur_frame) is a heap frame that lives in the
nursery, the return value is a native value (e.g. return_i or a native call),
the caller expects an object and boxing happens to trigger a GC run, the
target frame could be moved before we dereference the target pointer to get
the return_value register. This would lead to a segfault with GC_DEBUG 3.

Fix by dereferencing target first instead of having the autobox(_int) macros
doing it after boxing.

Fixes GH #1621
@niner niner merged commit 2914410 into master Dec 22, 2021
@coke coke deleted the fix_autoboxing_gc_issue branch February 9, 2022 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant