-
-
Notifications
You must be signed in to change notification settings - Fork 415
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 compiler bug that allows an unsafe data access pattern #4458
Conversation
Last November, Gordon identified that the compiler was allowing code to recover a `val` from a `box` field. This is unsafe and very "doh". After investigation, it was determined that this bug has existed since Sylvan introduced viewpoint adaptation to the compiler almost a decade ago. I came up with a fix, but after talking with Sylvan, we changed to this fix as it is the "proper pure theory fix". Fixes #4244
This works for the specific case but can run into different issues when it comes to generics. If you give me a second I can produce a working example today if there is one. IIRC the core issue is that code can be erroneously accepted because the upper bound is tag which is marked sendable, but some instantiations are nevertheless unsound. |
Unless this breaks something that is currently correct, let's open an issues for other problems. |
This does cause some new code to erroneously make it past sendability checks that was correctly blocked before. But I would recommend to merging it anyway since these are quite hard to exploit. This code nearly demonstrates, but gets stopped later on by seemingly a bug (you can easily check manually by instantiation that this code should pass typechecking excluding sendability).
Note that after this change, there is no error message for sendability (but there should be). |
Thanks @jasoncarr0. I'll open 1 or more issues for additional improvements. |
I've added do not merge to this so I can update the release notes. |
Last November, Gordon identified that the compiler was allowing code to recover a
val
from abox
field. This is unsafe and very "doh".After investigation, it was determined that this bug has existed since Sylvan introduced viewpoint adaptation to the compiler almost a decade ago.
I came up with a fix, but after talking with Sylvan, we changed to this fix as it is the "proper pure theory fix".
Fixes #4244