about summary refs log tree commit diff
path: root/src/tools/miri/tests
AgeCommit message (Collapse)AuthorLines
2024-09-21fmt (with a huge diff for some reason)Ralf Jung-68/+68
2024-09-21Merge from rustcRalf Jung-4/+40
2024-09-20Auto merge of #124895 - obeis:static-mut-hidden-ref, r=compiler-errorsbors-0/+35
Disallow hidden references to mutable static Closes #123060 Tracking: - https://github.com/rust-lang/rust/issues/123758
2024-09-20miri: An error message got changedJubilee Young-2/+2
2024-09-19Make the intention of the miri test more clearAdwin White-4/+5
2024-09-19Adapt test to new layoutAdwin White-2/+2
2024-09-17Use `@only-target` in SSE and SSE2 tests tooEduardo Sánchez Muñoz-1784/+1760
It looks cleaner and makes it consistent with other X86 tests
2024-09-17ptr_offset_unsigned_overflow: extend testRalf Jung-5/+6
2024-09-17Auto merge of #3891 - tiif:tokiotest, r=RalfJungbors-0/+38
Fix tokio test ICE Fixes #3858 It turned out that the issue mentioned [here](https://github.com/rust-lang/miri/issues/3858#issuecomment-2336726299) is the exact cause of ICE. So in this PR, I changed the type of ``EpollEventInterest::epfd`` from ``i32`` to ``WeakFileDescriptionRef``.
2024-09-17Tokio ICE fix: Changed the type of EpollEventInterest::epfd from i32 to ↵tiif-0/+38
WeakFileDescriptionRef
2024-09-16Fix run --depOli Scherer-0/+1
2024-09-16Refator DependencyBuilder constructionOli Scherer-14/+15
2024-09-16Bump ui testOli Scherer-1937/+1855
2024-09-15test std::time APIs on FreeBSD and SolarishRalf Jung-3/+3
2024-09-15make pthread-threadname nicer with cfg-ifRalf Jung-18/+37
2024-09-15move two tests to a better locationRalf Jung-0/+0
2024-09-15pthread: add FreeBSD, remove PTHREAD_MUTEX_NORMAL_FLAG hackRalf Jung-1/+2
On FreeBSD, DEFAULT maps to ERRORCK. This clashes with the existing PTHREAD_MUTEX_NORMAL_FLAG: hack so we replace it by a different hack that works better cross-platform. Also fix a case of "accidental early UB" in a UB test -- pthread_mutexattr_t must be initialized.
2024-09-14Auto merge of #3884 - Mandragorian:detect_cond_move, r=RalfJungbors-0/+77
detect when pthread_cond_t is moved Closes #3749
2024-09-14detect when pthread_cond_t is movedKonstantinos Andrikopoulos-0/+77
Closes #3749
2024-09-14Merge from rustcThe Miri Cronjob Bot-156/+65
2024-09-13Update tests for hidden references to mutable staticObei Sideg-0/+35
2024-09-13Rollup merge of #130245 - RalfJung:miri-alloc-backtrace, r=AmanieuStuart Cook-156/+65
make basic allocation functions track_caller in Miri for nicer backtraces This matches what we did with basic pointer and atomic operations.
2024-09-12Remove an unused piece of logicOli Scherer-4/+1
2024-09-16fmtThe Miri Cronjob Bot-2/+2
2024-09-16Merge from rustcThe Miri Cronjob Bot-7/+237
2024-09-15Rollup merge of #130342 - RalfJung:slice-idx-overflow, r=saethlinMatthias Krüger-1/+12
interpret, miri: fix dealing with overflow during slice indexing and allocation This is mostly to fix https://github.com/rust-lang/rust/issues/130284. I then realized we're using somewhat sketchy arguments for a similar multiplication in `copy`/`copy_nonoverlapping`/`write_bytes`, so I made them all share the same function that checks exactly the right thing. (The intrinsics would previously fail on allocations larger than `1 << 47` bytes... which are theoretically possible maybe? Anyway it seems conceptually wrong to use any other bound than `isize::MAX` here.)
2024-09-15Rollup merge of #129828 - RalfJung:miri-data-race, r=saethlinMatthias Krüger-1/+225
miri: treat non-memory local variables properly for data race detection Fixes https://github.com/rust-lang/miri/issues/3242 Miri has an optimization where some local variables are not represented in memory until something forces them to be stored in memory (most notably, creating a pointer/reference to the local will do that). However, for a subsystem triggering on memory accesses -- such as the data race detector -- this means that the memory access seems to happen only when the local is moved to memory, instead of at the time that it actually happens. This can lead to UB reports in programs that do not actually have UB. This PR fixes that by adding machine hooks for reads and writes to such efficiently represented local variables. The data race system tracks those very similar to how it would track reads and writes to addressable memory, and when a local is moved to memory, the clocks get overwritten with the information stored for the local.
2024-09-15also use compute_size_in_bytes for relevant multiplications in MiriRalf Jung-1/+12
2024-09-14simd_shuffle: require index argument to be a vectorRalf Jung-5/+0
2024-09-12Merge from rustcThe Miri Cronjob Bot-0/+30
2024-09-11Rollup merge of #130239 - RalfJung:miri-ptr-offset-unsigned, r=compiler-errorsJubilee-0/+22
miri: fix overflow detection for unsigned pointer offset This is the Miri part of https://github.com/rust-lang/rust/pull/130229. This is already UB in codegen so we better make Miri detect it; updating the docs may take time if we have to follow some approval process, but let's make Miri match reality ASAP. r? ``@scottmcm``
2024-09-11make basic allocation functions track_caller in Miri for nicer backtracesRalf Jung-156/+65
2024-09-11miri: fix overflow detection for unsigned pointer offsetRalf Jung-0/+22
2024-09-11miri: support vector index arguments in simd_shuffleRalf Jung-0/+8
2024-09-11Merge from rustcThe Miri Cronjob Bot-30/+30
2024-09-10Auto merge of #129403 - scottmcm:only-array-simd, r=compiler-errorsbors-30/+30
Ban non-array SIMD Nearing the end of https://github.com/rust-lang/compiler-team/issues/621 ! Currently blocked on ~~https://github.com/rust-lang/compiler-builtins/pull/673~~ ~~https://github.com/rust-lang/compiler-builtins/pull/674~~ ~~https://github.com/rust-lang/rust/pull/129400~~ ~~https://github.com/rust-lang/rust/pull/129481~~ for windows.
2024-09-10miri: treat non-memory local variables properly for data race detectionRalf Jung-1/+225
2024-09-10fmtRalf Jung-48/+62
2024-09-10Merge from rustcRalf Jung-5/+547
2024-09-09Update the MIRI testsScott McMurray-30/+30
2024-09-10Auto merge of #129778 - RalfJung:interp-lossy-typed-copy, r=saethlinbors-5/+481
interpret: make typed copies lossy wrt provenance and padding A "typed copy" in Rust can be a lossy process: when copying at type `usize` (or any other non-pointer type), if the original memory had any provenance, that provenance is lost. When copying at pointer type, if the original memory had partial provenance (i.e., not the same provenance for all bytes), that provenance is lost. When copying any type with padding, the contents of padding are lost. This PR equips our validity-checking pass with the ability to reset provenance and padding according to those rules. Can be reviewed commit-by-commit. The first three commits are just preparation without any functional change. Fixes https://github.com/rust-lang/miri/issues/845 Fixes https://github.com/rust-lang/miri/issues/2182
2024-09-09fix UB in a testRalf Jung-2/+35
also add an explicit test for the fact that a Option<WidePtr> has padding when it is None
2024-09-09union padding computation: add fast-path for ZSTRalf Jung-0/+15
Also avoid even tracking empty ranges, and add fast-path for arrays of scalars
2024-09-09Rollup merge of #130130 - RalfJung:miri-sync, r=RalfJungJubilee-50/+142
Miri subtree update r? `@ghost`
2024-09-09detect when pthread_rwlock_t is movedKonstantinos Andrikopoulos-0/+29
For some implementations of pthreads, the address of pthread_rwlock_t (or its fields) is used to identify the lock. That means that if the contents of a pthread_rwlock_t are moved in memory, effectively a new lock object is created, which is completely independted from the original. Thus we want to detect when when such objects are moved and show an error.
2024-09-08interpret: reset padding during validationRalf Jung-15/+236
2024-09-08interpret: reset provenance on typed copiesRalf Jung-0/+207
2024-09-08Auto merge of #129313 - RalfJung:coroutine-niches, r=compiler-errorsbors-0/+66
Supress niches in coroutines to avoid aliasing violations As mentioned [here](https://github.com/rust-lang/rust/issues/63818#issuecomment-2264915918), using niches in fields of coroutines that are referenced by other fields is unsound: the discriminant accesses violate the aliasing requirements of the reference pointing to the relevant field. This issue causes [Miri errors in practice](https://github.com/rust-lang/miri/issues/3780). The "obvious" fix for this is to suppress niches in coroutines. That's what this PR does. However, we have several tests explicitly ensuring that we *do* use niches in coroutines. So I see two options: - We guard this behavior behind a `-Z` flag (that Miri will set by default). There is no known case of these aliasing violations causing miscompilations. But absence of evidence is not evidence of absence... - (What this PR does right now.) We temporarily adjust the coroutine layout logic and the associated tests until the proper fix lands. The "proper fix" here is to wrap fields that other fields can point to in [`UnsafePinned`](https://github.com/rust-lang/rust/issues/125735) and make `UnsafePinned` suppress niches; that would then still permit using niches of *other* fields (those that never get borrowed). However, I know that coroutine sizes are already a problem, so I am not sure if this temporary size regression is acceptable. `@compiler-errors` any opinion? Also who else should be Cc'd here?
2024-09-06Merge from rustcThe Miri Cronjob Bot-1/+1
2024-09-05Auto merge of #3784 - Mandragorian:detect_moved_mutexes, r=RalfJungbors-0/+68
Detect when pthread_mutex_t is moved What I am not sure about this PR is how to support storing the additional mutex data like its address and kind. If I understand correctly the `concurrency::sync::Mutex` struct is to be used by any mutex implementation. This possibly means that different implementation might want to store different data in the mutex. So any additional data should be implementation defined somehow. Solutions that come to mind: - Store the additional data as `Box<dyn Any>` and the implementations can downcast their data when they fetch them. - Have each shim implementation define a `static mut` map between `MutexID`s and the additional data. Let me know Fixes #3749