[PATCH] kasan: update kasan_global for gcc 7

From: Dmitry Vyukov
Date: Thu Nov 24 2016 - 09:36:24 EST


kasan_global struct is part of compiler/runtime ABI.
gcc revision 241983 has added a new field to kasan_global struct.
Update kernel definition of kasan_global struct to include
the new field.

Without this patch KASAN is broken with gcc 7.

Signed-off-by: Dmitry Vyukov <dvyukov@xxxxxxxxxx>
Cc: aryabinin@xxxxxxxxxxxxx
Cc: glider@xxxxxxxxxx
Cc: akpm@xxxxxxxxxxxxxxxxxxxx
Cc: arnd@xxxxxxxx
Cc: kasan-dev@xxxxxxxxxxxxxxxx
Cc: linux-mm@xxxxxxxxx
Cc: linux-kernel@xxxxxxxxxxxxxxx
Cc: stable@xxxxxxxxxxxxxxx # 4.0+

---
Changes since v1:
- added cc stable
---
include/linux/compiler-gcc.h | 4 +++-
mm/kasan/kasan.h | 3 +++
2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 432f5c9..928e5ca 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -263,7 +263,9 @@
#endif
#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP && !__CHECKER__ */

-#if GCC_VERSION >= 50000
+#if GCC_VERSION >= 70000
+#define KASAN_ABI_VERSION 5
+#elif GCC_VERSION >= 50000
#define KASAN_ABI_VERSION 4
#elif GCC_VERSION >= 40902
#define KASAN_ABI_VERSION 3
diff --git a/mm/kasan/kasan.h b/mm/kasan/kasan.h
index e5c2181..03f4545 100644
--- a/mm/kasan/kasan.h
+++ b/mm/kasan/kasan.h
@@ -53,6 +53,9 @@ struct kasan_global {
#if KASAN_ABI_VERSION >= 4
struct kasan_source_location *location;
#endif
+#if KASAN_ABI_VERSION >= 5
+ char *odr_indicator;
+#endif
};

/**
--
2.8.0.rc3.226.g39d4020