rust/compiler/rustc_codegen_llvm/src
Guillaume Gomez 6047243330
Rollup merge of #145867 - Zalathar:range-attr, r=nikic
cg_llvm: Assert that LLVM range-attribute values don't exceed 128 bits

The underlying implementation of `LLVMCreateConstantRangeAttribute` assumes that each of `LowerWords` and `UpperWords` points to enough u64 values to define an integer of the specified bit-length, and will encounter UB if that is not the case.

Our safe wrapper function always passes pointers to `[u64; 2]` arrays, regardless of the bit-length specified. That's fine in practice, because scalar primitives never exceed 128 bits, but it is technically a soundness hole in a safe function.

We can close the soundness hole by explicitly asserting `size_bits <= 128`. This is effectively just a stricter version of the existing check that the value must be small enough to fit in `c_uint`.

---

This is a narrower version of the fix in rust-lang/rust#145846.
2025-08-26 16:34:17 +02:00
..
back Rollup merge of #145814 - bjorn3:codegen_worker_fatal_error, r=petrochenkov 2025-08-26 14:19:18 +10:00
builder Rename llvm::Bool aliases to standard const case 2025-08-24 23:09:54 +10:00
coverageinfo coverage: Remove all unstable support for MC/DC instrumentation 2025-08-06 22:38:52 +10:00
debuginfo Rename llvm::Bool aliases to standard const case 2025-08-24 23:09:54 +10:00
llvm Assert that LLVM range-attribute values don't exceed 128 bits 2025-08-26 13:07:19 +10:00
abi.rs Tell LLVM about read-only captures 2025-08-20 19:08:16 +02:00
allocator.rs Rename llvm::Bool aliases to standard const case 2025-08-24 23:09:54 +10:00
asm.rs Replace the llvm::Bool typedef with a proper newtype 2025-08-24 23:09:54 +10:00
attributes.rs Auto merge of #144086 - clubby789:alloc-zeroed, r=nikic 2025-08-20 17:16:34 +00:00
base.rs Port the #[linkage] attribute to the new attribute system 2025-08-13 21:01:37 +02:00
builder.rs Rename llvm::Bool aliases to standard const case 2025-08-24 23:09:54 +10:00
callee.rs remove rustc_attr_data_structures 2025-07-31 14:19:27 +02:00
common.rs Rename llvm::Bool aliases to standard const case 2025-08-24 23:09:54 +10:00
consts.rs Port the #[linkage] attribute to the new attribute system 2025-08-13 21:01:37 +02:00
context.rs Rename llvm::Bool aliases to standard const case 2025-08-24 23:09:54 +10:00
declare.rs make more builder functions generic 2025-07-18 16:23:54 -07:00
errors.rs Use the object crate rather than LLVM for extracting bitcode sections 2025-07-25 11:21:28 +00:00
intrinsic.rs remove an as cast in prefetch codegen 2025-08-21 11:28:10 +02:00
lib.rs Directly raise fatal errors inside the codegen backends 2025-08-24 11:20:41 +00:00
llvm_util.rs Rollup merge of #145076 - ZhongyaoChen:feature/add-tier3-riscv64a23-target, r=davidtwco 2025-08-26 16:34:10 +02:00
mono_item.rs Replace the llvm::Bool typedef with a proper newtype 2025-08-24 23:09:54 +10:00
type_.rs Rename llvm::Bool aliases to standard const case 2025-08-24 23:09:54 +10:00
type_of.rs rename BackendRepr::Vector → SimdVector 2025-02-28 17:17:45 +01:00
va_arg.rs Auto merge of #143182 - xdoardo:more-addrspace, r=workingjubilee 2025-07-07 17:28:14 +00:00
value.rs Add warn(unreachable_pub) to rustc_codegen_llvm. 2024-08-16 08:46:57 +10:00