Skip to content

Commit 4a320f1

Browse files
committed
remove the ability to disable ABI checking
1 parent f79ea81 commit 4a320f1

15 files changed

+9
-126
lines changed

README.md

-2
Original file line numberDiff line numberDiff line change
@@ -359,8 +359,6 @@ The remaining flags are for advanced use only, and more likely to change or be r
359359
Some of these are **unsound**, which means they can lead
360360
to Miri failing to detect cases of undefined behavior in a program.
361361

362-
* `-Zmiri-disable-abi-check` disables checking [function ABI]. Using this flag
363-
is **unsound**. This flag is **deprecated**.
364362
* `-Zmiri-disable-alignment-check` disables checking pointer alignment, so you
365363
can focus on other failures, but it means Miri can miss bugs in your program.
366364
Using this flag is **unsound**.

src/bin/miri.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -413,10 +413,9 @@ fn main() {
413413
);
414414
} else if arg == "-Zmiri-disable-abi-check" {
415415
eprintln!(
416-
"WARNING: the flag `-Zmiri-disable-abi-check` is deprecated and planned to be removed.\n\
417-
If you have a use-case for it, please file an issue."
416+
"WARNING: the flag `-Zmiri-disable-abi-check` no longer has any effect; \
417+
ABI checks cannot be disabled any more"
418418
);
419-
miri_config.check_abi = false;
420419
} else if arg == "-Zmiri-disable-isolation" {
421420
if matches!(isolation_enabled, Some(true)) {
422421
show_error!(

src/eval.rs

-3
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,6 @@ pub struct MiriConfig {
9494
pub unique_is_unique: bool,
9595
/// Controls alignment checking.
9696
pub check_alignment: AlignmentCheck,
97-
/// Controls function [ABI](Abi) checking.
98-
pub check_abi: bool,
9997
/// Action for an op requiring communication with the host.
10098
pub isolated_op: IsolatedOp,
10199
/// Determines if memory leaks should be ignored.
@@ -160,7 +158,6 @@ impl Default for MiriConfig {
160158
borrow_tracker: Some(BorrowTrackerMethod::StackedBorrows),
161159
unique_is_unique: false,
162160
check_alignment: AlignmentCheck::Int,
163-
check_abi: true,
164161
isolated_op: IsolatedOp::Reject(RejectOpWith::Abort),
165162
ignore_leaks: false,
166163
forwarded_env_vars: vec![],

src/helpers.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
380380
let this = self.eval_context_mut();
381381
let param_env = ty::ParamEnv::reveal_all(); // in Miri this is always the param_env we use... and this.param_env is private.
382382
let callee_abi = f.ty(*this.tcx, param_env).fn_sig(*this.tcx).abi();
383-
if this.machine.enforce_abi && callee_abi != caller_abi {
383+
if callee_abi != caller_abi {
384384
throw_ub_format!(
385385
"calling a function with ABI {} using caller ABI {}",
386386
callee_abi.name(),
@@ -938,7 +938,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
938938

939939
/// Check that the ABI is what we expect.
940940
fn check_abi<'a>(&self, abi: Abi, exp_abi: Abi) -> InterpResult<'a, ()> {
941-
if self.eval_context_ref().machine.enforce_abi && abi != exp_abi {
941+
if abi != exp_abi {
942942
throw_ub_format!(
943943
"calling a function with ABI {} using caller ABI {}",
944944
exp_abi.name(),

src/machine.rs

+2-7
Original file line numberDiff line numberDiff line change
@@ -460,9 +460,6 @@ pub struct MiriMachine<'mir, 'tcx> {
460460
/// Whether to enforce the validity invariant.
461461
pub(crate) validate: bool,
462462

463-
/// Whether to enforce [ABI](Abi) of function calls.
464-
pub(crate) enforce_abi: bool,
465-
466463
/// The table of file descriptors.
467464
pub(crate) file_handler: shims::unix::FileHandler,
468465
/// The table of directory descriptors.
@@ -639,7 +636,6 @@ impl<'mir, 'tcx> MiriMachine<'mir, 'tcx> {
639636
tls: TlsData::default(),
640637
isolated_op: config.isolated_op,
641638
validate: config.validate,
642-
enforce_abi: config.check_abi,
643639
file_handler: FileHandler::new(config.mute_stdout_stderr),
644640
dir_handler: Default::default(),
645641
layouts,
@@ -781,7 +777,6 @@ impl VisitProvenance for MiriMachine<'_, '_> {
781777
tcx: _,
782778
isolated_op: _,
783779
validate: _,
784-
enforce_abi: _,
785780
clock: _,
786781
layouts: _,
787782
static_roots: _,
@@ -928,8 +923,8 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for MiriMachine<'mir, 'tcx> {
928923
}
929924

930925
#[inline(always)]
931-
fn enforce_abi(ecx: &MiriInterpCx<'mir, 'tcx>) -> bool {
932-
ecx.machine.enforce_abi
926+
fn enforce_abi(_ecx: &MiriInterpCx<'mir, 'tcx>) -> bool {
927+
true
933928
}
934929

935930
#[inline(always)]

tests/fail-dep/concurrency/unwind_top_of_stack.rs

-29
This file was deleted.

tests/fail-dep/concurrency/unwind_top_of_stack.stderr

-21
This file was deleted.

tests/fail/function_calls/arg_inplace_mutate.rs

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ fn main() {
1919
after_call = {
2020
Return()
2121
}
22-
2322
}
2423
}
2524

tests/fail/function_calls/exported_symbol_bad_unwind1.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
//@compile-flags: -Zmiri-disable-abi-check
21
#![feature(c_unwind)]
32

43
#[no_mangle]

tests/fail/function_calls/exported_symbol_bad_unwind1.stderr

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
WARNING: the flag `-Zmiri-disable-abi-check` is deprecated and planned to be removed.
2-
If you have a use-case for it, please file an issue.
31
thread 'main' panicked at $DIR/exported_symbol_bad_unwind1.rs:LL:CC:
42
explicit panic
53
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

tests/fail/panic/bad_miri_start_unwind.rs

-12
This file was deleted.

tests/fail/panic/bad_miri_start_unwind.stderr

-17
This file was deleted.

tests/fail/panic/bad_unwind.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#![feature(c_unwind)]
22

33
//! Unwinding when the caller ABI is "C" (without "-unwind") is UB.
4+
// The opposite version (callee does not allow unwinding) is impossible to
5+
// even write: MIR validation catches functions that have `UnwindContinue` but
6+
// are not allowed to unwind.
47

58
extern "C-unwind" fn unwind() {
69
panic!();

tests/pass/function_calls/disable_abi_check.rs

-24
This file was deleted.

tests/pass/function_calls/disable_abi_check.stderr

-2
This file was deleted.

0 commit comments

Comments
 (0)