1
Fork 0

Rollup merge of #111375 - rcvalle:rust-cfi-fix-106547, r=bjorn3

CFI: Fix SIGILL reached via trait objects

Fix #106547 by transforming the concrete self into a reference to a trait object before emitting type metadata identifiers for trait methods.
This commit is contained in:
Michael Goulet 2023-05-11 17:43:07 -07:00 committed by GitHub
commit 691a5f3883
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 247 additions and 28 deletions

View file

@ -28,7 +28,7 @@ mod x86;
mod x86_64;
mod x86_win64;
#[derive(PartialEq, Eq, Hash, Debug, HashStable_Generic)]
#[derive(Clone, PartialEq, Eq, Hash, Debug, HashStable_Generic)]
pub enum PassMode {
/// Ignore the argument.
///
@ -211,7 +211,7 @@ impl Uniform {
}
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, HashStable_Generic)]
#[derive(Clone, PartialEq, Eq, Hash, Debug, HashStable_Generic)]
pub struct CastTarget {
pub prefix: [Option<Reg>; 8],
pub rest: Uniform,
@ -458,7 +458,7 @@ impl<'a, Ty> TyAndLayout<'a, Ty> {
/// Information about how to pass an argument to,
/// or return a value from, a function, under some ABI.
#[derive(PartialEq, Eq, Hash, Debug, HashStable_Generic)]
#[derive(Clone, PartialEq, Eq, Hash, Debug, HashStable_Generic)]
pub struct ArgAbi<'a, Ty> {
pub layout: TyAndLayout<'a, Ty>,
pub mode: PassMode,
@ -605,7 +605,7 @@ pub enum Conv {
///
/// I will do my best to describe this structure, but these
/// comments are reverse-engineered and may be inaccurate. -NDM
#[derive(PartialEq, Eq, Hash, Debug, HashStable_Generic)]
#[derive(Clone, PartialEq, Eq, Hash, Debug, HashStable_Generic)]
pub struct FnAbi<'a, Ty> {
/// The LLVM types of each argument.
pub args: Box<[ArgAbi<'a, Ty>]>,