diff options
| author | bors <bors@rust-lang.org> | 2023-05-28 04:41:13 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-05-28 04:41:13 +0000 |
| commit | 2560b80a08597e4192aa3ee5a4670e36a5e4a7dd (patch) | |
| tree | ec75c4a52fa5946872d23a4cc34216d775700e3e /compiler/rustc_codegen_llvm | |
| parent | b9c5fdc888e05be88269a47d40fd0d911ec2be0b (diff) | |
| parent | 019d75b44e3f4349495890453d2d154a8f7ba116 (diff) | |
| download | rust-2560b80a08597e4192aa3ee5a4670e36a5e4a7dd.tar.gz rust-2560b80a08597e4192aa3ee5a4670e36a5e4a7dd.zip | |
Auto merge of #112000 - wesleywiser:safestack, r=Amanieu
Add support for LLVM SafeStack Adds support for LLVM [SafeStack] which provides backward edge control flow protection by separating the stack into two parts: data which is only accessed in provable safe ways is allocated on the normal stack (the "safe stack") and all other data is placed in a separate allocation (the "unsafe stack"). SafeStack support is enabled by passing `-Zsanitizer=safestack`. [SafeStack]: https://clang.llvm.org/docs/SafeStack.html cc `@rcvalle` #39699
Diffstat (limited to 'compiler/rustc_codegen_llvm')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/attributes.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/llvm/ffi.rs | 1 |
2 files changed, 4 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_llvm/src/attributes.rs b/compiler/rustc_codegen_llvm/src/attributes.rs index 651d644ebb6..6d00464e0a0 100644 --- a/compiler/rustc_codegen_llvm/src/attributes.rs +++ b/compiler/rustc_codegen_llvm/src/attributes.rs @@ -88,6 +88,9 @@ pub fn sanitize_attrs<'ll>( attrs.push(llvm::AttributeKind::SanitizeMemTag.create_attr(cx.llcx)); } + if enabled.contains(SanitizerSet::SAFESTACK) { + attrs.push(llvm::AttributeKind::SanitizeSafeStack.create_attr(cx.llcx)); + } attrs } diff --git a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs index de93a64c0d6..6ef3418cc5f 100644 --- a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs +++ b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs @@ -196,6 +196,7 @@ pub enum AttributeKind { AllocSize = 37, AllocatedPointer = 38, AllocAlign = 39, + SanitizeSafeStack = 40, } /// LLVMIntPredicate |
