diff options
| author | Ivan Lozano <ivanlozano@google.com> | 2022-06-17 14:14:58 -0400 |
|---|---|---|
| committer | Ivan Lozano <ivanlozano@google.com> | 2022-07-20 13:43:34 +0000 |
| commit | adf61e3b2b72f4a06b3ac5cf90d49deda42da605 (patch) | |
| tree | cc7b018bca40d9d783f7b707965662da2569624f /compiler/rustc_codegen_llvm/src | |
| parent | a289cfcfb32593c63d75f113547f63ffe2dde285 (diff) | |
| download | rust-adf61e3b2b72f4a06b3ac5cf90d49deda42da605.tar.gz rust-adf61e3b2b72f4a06b3ac5cf90d49deda42da605.zip | |
Add ShadowCallStack Support
Adds support for the LLVM ShadowCallStack sanitizer.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
| -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 62da99ac3fb..1a96dd8bec4 100644 --- a/compiler/rustc_codegen_llvm/src/attributes.rs +++ b/compiler/rustc_codegen_llvm/src/attributes.rs @@ -69,6 +69,9 @@ pub fn sanitize_attrs<'ll>( if enabled.contains(SanitizerSet::HWADDRESS) { attrs.push(llvm::AttributeKind::SanitizeHWAddress.create_attr(cx.llcx)); } + if enabled.contains(SanitizerSet::SHADOWCALLSTACK) { + attrs.push(llvm::AttributeKind::ShadowCallStack.create_attr(cx.llcx)); + } if enabled.contains(SanitizerSet::MEMTAG) { // Check to make sure the mte target feature is actually enabled. let features = cx.tcx.global_backend_features(()); diff --git a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs index 73cedb59349..8a6101e051b 100644 --- a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs +++ b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs @@ -192,6 +192,7 @@ pub enum AttributeKind { NoUndef = 33, SanitizeMemTag = 34, NoCfCheck = 35, + ShadowCallStack = 36, } /// LLVMIntPredicate |
