2015-05-16 02:33:32 +08:00
|
|
|
// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
|
2015-05-16 08:09:39 +08:00
|
|
|
// RUN: not %clang_cc1 -std=c++11 -ast-dump %s | FileCheck --check-prefix=DUMP %s
|
|
|
|
// RUN: not %clang_cc1 -std=c++11 -ast-print %s | FileCheck --check-prefix=PRINT %s
|
2015-05-16 02:33:32 +08:00
|
|
|
|
|
|
|
int f1() __attribute__((no_sanitize)); // expected-error{{'no_sanitize' attribute takes at least 1 argument}}
|
|
|
|
|
|
|
|
int f2() __attribute__((no_sanitize(1))); // expected-error{{'no_sanitize' attribute requires a string}}
|
|
|
|
|
|
|
|
// DUMP-LABEL: FunctionDecl {{.*}} f3
|
|
|
|
// DUMP: NoSanitizeAttr {{.*}} address
|
|
|
|
// PRINT: int f3() __attribute__((no_sanitize("address")))
|
|
|
|
int f3() __attribute__((no_sanitize("address")));
|
|
|
|
|
|
|
|
// DUMP-LABEL: FunctionDecl {{.*}} f4
|
|
|
|
// DUMP: NoSanitizeAttr {{.*}} thread
|
|
|
|
// PRINT: int f4() {{\[\[}}clang::no_sanitize("thread")]]
|
|
|
|
[[clang::no_sanitize("thread")]] int f4();
|
|
|
|
|
2017-12-09 09:32:07 +08:00
|
|
|
// DUMP-LABEL: FunctionDecl {{.*}} f4
|
|
|
|
// DUMP: NoSanitizeAttr {{.*}} hwaddress
|
|
|
|
// PRINT: int f4() {{\[\[}}clang::no_sanitize("hwaddress")]]
|
|
|
|
[[clang::no_sanitize("hwaddress")]] int f4();
|
|
|
|
|
2015-05-16 02:33:32 +08:00
|
|
|
// DUMP-LABEL: FunctionDecl {{.*}} f5
|
2017-12-09 09:32:07 +08:00
|
|
|
// DUMP: NoSanitizeAttr {{.*}} address thread hwaddress
|
|
|
|
// PRINT: int f5() __attribute__((no_sanitize("address", "thread", "hwaddress")))
|
|
|
|
int f5() __attribute__((no_sanitize("address", "thread", "hwaddress")));
|
2015-05-16 02:33:32 +08:00
|
|
|
|
|
|
|
// DUMP-LABEL: FunctionDecl {{.*}} f6
|
|
|
|
// DUMP: NoSanitizeAttr {{.*}} unknown
|
|
|
|
// PRINT: int f6() __attribute__((no_sanitize("unknown")))
|
|
|
|
int f6() __attribute__((no_sanitize("unknown"))); // expected-warning{{unknown sanitizer 'unknown' ignored}}
|
ARM MTE stack sanitizer.
Add "memtag" sanitizer that detects and mitigates stack memory issues
using armv8.5 Memory Tagging Extension.
It is similar in principle to HWASan, which is a software implementation
of the same idea, but there are enough differencies to warrant a new
sanitizer type IMHO. It is also expected to have very different
performance properties.
The new sanitizer does not have a runtime library (it may grow one
later, along with a "debugging" mode). Similar to SafeStack and
StackProtector, the instrumentation pass (in a follow up change) will be
inserted in all cases, but will only affect functions marked with the
new sanitize_memtag attribute.
Reviewers: pcc, hctim, vitalybuka, ostannard
Subscribers: srhines, mehdi_amini, javed.absar, kristof.beyls, hiraditya, cryptoad, steven_wu, dexonsmith, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D64169
llvm-svn: 366123
2019-07-16 04:02:23 +08:00
|
|
|
|
|
|
|
// DUMP-LABEL: FunctionDecl {{.*}} f7
|
|
|
|
// DUMP: NoSanitizeAttr {{.*}} memtag
|
|
|
|
// PRINT: int f7() {{\[\[}}clang::no_sanitize("memtag")]]
|
|
|
|
[[clang::no_sanitize("memtag")]] int f7();
|