Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
6b29bb6
Prevent ICE in autodiff validation by emitting user-friendly errors
Sa4dUs Mar 2, 2025
9067f7c
Explain weird quirk in user type annotation lowering
compiler-errors Mar 9, 2025
8ab05ad
Do not write user type annotation for const param value path
compiler-errors Mar 9, 2025
ed6dfdd
Do not feed anon const a type that references generics that it does n…
compiler-errors Mar 9, 2025
f525b17
Remove AdtFlags::IS_ANONYMOUS and Copy/Clone condition for anonymous ADT
compiler-errors Mar 10, 2025
02bb2d4
Disable CFI for weakly linked syscalls
1c3t3a Mar 4, 2025
e5dc1e3
Add comments for #[no_sanitize(cfi)] in stdlib
1c3t3a Mar 10, 2025
f38819c
Add some layout tests for pattern type edge cases
oli-obk Jan 30, 2025
916f955
Reject wrapping ranges of pattern types
oli-obk Jan 30, 2025
9d87d4e
Add tests for pattern type literals
oli-obk Jan 29, 2025
f87e58f
Allow int literals for pattern types with int base types
oli-obk Jan 29, 2025
53237c8
Refactor GCC compilation
Kobzol Mar 5, 2025
009aba0
Add `gcc` bootstrap config section
Kobzol Mar 5, 2025
c68a5ec
Add `[gcc] download-ci-gcc` option
Kobzol Mar 5, 2025
3de10b0
Add `download-ci-gcc-stamp` file
Kobzol Mar 5, 2025
bc6302c
Implement downloading GCC from CI
Kobzol Mar 5, 2025
2b1b09c
Add change tracker entry
Kobzol Mar 5, 2025
dcc2b30
Add triagebot entry for GCC modifications
Kobzol Mar 10, 2025
bf58a35
stabilize `ci_rustc_if_unchanged_logic` test for local environments
onur-ozkan Mar 8, 2025
cf8e1f5
Fix ICE for invalid return activity and proper error handling
Sa4dUs Mar 7, 2025
33f9a49
Combine autodiff errors together
Sa4dUs Mar 10, 2025
8546e01
Add individual activity span availability FIXME
Sa4dUs Mar 10, 2025
3846f94
miri native_calls: ensure we actually expose *mutable* provenance to …
RalfJung Mar 11, 2025
ba6c406
let the bodies hit the floor
lcnr Mar 11, 2025
75a69a4
Do not download GCC in tests
Kobzol Mar 11, 2025
8a2e3ac
Rollup merge of #137715 - oli-obk:pattern-type-literals, r=BoxyUwU
matthiaskrgr Mar 11, 2025
9746ac5
Rollup merge of #138002 - 1c3t3a:fix-std-cfi-violation, r=rcvalle
matthiaskrgr Mar 11, 2025
c007d0a
Rollup merge of #138051 - Kobzol:download-ci-gcc, r=onur-ozkan
matthiaskrgr Mar 11, 2025
caa2d00
Rollup merge of #138231 - Sa4dUs:autodiff-ice, r=ZuseZ4
matthiaskrgr Mar 11, 2025
55abd7f
Rollup merge of #138245 - onur-ozkan:ci-rustc-test-fix, r=jieyouxu
matthiaskrgr Mar 11, 2025
4ff58c9
Rollup merge of #138256 - compiler-errors:anon-const-ty, r=BoxyUwU
matthiaskrgr Mar 11, 2025
16ff824
Rollup merge of #138284 - compiler-errors:const-param-ty-annotation, …
matthiaskrgr Mar 11, 2025
954b88e
Rollup merge of #138296 - compiler-errors:deanonymous, r=lcnr
matthiaskrgr Mar 11, 2025
4feb866
Rollup merge of #138352 - RalfJung:miri-native-calls-exposed, r=oli-obk
matthiaskrgr Mar 11, 2025
4c1a186
Rollup merge of #138354 - lcnr:goodbye-TypeVerifier, r=compiler-errors
matthiaskrgr Mar 11, 2025
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
Prev Previous commit
Next Next commit
miri native_calls: ensure we actually expose *mutable* provenance to …
…the memory FFI can access
  • Loading branch information
RalfJung committed Mar 11, 2025
commit 3846f942300c4fd8f43a8a8a1324ad5e358b9459
4 changes: 4 additions & 0 deletions compiler/rustc_const_eval/src/interpret/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -982,6 +982,10 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
todo.push(id);
}
}
// Also expose the provenance of the interpreter-level allocation, so it can
// be read by FFI. The `black_box` is defensive programming as LLVM likes
// to (incorrectly) optimize away ptr2int casts whose result is unused.
std::hint::black_box(alloc.get_bytes_unchecked_raw().expose_provenance());

// Prepare for possible write from native code if mutable.
if info.mutbl.is_mut() {
Expand Down
5 changes: 5 additions & 0 deletions compiler/rustc_middle/src/mir/interpret/allocation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,11 @@ impl<Prov: Provenance, Extra, Bytes: AllocBytes> Allocation<Prov, Extra, Bytes>
// Set provenance of all bytes to wildcard.
self.provenance.write_wildcards(self.len());

// Also expose the provenance of the interpreter-level allocation, so it can
// be written by FFI. The `black_box` is defensive programming as LLVM likes
// to (incorrectly) optimize away ptr2int casts whose result is unused.
std::hint::black_box(self.get_bytes_unchecked_raw_mut().expose_provenance());

Ok(())
}

Expand Down
4 changes: 2 additions & 2 deletions src/tools/miri/src/alloc_addresses/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
}
AllocKind::Dead => unreachable!(),
};
// Ensure this pointer's provenance is exposed, so that it can be used by FFI code.
return interp_ok(base_ptr.expose_provenance().try_into().unwrap());
// We don't have to expose this pointer yet, we do that in `prepare_for_native_call`.
return interp_ok(base_ptr.addr().try_into().unwrap());
}
// We are not in native lib mode, so we control the addresses ourselves.
if let Some((reuse_addr, clock)) = global_state.reuse.take_addr(
Expand Down
2 changes: 1 addition & 1 deletion src/tools/miri/src/shims/native_lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ fn imm_to_carg<'tcx>(v: &ImmTy<'tcx>, cx: &impl HasDataLayout) -> InterpResult<'
CArg::USize(v.to_scalar().to_target_usize(cx)?.try_into().unwrap()),
ty::RawPtr(..) => {
let s = v.to_scalar().to_pointer(cx)?.addr();
// This relies on the `expose_provenance` in `addr_from_alloc_id`.
// This relies on the `expose_provenance` in `prepare_for_native_call`.
CArg::RawPtr(std::ptr::with_exposed_provenance_mut(s.bytes_usize()))
}
_ => throw_unsup_format!("unsupported argument type for native call: {}", v.layout.ty),
Expand Down
Loading