-
Notifications
You must be signed in to change notification settings - Fork 386
TB: Track permissions on the byte-level #4314
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
base: master
Are you sure you want to change the base?
Conversation
// If we are creating protected Reserved, which can | ||
// never be ReservedIM, the value of the `ty_is_freeze` | ||
// argument doesn't matter (`ty_is_freeze || true` will always be `true`). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this comment, where does the || true
come from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The true
is the protected
argument in new_reserved
when
we enable protectors
if ty_is_freeze || protected { Self::new_reserved_frz() } else { Self::new_reserved_im() }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay.... so what is the point of this comment then? I am still confused.
We do set ty_is_freeze
properly here, right? So why is it relevant that the value does not matter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment is more of a note. The current master branch also has a similar
comment:
miri/src/borrow_tracker/tree_borrows/mod.rs
Line 511 in 3919c4b
// Note: if we were to inline `new_reserved` below we would find out that |
So, how does adding a new node work (and why do we need to call
For Stacked Borrows, there are no per-block operations: each stack at each offset its own stack and completely independent from the other ones at different offsets in the same allocation. So there, more (basically everything) can be moved into the per-offset function. So what do we do for Tree Borrows? One answer is to combine parent reading, permission setting and data race notifying together. This would be somewhat ugly, because you're constructing a node, while also accessing the tree, and this would only be fine because you're careful to not actually add the node into the Should we do this? |
Ignoring the SIFA thingy since I already forgot how it works, what I think would make sense is to do a single
Does that makes sense or is it too ugly as well? |
That would work. It has to construct an extra |
I'm not sure, but that's at least plausible. I also prefer it conceptually. |
Previously, the assert would cause an error if the `RangeMap` was empty.
This makes the tracking of permissions on the byte-level, like in Stacked Borrows, which makes the tracking of interior mutable data more fine-grained.
cc @RalfJung @JoJoDeveloping