rust/library
bors 5ac4c8a63e Auto merge of #119037 - RalfJung:repr-c-abi-mismatch, r=scottmcm
do not allow ABI mismatches inside repr(C) types

In https://github.com/rust-lang/rust/pull/115476 we allowed ABI mismatches inside `repr(C)` types. This wasn't really discussed much; I added it because from how I understand calling conventions, this should actually be safe in practice. However I entirely forgot to actually allow this in Miri, and in the mean time I have learned that too much ABI compatibility can be a problem for CFI (it can reject fewer calls so that gives an attacker more room to play with).

So I propose we take back that part about ABI compatibility in `repr(C)`. It is anyway something that C and C++ do not allow, as far as I understand.

In the future we might want to introduce a class of ABI compatibilities where we say "this is a bug and it may lead to aborting the process, but it won't lead to arbitrary misbehavior -- worst case it'll just transmute the arguments from the caller type to the callee type". That would give CFI leeway to reject such calls without introducing the risk of arbitrary UB. (The UB can still happen if the transmute leads to bad results, of course, but it wouldn't be due to ABI weirdness.)

#115476 hasn't reached beta yet so if we land this before Dec 22nd we can just pretend this all never happened. ;)  Otherwise we should do a beta backport (of the docs change at least).

Cc `@rust-lang/opsem` `@rust-lang/types`
2023-12-20 18:04:40 +00:00
..
alloc Auto merge of #106790 - the8472:rawvec-niche, r=scottmcm 2023-12-20 02:19:10 +00:00
backtrace@6145fe6bac Update backtrace submodule 2023-11-21 16:33:42 +01:00
core Auto merge of #119037 - RalfJung:repr-c-abi-mismatch, r=scottmcm 2023-12-20 18:04:40 +00:00
panic_abort add teeos std impl 2023-12-07 10:33:03 +08:00
panic_unwind panic_unwind: support unwinding on xous 2023-11-16 15:23:09 +08:00
portable-simd Fix target_feature config in portable-simd 2023-12-14 14:50:32 +01:00
proc_macro Add support for --env on tracked_env::var 2023-12-11 16:44:33 +01:00
profiler_builtins Bump cfg(bootstrap) 2023-08-23 20:05:14 -04:00
rtstartup
rustc-std-workspace-alloc Replace libstd, libcore, liballoc in line comments. 2022-12-30 14:00:42 +01:00
rustc-std-workspace-core
rustc-std-workspace-std
std Rollup merge of #119051 - ChrisDenton:wine, r=workingjubilee 2023-12-18 08:08:24 +01:00
stdarch@f4528dd6e8 Bump stdarch submodule 2023-10-12 11:11:29 +02:00
sysroot Expose compiler-builtins-weak-intrinsics feature for -Zbuild-std 2023-06-23 11:15:34 +01:00
test remove redundant imports 2023-12-10 10:56:22 +08:00
unwind unwind: add support for using unwinding crate 2023-11-16 15:23:09 +08:00