-
Notifications
You must be signed in to change notification settings - Fork 318
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
When reporting a heap use-after-free, say where the allocation was allocated and deallocated #2940
Conversation
Wouldn't it make more sense to point to where the allocation was freed?
|
The primary response to the current diagnostic is "great, now what even is alloc1234" and this change answers that question. I agree that the next question is where the allocation is deallocated, I'll add that. |
I see, makes sense. I guess we can do that in a future PR.
However what would make sense for this PR is to also display the allocation span for out-of-bounds accesses.
|
5003bed
to
58a7f9e
Compare
@rustbot author |
☔ The latest upstream changes (presumably #3007) made this pull request unmergeable. Please resolve the merge conflicts. |
@saethlin what are your plans for this PR? An MVP of this might be to only track spans for heap allocations for now? |
MVP is a good idea. I'll strip this down into a heap-only MVP then probably open an issue to permit this to work for all allocations. |
58a7f9e
to
07b5601
Compare
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.
Looks good, just some nits!
src/machine.rs
Outdated
use self::MiriMemoryKind::*; | ||
match self { | ||
Rust | Miri | C | Mmap => true, | ||
Machine | Global | ExternStatic | Tls | WinHeap | Runtime => false, |
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.
Why is WinHeap
treated different from the other heap allocations?
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 probably pulled it into the false list then never really noticed the mistake... do we have any tests that would show a use-after-free span for WinHeap? I don't think we actually do.
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 think we have such a test, no.
Co-authored-by: Ralf Jung <post@ralfj.de>
Thanks! A nice improvement. :) |
☀️ Test successful - checks-actions |
When reporting a heap use-after-free, say where the allocation was allocated and deallocated This is a partial solution to: rust-lang/miri#2917 Currently in the interpreter, we only have accurate information for where heap allocations are allocated and deallocated (see rust-lang/miri#2940 (comment)). So this just implements support for allocations where the information is already available, and the full support will require more interpreter tweaks.
…lfJung Record allocation spans inside force_allocation This expands rust-lang/miri#2940 to cover locals r? `@RalfJung`
Record allocation spans inside force_allocation This expands #2940 to cover locals r? `@RalfJung`
When reporting a heap use-after-free, say where the allocation was allocated and deallocated This is a partial solution to: rust-lang/miri#2917 Currently in the interpreter, we only have accurate information for where heap allocations are allocated and deallocated (see rust-lang/miri#2940 (comment)). So this just implements support for allocations where the information is already available, and the full support will require more interpreter tweaks.
When reporting a heap use-after-free, say where the allocation was allocated and deallocated This is a partial solution to: rust-lang/miri#2917 Currently in the interpreter, we only have accurate information for where heap allocations are allocated and deallocated (see rust-lang/miri#2940 (comment)). So this just implements support for allocations where the information is already available, and the full support will require more interpreter tweaks.
This is a partial solution to: #2917
Currently in the interpreter, we only have accurate information for where heap allocations are allocated and deallocated (see #2940 (comment)). So this just implements support for allocations where the information is already available, and the full support will require more interpreter tweaks.