about summary refs log tree commit diff
path: root/src/tools/miri/tests
AgeCommit message (Collapse)AuthorLines
2025-02-21Resolve some FIXME from socketpair testtiif-6/+2
2025-02-20Add explanation commentJakub Beránek-0/+1
Co-authored-by: Ralf Jung <post@ralfj.de>
2025-02-20Remove GitHub job summariesJakub Beránek-9/+4
They don't seem to be used by miri contributors, and they pollute job summaries in rust-lang/rust.
2025-02-20Rollup merge of #135296 - lukas-code:dyn-leak-check, r=compiler-errorsMatthias Krüger-0/+75
interpret: adjust vtable validity check for higher-ranked types ## What Transmuting between trait objects where a generic argument or associated type only differs in bound regions (not bound at or above the trait object's binder) is now UB. For example * transmuting between `&dyn Trait<for<'a> fn(&'a u8)>` and `&dyn Trait<fn(&'static u8)>` is UB. * transmuting between `&dyn Trait<Assoc = for<'a> fn(&'a u8)>` and `&dyn Trait<Assoc = fn(&'static u8)>` is UB. * transmuting between `&dyn Trait<for<'a> fn(&'a u8) -> (&'a u8, &'static u8)>` and `&dyn Trait<for<'a> fn(&'a u8) -> (&'static u8, &'a u8)>` is UB. Transmuting between subtypes (in either direction) is still allowed, which means that bound regions that are bound at or above the trait object's binder can still be changed: * transmuting between `&dyn for<'a> Trait<fn(&'a u8)>` and `&dyn for Trait<fn(&'static u8)>` is fine. * transmuting between `&dyn for<'a> Trait<dyn Trait<fn(&'a u8)>>` and `&dyn for Trait<dyn Trait<fn(&'static u8)>>` is fine. ## Why Very similar to https://github.com/rust-lang/rust/issues/120217 and https://github.com/rust-lang/rust/issues/120222, changing a trait object's generic argument to a type that only differs in bound regions can still affect the vtable layout and lead to segfaults at runtime (for an example see `src/tools/miri/tests/fail/validity/dyn-transmute-inner-binder.rs`). Since we already already require that the trait object predicates must be equal modulo bound regions, it is only natural to extend this check to also require type equality considering bound regions. However, it also makes sense to allow transmutes between a type and a subtype thereof. For example `&dyn for<'a> Trait<&'a u8>` is a subtype of `&dyn Trait<&'static ()>` and they are guaranteed to have the same vtable, so it makes sense to allow this transmute. So that's why bound lifetimes that are bound to the trait object itself are treated as free lifetime for the purpose of this check. Note that codegen already relies on the property that subtyping cannot change the the vtable and this is asserted here (note the leak check): https://github.com/rust-lang/rust/blob/251206c27b619ccf3a08e2ac4c525dc343f08492/compiler/rustc_codegen_ssa/src/base.rs#L106-L153 Furthermore, we allow some pointer-to-pointer casts like `*const dyn for<'a> Trait<&'a u8>` to `*const Wrapper<dyn Trait<&'static u8>>` that instantiate the trait object binder and are currently lowered to a single pointer-to-pointer cast in MIR (`CastKind::PtrToPtr`) and *not* an unsizing coercion (`CastKind::PointerCoercion(Unsize)`), so the current MIR lowering of these would be UB if we didn't allow subtyping transmutes. --- fixes https://github.com/rust-lang/rust/issues/135230 cc `@rust-lang/opsem` r? `@compiler-errors` for the implementation
2025-02-19Merge from rustcThe Miri Cronjob Bot-0/+2
2025-02-18Rollup merge of #136750 - kornelski:ub-bug, r=saethlinUrgau-0/+2
Make ub_check message clear that it's not an assert I've seen a user assume that their unsound code was *safe*, because ub_check prevented the program from performing the unsafe operation. This PR makes the panic message clearer that ub_check is a bug detector, not run-time safety protection.
2025-02-17Merge from rustcThe Miri Cronjob Bot-4/+4
2025-02-17stabilize (const_)ptr_sub_ptrbendn-3/+0
2025-02-16add erf and erfc to nondet tests, and reduce how much we're changing the ↵Ralf Jung-111/+27
float test
2025-02-16apply random float error to most floating-point operationsLorrensP-2158466-56/+267
2025-02-16Rollup merge of #136986 - ehuss:library-unsafe-fun, r=NoratriebMatthias Krüger-4/+4
Apply unsafe_op_in_unsafe_fn to the standard library This applies unsafe_op_in_unsafe_fn to the standard library in preparation for updating to Rust 2024. Closes https://github.com/rust-lang/rust/issues/127747 (I think?) cc ``@workingjubilee`` I have been testing a variety of targets, and I feel like they are all pretty much covered. I'll continue doing some testing async, but I don't expect to catch any more.
2025-02-16Merge from rustcRalf Jung-0/+6
2025-02-16Make ub_check message clear that it's not an assertKornel-0/+2
2025-02-15Merge from rustcThe Miri Cronjob Bot-0/+5
2025-02-15Auto merge of #136324 - GrigorenkoPV:erf, r=tgross35bors-0/+6
Implement `f{16,32,64,128}::{erf,erfc}` (`#![feature(float_erf)]`) Tracking issue: #136321 try-job: x86_64-gnu-aux
2025-02-14add x86-sse2 (32bit) ABI that requires SSE2 target featureRalf Jung-0/+5
2025-02-14miri: shims for `erf` & friendsPavel Grigorenko-0/+6
2025-02-14Bless miri tests after applying unsafe_op_in_unsafe_fnEric Huss-4/+4
2025-02-13Merge from rustcThe Miri Cronjob Bot-0/+46
2025-02-12Change swap_nonoverlapping from lang to library UBBen Kimock-0/+46
2025-02-11Merge from rustcThe Miri Cronjob Bot-21/+0
2025-02-10Auto merge of #135701 - calebzulawski:sync-from-portable-simd-2025-01-18, ↵bors-21/+0
r=workingjubilee Portable SIMD subtree update r? `@workingjubilee`
2025-02-08Merge from rustcThe Miri Cronjob Bot-23/+16
2025-02-07Rollup merge of #135945 - estebank:useless-parens, r=compiler-errorsMatthias Krüger-15/+15
Remove some unnecessary parens in `assert!` conditions While working on #122661, some of these started triggering our "unnecessary parens" lints due to a change in the `assert!` desugaring. A cursory search identified a few more. Some of these have been carried from before 1.0, were a bulk rename from the previous name of `assert!` left them in that state. I went and removed as many of these unnecessary parens as possible in order to have fewer annoyances in the future if we make the lint smarter.
2025-02-06remove use of `feature(trait_upcasting)` from miriWaffle Lapkin-8/+1
2025-02-06Remove some unnecessary parens in `assert!` conditionsEsteban Küber-15/+15
While working on #122661, some of these started triggering our "unnecessary parens" lints due to a change in the `assert!` desugaring. A cursory search identified a few more. Some of these have been carried from before 1.0, were a bulk rename from the previous name of `assert!` left them in that state. I went and removed as many of these unnecessary parens as possible in order to have fewer annoyances in the future if we make the lint smarter.
2025-02-06Merge pull request #4181 from tiif/check_shim_variadicRalf Jung-9/+38
Throw ub error when invoking non-vararg shim with vararg import
2025-02-06some more argument checking cleanupRalf Jung-9/+9
2025-02-06Throw ub error when invoking non-vararg shim with vararg importtiif-0/+29
2025-02-06allow code to call geteuid()Slava Barinov-0/+5
2025-02-05Merge from rustcRalf Jung-0/+20
2025-02-04Auto merge of #135760 - scottmcm:disjoint-bitor, r=WaffleLapkinbors-0/+20
Add `unchecked_disjoint_bitor` per ACP373 Following the names from libs-api in https://github.com/rust-lang/libs-team/issues/373#issuecomment-2085686057 Includes a fallback implementation so this doesn't have to update cg_clif or cg_gcc, and overrides it in cg_llvm to use `or disjoint`, which [is available in LLVM 18](https://releases.llvm.org/18.1.0/docs/LangRef.html#or-instruction) so hopefully we don't need any version checks.
2025-02-04update JSON target spec to declare softfloat ABIRalf Jung-0/+1
2025-02-03Rollup merge of #136438 - RalfJung:offset_from_ub_errors, r=oli-obk许杰友 Jieyou Xu (Joe)-3/+45
miri: improve error when offset_from preconditions are violated Fixes https://github.com/rust-lang/miri/issues/4143
2025-02-02Merge pull request #4142 from joboet/apple-futexRalf Jung-0/+276
shim Apple's futex primitives
2025-02-02shim Apple's futex primitivesjoboet-0/+276
This is necessary to unblock rust-lang/rust#122408. The documentation for these is available [here](https://developer.apple.com/documentation/os/os_sync_wait_on_address?language=objc). Because the futex wait operations (`os_sync_wait_on_address` et al.) return the number of remaining waiters after returning, this required some changes to the common futex infrastructure, which I've changed to take a callback instead of precalculating the return values.
2025-02-02Merge pull request #4172 from RalfJung/miri_get_backtraceRalf Jung-2/+5
miri_get_backtrace: stop supporting the v0 protocol
2025-02-02Merge from rustcRalf Jung-0/+28
2025-02-02miri_get_backtrace: stop supporting the v0 protocolRalf Jung-2/+5
2025-02-02miri: improve error when offset_from preconditions are violatedRalf Jung-3/+45
2025-02-01Test getrandom 0.3Eduardo Sánchez Muñoz-1/+3
2025-01-31PR feedbackScott McMurray-0/+20
2025-02-01fmtThe Miri Cronjob Bot-27/+30
2025-02-01Merge from rustcThe Miri Cronjob Bot-0/+54
2025-01-31interpret: adjust vtable validity check for higher-ranked typesLukas Markeffsky-0/+75
2025-01-31miri: make float min/max non-deterministicRalf Jung-0/+28
2025-01-30More assertions, tests, and miri coverageMichael Goulet-0/+54
2025-01-30Merge from rustcThe Miri Cronjob Bot-2/+2
2025-01-29Merge pull request #4162 from rust-lang/rustup-2025-01-29Ralf Jung-0/+35
Automatic Rustup
2025-01-29Merge pull request #4122 from tiif/fnabiRalf Jung-4/+67
Check fixed args number for variadic function