diff options
author | Paul Lawrence <paullawrence@google.com> | 2018-02-06 18:36:03 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-02-06 21:32:42 -0500 |
commit | 53a98ed73b848432a51631346b02049bb7fa039d (patch) | |
tree | f923b316690f5fd0064f5e6a968acf82c33b1420 /include/linux/compiler-clang.h | |
parent | 0e410e158e5baa1300bdf678cea4f4e0cf9d8b94 (diff) |
kasan: add compiler support for clang
Patch series "kasan: support alloca, LLVM", v4.
This patch (of 5):
For now we can hard-code ASAN ABI level 5, since historical clang builds
can't build the kernel anyway. We also need to emulate gcc's
__SANITIZE_ADDRESS__ flag, or memset() calls won't be instrumented.
Link: http://lkml.kernel.org/r/20171204191735.132544-2-paullawrence@google.com
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Acked-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Matthias Kaehlcke <mka@chromium.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/compiler-clang.h')
-rw-r--r-- | include/linux/compiler-clang.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h index 3b609edffa8f..d02a4df3f473 100644 --- a/include/linux/compiler-clang.h +++ b/include/linux/compiler-clang.h | |||
@@ -19,3 +19,11 @@ | |||
19 | 19 | ||
20 | #define randomized_struct_fields_start struct { | 20 | #define randomized_struct_fields_start struct { |
21 | #define randomized_struct_fields_end }; | 21 | #define randomized_struct_fields_end }; |
22 | |||
23 | /* all clang versions usable with the kernel support KASAN ABI version 5 */ | ||
24 | #define KASAN_ABI_VERSION 5 | ||
25 | |||
26 | /* emulate gcc's __SANITIZE_ADDRESS__ flag */ | ||
27 | #if __has_feature(address_sanitizer) | ||
28 | #define __SANITIZE_ADDRESS__ | ||
29 | #endif | ||