Skip to content

Commit

Permalink
Abort PT trace decoding if the "taken" bug arises.
Browse files Browse the repository at this point in the history
I'm working on a proper fix, but in the meantime this ensures we don't
construct nonsense traces in release mode builds.
  • Loading branch information
vext01 committed Jan 24, 2025
1 parent d9d5b0e commit 1fdf1b1
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions hwtracer/src/pt/ykpt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -447,11 +447,16 @@ impl YkPTBlockIterator<'_> {
// TNT buffer. The unwrap cannot fail because the above code ensures that `self.tnts`
// is not empty.
let taken = self.tnts.pop_front().unwrap();
// FIXME: If you re-enable compressed returns (in `collect.c`), once in a blue moon
// this assertion will fail.
// FIXME: Occasionally `taken` is `false` here, which indicates that something has gone
// wrong when decoding the PT trace (even with compressed returns disabled!).
//
// More info: https://github.com/ykjit/yk/issues/874
debug_assert!(taken);
// For now we abort decoding the trace, since we know (and have seen in the wild) that
// if you carry on you get all manner of crashes.
if !taken {
return Err(IteratorError::HWTracerError(HWTracerError::Unrecoverable(
"PT taken bug detected".to_string(),
)));
}
}

Ok(compressed)
Expand Down

0 comments on commit 1fdf1b1

Please sign in to comment.