Open
Description
Example and initial analysis by @correabuscar:
#![feature(panic_always_abort)]
use std::fmt::{Display, self};
struct MyStruct;
impl Display for MyStruct {
fn fmt(&self, _: &mut fmt::Formatter<'_>) -> fmt::Result {
panic!("this is bad: {}", MyStruct);
}
}
fn main() {
std::panic::always_abort();
println!("{}", MyStruct);
}
The reason for this is that if both "panic while processing panic" and "panic after always_abort
" apply, then we use the AlwaysAbort
code path which does format the panic message.
This could be fixed by moving this check further down below the in_panic_hook
check:
rust/library/std/src/panicking.rs
Lines 393 to 395 in 9f25a04
But I don't know if this has other adverse side-effects. Can we even access thread-local variables after fork
(i.e., when always-abort is set)?
Cc @Amanieu