Skip to content

Include the name of the created tag in TB's Reborrow events #4387

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

saethlin
Copy link
Member

@saethlin saethlin commented Jun 8, 2025

This fixes #4386 by recording and mentioning the created tag in a Reborrow event.

@saethlin saethlin force-pushed the include-new-child-tag branch from 811e911 to ab579e4 Compare June 8, 2025 20:22
@@ -15,7 +15,7 @@ use crate::*;
#[derive(Clone, Copy, Debug)]
pub enum AccessCause {
Explicit(AccessKind),
Reborrow,
Reborrow(BorTag),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Reborrow(BorTag),
/// The tag here is the one *newly created* by the reborrow that caused the access.
Reborrow(BorTag),

@@ -1,11 +1,11 @@
error: Undefined Behavior: reborrow through <TAG> at ALLOC[0x0] is forbidden
error: Undefined Behavior: reborrow to create <TAG> through <TAG> at ALLOC[0x0] is forbidden
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new tag doesn't matter here, does it? Creating it failed, so it can't possibly occur anywhere else in the state already.

@@ -21,7 +21,7 @@ help: the accessed tag <TAG> later transitioned to Active due to a child write a
LL | *x = 1;
| ^^^^^^
= help: this transition corresponds to the first write to a 2-phase borrowed mutable reference
help: the accessed tag <TAG> later transitioned to Frozen due to a reborrow (acting as a foreign read access) at offsets [OFFSET]
help: the accessed tag <TAG> later transitioned to Frozen due to a reborrow to create <TAG> (acting as a foreign read access) at offsets [OFFSET]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it clear that the newly created tag is always the more interesting one here, rather than the tag of the pointer that is the input to the reborrow?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, because it can be traced with -Zmiri-track-pointer-tag (which tells you the parent tag), but you can't find the child tag from the parent.

Copy link
Member Author

@saethlin saethlin Jun 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's why the alternative solution to the linked issue is to make tag tracking also log reborrows of the tracked tag. But I suspect that will be an unusable amount of information written to the terminal.

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.

Log more info about reborrows which cause writes to become invalid under TB
3 participants