]> git.lizzy.rs Git - rust.git/blobdiff - README.md
Auto merge of #2402 - RalfJung:cargo-target, r=RalfJung
[rust.git] / README.md
index a7ee11e82e0f032ebcfcdcefd24e2471270fa4f1..d1dde153c47870457fbd5cc9b015ce1c2bbf3d29 100644 (file)
--- a/README.md
+++ b/README.md
@@ -65,9 +65,9 @@ in your program, and cannot run all programs:
   not support networking. System API support varies between targets; if you run
   on Windows it is a good idea to use `--target x86_64-unknown-linux-gnu` to get
   better support.
-* Weak memory emulation may produce weak behaivours unobservable by compiled
-  programs running on real hardware when `SeqCst` fences are used, and it cannot
-  produce all behaviors possibly observable on real hardware.
+* Weak memory emulation may [produce weak behaviours](https://github.com/rust-lang/miri/issues/2301)
+  unobservable by compiled programs running on real hardware when `SeqCst` fences are used, and it
+  cannot produce all behaviors possibly observable on real hardware.
 
 [rust]: https://www.rust-lang.org/
 [mir]: https://github.com/rust-lang/rfcs/blob/master/text/1211-mir.md
@@ -192,8 +192,9 @@ randomness that is used to determine allocation base addresses. The following
 snippet calls Miri in a loop with different values for the seed:
 
 ```
-for seed in $({ echo obase=16; seq 0 255; } | bc); do
-  MIRIFLAGS=-Zmiri-seed=$seed cargo miri test || { echo "Last seed: $seed"; break; };
+for SEED in $({ echo obase=16; seq 0 255; } | bc); do
+  echo "Trying seed: $SEED"
+  MIRIFLAGS=-Zmiri-seed=$SEED cargo miri test || { echo "Failing seed: $SEED"; break; };
 done
 ```
 
@@ -285,8 +286,9 @@ environment variable. We first document the most relevant and most commonly used
   harness](https://github.com/rust-lang/miri/issues/1702). This has no effect unless
   `-Zmiri-disable-isolation` is also set.
 * `-Zmiri-env-forward=<var>` forwards the `var` environment variable to the interpreted program. Can
-  be used multiple times to forward several variables. This has no effect if
-  `-Zmiri-disable-isolation` is set.
+  be used multiple times to forward several variables. This takes precedence over
+  `-Zmiri-env-exclude`: if a variable is both forwarded and exluced, it *will* get forwarded. This
+  means in particular `-Zmiri-env-forward=TERM` overwrites the default exclusion of `TERM`.
 * `-Zmiri-ignore-leaks` disables the memory leak checker, and also allows some
   remaining threads to exist when the main thread exits.
 * `-Zmiri-permissive-provenance` disables the warning for integer-to-pointer casts and
@@ -327,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
@@ -369,6 +360,9 @@ to Miri failing to detect cases of undefined behavior in a program.
   application instead of raising an error within the context of Miri (and halting
   execution). Note that code might not expect these operations to ever panic, so
   this flag can lead to strange (mis)behavior.
+* `-Zmiri-retag-fields` changes Stacked Borrows retagging to recurse into fields.
+  This means that references in fields of structs/enums/tuples/arrays/... are retagged,
+  and in particular, they are protected when passed as function arguments.
 * `-Zmiri-track-alloc-id=<id1>,<id2>,...` shows a backtrace when the given allocations are
   being allocated or freed.  This helps in debugging memory leaks and
   use after free bugs. Specifying this argument multiple times does not overwrite the previous
@@ -378,8 +372,8 @@ to Miri failing to detect cases of undefined behavior in a program.
   Borrows "protectors". Specifying this argument multiple times does not overwrite the previous
   values, instead it appends its values to the list. Listing an id multiple times has no effect.
 * `-Zmiri-track-pointer-tag=<tag1>,<tag2>,...` shows a backtrace when a given pointer tag
-  is popped from a borrow stack (which is where the tag becomes invalid and any
-  future use of it will error).  This helps you in finding out why UB is
+  is created and when (if ever) it is popped from a borrow stack (which is where the tag becomes invalid 
+  and any future use of it will error).  This helps you in finding out why UB is
   happening and where in your code would be a good place to look for it.
   Specifying this argument multiple times does not overwrite the previous
   values, instead it appends its values to the list. Listing a tag multiple times has no effect.
@@ -413,9 +407,11 @@ Moreover, Miri recognizes some environment variables:
   sysroot to use. Only set this if you do not want to use the automatically
   created sysroot. (The `miri` driver sysroot is controlled via the `--sysroot`
   flag instead.)
-* `MIRI_TEST_TARGET` (recognized by the test suite) indicates which target
-  architecture to test against.  `miri` and `cargo miri` accept the `--target`
-  flag for the same purpose.
+* `MIRI_TEST_TARGET` (recognized by the test suite and the `./miri` script) indicates which target
+  architecture to test against.  `miri` and `cargo miri` accept the `--target` flag for the same
+  purpose.
+* `MIRI_NO_STD` (recognized by `cargo miri` and the test suite) makes sure that the target's
+  sysroot is built without libstd. This allows testing and running no_std programs.
 * `MIRI_BLESS` (recognized by the test suite) overwrite all `stderr` and `stdout` files
   instead of checking whether the output matches.
 * `MIRI_SKIP_UI_CHECKS` (recognized by the test suite) don't check whether the
@@ -574,6 +570,8 @@ Definite bugs found:
 * [`integer-encoding` dereferencing a misaligned pointer](https://github.com/dermesser/integer-encoding-rs/pull/23)
 * [`rkyv` constructing a `Box<[u8]>` from an overaligned allocation](https://github.com/rkyv/rkyv/commit/a9417193a34757e12e24263178be8b2eebb72456)
 * [Data race in `thread::scope`](https://github.com/rust-lang/rust/issues/98498)
+* [`regex` incorrectly handling unaligned `Vec<u8>` buffers](https://www.reddit.com/r/rust/comments/vq3mmu/comment/ienc7t0?context=3)
+* [Incorrect use of `compare_exchange_weak` in `once_cell`](https://github.com/matklad/once_cell/issues/186)
 
 Violations of [Stacked Borrows] found that are likely bugs (but Stacked Borrows is currently just an experiment):