diff options
| author | Vitaly Buka <vitalybuka@google.com> | 2018-04-09 20:10:29 +0000 |
|---|---|---|
| committer | Vitaly Buka <vitalybuka@google.com> | 2018-04-09 20:10:29 +0000 |
| commit | 69a2e18b4aeafad0e30091fb5f9c191e6d1c2df4 (patch) | |
| tree | c89cba0768e95c6619ae743d8b79bcb5aa7fc85f /clang/lib/CodeGen | |
| parent | 5cff2409aef90dd85331735e65b87f3118766c7c (diff) | |
| download | bcm5719-llvm-69a2e18b4aeafad0e30091fb5f9c191e6d1c2df4.tar.gz bcm5719-llvm-69a2e18b4aeafad0e30091fb5f9c191e6d1c2df4.zip | |
asan: kernel: make no_sanitize("address") attribute work with -fsanitize=kernel-address
Summary:
Right now to disable -fsanitize=kernel-address instrumentation, one needs to use no_sanitize("kernel-address"). Make either no_sanitize("address") or no_sanitize("kernel-address") disable both ASan and KASan instrumentation. Also remove redundant test.
Patch by Andrey Konovalov
Reviewers: eugenis, kcc, glider, dvyukov, vitalybuka
Reviewed By: eugenis, vitalybuka
Differential Revision: https://reviews.llvm.org/D44981
llvm-svn: 329612
Diffstat (limited to 'clang/lib/CodeGen')
| -rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index e5db4e52b4a..57b1c4b4db1 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -846,8 +846,14 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, if (D) { // Apply the no_sanitize* attributes to SanOpts. - for (auto Attr : D->specific_attrs<NoSanitizeAttr>()) - SanOpts.Mask &= ~Attr->getMask(); + for (auto Attr : D->specific_attrs<NoSanitizeAttr>()) { + SanitizerMask mask = Attr->getMask(); + SanOpts.Mask &= ~mask; + if (mask & SanitizerKind::Address) + SanOpts.set(SanitizerKind::KernelAddress, false); + if (mask & SanitizerKind::KernelAddress) + SanOpts.set(SanitizerKind::Address, false); + } } // Apply sanitizer attributes to the function. |

