Skip to content
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

remove deprecated options #2350

Merged
merged 1 commit into from
Jul 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -329,17 +329,6 @@ The remaining flags are for advanced use only, and more likely to change or be r
Some of these are **unsound**, which means they can lead
to Miri failing to detect cases of undefined behavior in a program.

* `-Zmiri-allow-uninit-numbers` disables the check to ensure that number types (integer and float
types) always hold initialized data. (They must still be initialized when any actual operation,
such as arithmetic, is performed.) Using this flag is **unsound** and
[deprecated](https://github.com/rust-lang/miri/issues/2187). This has no effect when
`-Zmiri-disable-validation` is present.
* `-Zmiri-allow-ptr-int-transmute` makes Miri more accepting of transmutation between pointers and
integers via `mem::transmute` or union/pointer type punning. This has two effects: it disables the
check against integers storing a pointer (i.e., data with provenance), thus allowing
pointer-to-integer transmutation, and it treats integer-to-pointer transmutation as equivalent to
a cast. Implies `-Zmiri-permissive-provenance`. Using this flag is **unsound** and
[deprecated](https://github.com/rust-lang/miri/issues/2188).
* `-Zmiri-disable-abi-check` disables checking [function ABI]. Using this flag
is **unsound**.
* `-Zmiri-disable-alignment-check` disables checking pointer alignment, so you
Expand Down
14 changes: 0 additions & 14 deletions src/bin/miri.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,19 +328,6 @@ fn main() {
"WARNING: the flag `-Zmiri-check-number-validity` no longer has any effect \
since it is now enabled by default"
);
} else if arg == "-Zmiri-allow-uninit-numbers" {
eprintln!(
"WARNING: `-Zmiri-allow-uninit-numbers` is deprecated and planned to be removed. \
Please let us know at <https://github.com/rust-lang/miri/issues/2187> if you rely on this flag."
);
miri_config.allow_uninit_numbers = true;
} else if arg == "-Zmiri-allow-ptr-int-transmute" {
eprintln!(
"WARNING: `-Zmiri-allow-ptr-int-transmute` is deprecated and planned to be removed. \
Please let us know at <https://github.com/rust-lang/miri/issues/2188> if you rely on this flag."
);
miri_config.allow_ptr_int_transmute = true;
miri_config.provenance_mode = ProvenanceMode::Permissive;
} else if arg == "-Zmiri-disable-abi-check" {
miri_config.check_abi = false;
} else if arg == "-Zmiri-disable-isolation" {
Expand Down Expand Up @@ -378,7 +365,6 @@ fn main() {
eprintln!("WARNING: `-Zmiri-tag-raw-pointers` has no effect; it is enabled by default");
} else if arg == "-Zmiri-strict-provenance" {
miri_config.provenance_mode = ProvenanceMode::Strict;
miri_config.allow_ptr_int_transmute = false;
} else if arg == "-Zmiri-permissive-provenance" {
miri_config.provenance_mode = ProvenanceMode::Permissive;
} else if arg == "-Zmiri-mute-stdout-stderr" {
Expand Down
6 changes: 0 additions & 6 deletions src/eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@ pub struct MiriConfig {
pub stacked_borrows: bool,
/// Controls alignment checking.
pub check_alignment: AlignmentCheck,
/// Controls integer and float validity initialization checking.
pub allow_uninit_numbers: bool,
/// Controls how we treat ptr2int and int2ptr transmutes.
pub allow_ptr_int_transmute: bool,
/// Controls function [ABI](Abi) checking.
pub check_abi: bool,
/// Action for an op requiring communication with the host.
Expand Down Expand Up @@ -134,8 +130,6 @@ impl Default for MiriConfig {
validate: true,
stacked_borrows: true,
check_alignment: AlignmentCheck::Int,
allow_uninit_numbers: false,
allow_ptr_int_transmute: false,
check_abi: true,
isolated_op: IsolatedOp::Reject(RejectOpWith::Abort),
ignore_leaks: false,
Expand Down
12 changes: 3 additions & 9 deletions src/intptrcast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,19 +107,13 @@ impl<'mir, 'tcx> GlobalStateInner {
}

pub fn ptr_from_addr_transmute(
ecx: &MiriEvalContext<'mir, 'tcx>,
_ecx: &MiriEvalContext<'mir, 'tcx>,
addr: u64,
) -> Pointer<Option<Tag>> {
trace!("Transmuting {:#x} to a pointer", addr);

let provenance = if ecx.machine.allow_ptr_int_transmute {
// When we allow transmutes, treat them like casts: generating a wildcard pointer.
Some(Tag::Wildcard)
} else {
// Usually, we consider transmuted pointers to be "invalid" (`None` provenance).
None
};
Pointer::new(provenance, Size::from_bytes(addr))
// We consider transmuted pointers to be "invalid" (`None` provenance).
Pointer::new(None, Size::from_bytes(addr))
}

pub fn ptr_from_addr_cast(
Expand Down
17 changes: 4 additions & 13 deletions src/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,13 +260,6 @@ pub struct Evaluator<'mir, 'tcx> {
/// Whether to enforce the validity invariant.
pub(crate) validate: bool,

/// Whether to allow uninitialized numbers (integers and floats).
pub(crate) allow_uninit_numbers: bool,

/// Whether to allow ptr2int transmutes, and whether to allow *dereferencing* the result of an
/// int2ptr transmute.
pub(crate) allow_ptr_int_transmute: bool,

/// Whether to enforce [ABI](Abi) of function calls.
pub(crate) enforce_abi: bool,

Expand Down Expand Up @@ -373,8 +366,6 @@ impl<'mir, 'tcx> Evaluator<'mir, 'tcx> {
tls: TlsData::default(),
isolated_op: config.isolated_op,
validate: config.validate,
allow_uninit_numbers: config.allow_uninit_numbers,
allow_ptr_int_transmute: config.allow_ptr_int_transmute,
enforce_abi: config.check_abi,
file_handler: FileHandler::new(config.mute_stdout_stderr),
dir_handler: Default::default(),
Expand Down Expand Up @@ -527,13 +518,13 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'mir, 'tcx> {
}

#[inline(always)]
fn enforce_number_init(ecx: &MiriEvalContext<'mir, 'tcx>) -> bool {
!ecx.machine.allow_uninit_numbers
fn enforce_number_init(_ecx: &MiriEvalContext<'mir, 'tcx>) -> bool {
true
}

#[inline(always)]
fn enforce_number_no_provenance(ecx: &MiriEvalContext<'mir, 'tcx>) -> bool {
!ecx.machine.allow_ptr_int_transmute
fn enforce_number_no_provenance(_ecx: &MiriEvalContext<'mir, 'tcx>) -> bool {
true
}

#[inline(always)]
Expand Down
Loading