kernel: fix bug in MarkWeakPointerObj during copying #2780
Merged
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.
We did not mark the forwarding pointer when copying. As a result, a badly timed GC could have reaped the copy of the wpobj, and then when we try to finalize the copying, a crash (or, if we were really unlucky, corrupt data) could have resulted.
I never observed this manifest, though; I only discovered it while trying together with @rbehrends to track down a crash with Julia GC; while inspecting our code in PR #2688, I realized that the bug fixed here exists (and that I had "accidentally" fixed it in PR #2688 for Julia GC, because I changed the code there to not use
MarkWeakPointerObjanymore).This issue is also resolved by PR #2777, which completely refactors the copying code, and essentially makes this kind of bug impossible.