-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Launch a non-unwinding panic for misaligned pointer deref #112599
Conversation
@@ -171,9 +171,9 @@ fn panic_misaligned_pointer_dereference(required: usize, found: usize) -> ! { | |||
super::intrinsics::abort() | |||
} | |||
|
|||
panic!( | |||
panic_nounwind_fmt(format_args!( |
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.
We should also make this function #[rustc_nounwind]
and document that this function MUST NOT unwind.
I wouldn't worry about non-local dependency that you mentioned at #112403 (comment), since this is a lang item and it's expected that lang item may need special guarantees. A #[rustc_nounwind]
just near the lang item attribute with a comment should be clear enough to prevent mistakes.
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
☔ The latest upstream changes (presumably #112681) made this pull request unmergeable. Please resolve the merge conflicts. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This looks fine to me. @bors r+ |
Launch a non-unwinding panic for misaligned pointer deref This panic already never unwinds, but that's only because it always hits the unwind guard that's created by our `UnwindAction::Terminate`. Hitting the unwind guard generates a huge double-panic backtrace. Now we generate a normal-looking panic message when this check is hit. r? `@thomcc`
☀️ Test successful - checks-actions |
Finished benchmarking commit (0c2c243): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Bootstrap: 655.45s -> 656.801s (0.21%) |
} else { | ||
UnwindAction::Unreachable | ||
}, | ||
// The panic symbol that this calls is #[rustc_nounwind]. We never want to insert an |
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.
Would be good to mention panic_misaligned_pointer_dereference
here so one can grep for what that symbol is. (I was not aware/forgot that different AssertKind
dispatch to completely different code on assertion failure.)
…fJung Mention the panic function in CheckAlignment Per rust-lang#112599 (comment) r? `@RalfJung`
This panic already never unwinds, but that's only because it always hits the unwind guard that's created by our
UnwindAction::Terminate
. Hitting the unwind guard generates a huge double-panic backtrace. Now we generate a normal-looking panic message when this check is hit.r? @thomcc