-
Notifications
You must be signed in to change notification settings - Fork 247
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
DMA unsound - Simultaneous write to identical address possible #620
Comments
Alternative solution: mark both traits as unsafe. |
Could we stop the DMA/transfer when the transfer is dropped? |
You can still return arbitrary numbers from |
Exactly. This is proof enough that the ability to create arbitrary implementations of AFAIK we have the two already mentioned options:
Of course we can (and probably should) mark the traits as I think that @Finomnis suggestion of sealing the traits is the better choice: We can always relax the restriction later and switch to the other choice, but the other way around would be a breaking change. In any case, we can already mark the traits as |
Additional, I like the idea of canceling the transfer on drop, that would allow us to implement Edit: never mind. I now understand the reason you took the ownership route. |
Marking the traits sealed in the straight-forward way is problematic: I can't easily
When I try to to impl
I get several errors due to conflicts:
I think the root cause of those conflicts is that re-using the same trait, |
It is possible to make the traits sealed by defining distinct sealing traits:
But I get the impression that the little added safety gained isn't worth the added complexity. |
#621 was merged. Shall we close this ticket or is there more to do? |
Not sure, topic too complicated :D |
If you find more unsoundness we can always open a new issue. The question is whether you think this is sufficient to avoid what we currently know about. |
I agree that we should continue this discussion once we find an actual reproducible example of unsoundness. |
Ok. With #621 all known instances of unsoundness should be formally solved, as the traits are now marked as unsafe, so it's the responsibility of the implementing code to provide a sound implementation. There always is potential to improve usability, and there may be unknown soundness issues. Let's close this ticket and open a new one if necessary. BTW, thanks to @Finomnis for reporting this issue! |
Problem
The user can implement his own
WriteTarget
object. This can lead to things like this:Solution
Seal
theWriteTarget
andReadTarget
traits.The text was updated successfully, but these errors were encountered: