Commit Graph

5838 Commits

Author SHA1 Message Date
bors
2170d7a7c9 Auto merge of #1949 - RalfJung:miri-lib-src, r=oli-obk
add and document MIRI_LIB_SRC env var to set the source from which Miri builds the standard library

This is just an alias of `XARGO_RUST_SRC`, but avoids exposing how exactly we use xargo.
2021-12-23 15:54:25 +00:00
Ralf Jung
e51810df2c add and document MIRI_LIB_SRC env var to set the source from which Miri builds the standard library 2021-12-23 16:04:09 +01:00
bors
6f3061b18e Auto merge of #1945 - saethlin:better-sb-tracking, r=RalfJung
Provide slightly better notes when tracking a pointer tag

I slapped this in as a sort of advanced println-based debugging when trying to figure out a track-raw-pointers finding in `smallvec`. Perhaps this looks like a good idea to you all?

EDIT: User scenario

Run `MIRIFLAGS=-Ztag-raw-pointers cargo miri test`, get a diagnostic that looks like
```
error: Undefined Behavior: trying to reborrow for SharedReadOnly at alloc99465+0x9, but parent tag <265507> does not have an appropriate item in the borrow stack
```
So now run `MIRIFLAGS=-Ztag-raw-pointers -Zmiri-track-pointer-tag=265507 cargo miri test`
Old:
```
note: tracking was triggered
   --> src/lib.rs:822:36
    |
822 |                 vec: NonNull::from(self),
    |                                    ^^^^ popped tracked tag for item [SharedReadOnly for <265507>]
```
New:
```
note: tracking was triggered
   --> src/lib.rs:822:36
    |
822 |                 vec: NonNull::from(self),
    |                                    ^^^^ popped tracked tag for item [SharedReadOnly for <265507>] due to Write access for <265356>
```
So that if a user is now beginning to question their sanity because they don't really understand SB yet, they can then track the tag which caused the parent tag to be removed from the stack to be sure what's going on here:
```
   --> src/lib.rs:792:5
    |
792 | /     pub fn drain<R>(&mut self, range: R) -> Drain<'_, A>
793 | |     where
794 | |         R: RangeBounds<usize>,
795 | |     {
...   |
824 | |         }
825 | |     }
    | |_____^ created tag 265356
```

The existing diagnostic can tell you where the tag you'd need was invalidated, but it cannot tell you what and why that tag was invalidated.
2021-12-21 21:25:52 +00:00
Ben Kimock
cd6921923c Provide better notes when tracking a pointer tag 2021-12-21 12:15:29 -05:00
bors
e969615937 Auto merge of #1947 - RalfJung:macos-is-from-the-stone-age, r=RalfJung
macOS-compatible realpath

Make behavior consistent between Linux and macOS even though macOS lacks some basic shell tools
2021-12-20 22:17:40 +00:00
Ralf Jung
a9dd9b9571 macOS-compatible realpath 2021-12-20 23:14:17 +01:00
bors
cac6759451 Auto merge of #1944 - RalfJung:rustup, r=RalfJung
rustup
2021-12-19 18:49:41 +00:00
Ralf Jung
c0f1670e47 rustup 2021-12-19 19:49:05 +01:00
bors
812fd79e63 Auto merge of #1943 - RalfJung:readme, r=RalfJung
readme: be more explicit about the toolchain

Fixes https://github.com/rust-lang/miri/issues/1942

`@robamler` would this have helped?
2021-12-19 16:53:37 +00:00
Ralf Jung
db74c1c030 readme: be more explicit about the toolchain 2021-12-19 17:46:17 +01:00
bors
237390785d Auto merge of #1940 - RalfJung:xargo, r=RalfJung
require xargo 0.3.23

Fixes https://github.com/rust-lang/miri/issues/1939
2021-12-16 14:23:08 +00:00
Ralf Jung
b44f7ea079 require xargo 0.3.23 2021-12-16 15:20:58 +01:00
bors
2eb3b37c91 Auto merge of #1938 - RalfJung:test, r=RalfJung
add regression test

Adds a regression test for https://github.com/rust-lang/rust/issues/91636 (which was fixed by https://github.com/rust-lang/rust/pull/91856)
2021-12-15 18:11:57 +00:00
Ralf Jung
4da38299fa looks like the asm macro is stable :D 2021-12-15 19:11:18 +01:00
Ralf Jung
d8f7b831e7 add regression test 2021-12-15 19:11:08 +01:00
bors
65cbcb0d05 Auto merge of #1937 - RalfJung:rustup, r=RalfJung
rustup

I cannot reproduce the [nightly CI failure](https://github.com/rust-lang/miri/runs/4521890481?check_suite_focus=true) so let's see what happens...
2021-12-15 16:10:43 +00:00
Ralf Jung
44cad75069 fix iteration-order-dependent output 2021-12-15 16:51:40 +01:00
Ralf Jung
6dcb5389cd update lockfile 2021-12-14 18:20:03 +01:00
Ralf Jung
7670a5657a rustup 2021-12-14 18:14:17 +01:00
bors
dadcbebfbd Auto merge of #1934 - RalfJung:rustup, r=RalfJung
rustup

Cc https://github.com/rust-lang/rust/issues/91649
2021-12-08 15:19:55 +00:00
Ralf Jung
50b9b701ab rustup 2021-12-08 10:01:51 -05:00
bors
23a9d02748 Auto merge of #1933 - 5225225:1931-condvar-false-positive, r=RalfJung
Fix false positive use of uninit bytes when calling `libc::pthread_condattr_destroy`

Fixes: #1931
2021-12-08 14:51:53 +00:00
5225225
fd830e7b27
Code comment changes from code review
Co-authored-by: Ralf Jung <post@ralfj.de>
2021-12-07 17:25:28 +00:00
5225225
250d450593 Add comment explaining false positives in _destroy 2021-12-07 17:24:29 +00:00
5225225
a4b2fc0c5a Adjust pthread tests 2021-12-06 21:50:14 +00:00
5225225
f0d915703c Add tests for double destroying various pthread items 2021-12-06 21:15:02 +00:00
5225225
ae120563cc Destroying any uninit posix_ object is UB 2021-12-06 19:26:13 +00:00
bors
81e59e6b92 Auto merge of #1930 - tavianator:avoid-adjacent-allocations, r=RalfJung
intptrcast: Never allocate two objects directly adjecent

When two objects directly follow each other in memory, what is the
provenance of an integer cast to a pointer that points directly between
them?  For a zero-size region, it could point into the end of the first
object, or the start of the second.

We can avoid answering this difficult question by simply never
allocating two objects directly beside each other.  This fixes some of
the false positives from #1866.
2021-12-06 01:33:55 +00:00
Ralf Jung
6a98c64c8b
final tweaks 2021-12-05 20:33:20 -05:00
5225225
eadeedde42 Handle uninit data in pthread_condattr_destroy 2021-12-05 19:47:29 +00:00
bors
4eadf666d3 Auto merge of #1932 - RalfJung:rustup, r=RalfJung
rustup

Cc https://github.com/rust-lang/rust/issues/91542
2021-12-05 16:03:07 +00:00
Ralf Jung
d537ed401d rustup 2021-12-05 11:02:20 -05:00
Tavian Barnes
b0a463334c intptrcast: Never allocate two objects directly adjecent
When two objects directly follow each other in memory, what is the
provenance of an integer cast to a pointer that points directly between
them?  For a zero-size region, it could point into the end of the first
object, or the start of the second.

We can avoid answering this difficult question by simply never
allocating two objects directly beside each other.  This fixes some of
the false positives from #1866.
2021-12-03 17:00:06 -05:00
bors
5e9cf62b89 Auto merge of #1929 - RalfJung:rustup, r=RalfJung
rustup

With https://github.com/rust-lang/rust/pull/91323 landed, we can remove these intrinsics from Miri.
2021-11-30 16:45:05 +00:00
Ralf Jung
70dd979a44 rustup 2021-11-30 11:44:19 -05:00
bors
9983e0fc63 Auto merge of #1927 - RalfJung:array-align-tests, r=RalfJung
add tests for alignment on array initialization

This adds regression tests for https://github.com/rust-lang/miri/issues/1925, https://github.com/rust-lang/miri/issues/1919.
2021-11-28 15:28:57 +00:00
Ralf Jung
ee666d8987 add tests for alignment on array initialization 2021-11-28 10:07:31 -05:00
bors
e62924e37d Auto merge of #1926 - RalfJung:rustup, r=RalfJung
rustup; stub support for some extern statics used for weak symbols
2021-11-27 22:53:32 +00:00
Ralf Jung
d800d1e2cb rustup; stub support for some extern statics used for weak symbols 2021-11-27 17:15:54 -05:00
bors
0949cd36c3 Auto merge of #1924 - RalfJung:ra, r=oli-obk
hack to work around RA quirk

This is a gross hack to work around https://github.com/rust-analyzer/rust-analyzer/issues/10793: calling `cargo-miri/miri` does the same thing as calling `./miri`.

`@oli-obk` this is the best I could come up with... not sure if we want to have this in the repo. I am also okay with carrying `cargo-miri/miri` locally.
2021-11-25 22:55:43 +00:00
Ralf Jung
5d71528e4d hack to work around RA quirk 2021-11-25 17:37:36 -05:00
bors
73cf2ba0c0 Auto merge of #1923 - RalfJung:more-simd, r=RalfJung
More portable SIMD: rem, shl, shr

Also make sure we catch the potential UB in div, rem, shl, shr.
2021-11-25 22:30:42 +00:00
Ralf Jung
4414d96323 implement shl and shr SIMD intrinsics 2021-11-25 17:26:37 -05:00
Ralf Jung
a534bbbf8a portable SIMD: add rem intrinsic; test div and rem intrinsic UB 2021-11-25 17:13:33 -05:00
bors
4f0faed6d2 Auto merge of #1922 - RalfJung:async-run-fut, r=RalfJung
async-fn test: make run_fut more general and entirely safe
2021-11-23 19:44:55 +00:00
Ralf Jung
c4502cbbe8 async-fn test: make run_fut more general and entirely safe 2021-11-23 14:33:00 -05:00
bors
2cd6fe88d8 Auto merge of #1921 - RalfJung:overflow-checks-off, r=RalfJung
test for overflow-checks=off

Strangely, if we call the functions in `std::ops`, we still get the panics. I assume that is because we build the stdlib with `-Cdebug-assertions=on`; probably the magic attribute that makes stdlib functions inherit overflow checks from the calling crate only works one way (namely to enable them when the calling crate asks for them, but not to disable them when the calling crate does not want them).
2021-11-23 19:08:06 +00:00
Ralf Jung
7dd1f0571c test for overflow-checks=off 2021-11-23 14:07:46 -05:00
bors
763a4455ac Auto merge of #1918 - RalfJung:simd_basics, r=RalfJung
portable SIMD: basic binops

First steps towards https://github.com/rust-lang/miri/issues/1912. Requires https://github.com/rust-lang/rust/pull/90999.
2021-11-21 03:40:28 +00:00
Ralf Jung
84027dcd22 rustup 2021-11-20 22:39:22 -05:00