Commit f06f78ab authored by Kuan-Ying Lee's avatar Kuan-Ying Lee Committed by Linus Torvalds

kasan: rename CONFIG_KASAN_SW_TAGS_IDENTIFY to CONFIG_KASAN_TAGS_IDENTIFY

Patch series "kasan: add memory corruption identification support for hw tag-based kasan", v4.

Add memory corruption identification for hardware tag-based KASAN mode.

This patch (of 3):

Rename CONFIG_KASAN_SW_TAGS_IDENTIFY to CONFIG_KASAN_TAGS_IDENTIFY in
order to be compatible with hardware tag-based mode.

Link: https://lkml.kernel.org/r/20210626100931.22794-1-Kuan-Ying.Lee@mediatek.com
Link: https://lkml.kernel.org/r/20210626100931.22794-2-Kuan-Ying.Lee@mediatek.comSigned-off-by: default avatarKuan-Ying Lee <Kuan-Ying.Lee@mediatek.com>
Suggested-by: default avatarMarco Elver <elver@google.com>
Reviewed-by: default avatarAlexander Potapenko <glider@google.com>
Reviewed-by: default avatarAndrey Konovalov <andreyknvl@gmail.com>
Reviewed-by: default avatarMarco Elver <elver@google.com>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: Chinwen Chang <chinwen.chang@mediatek.com>
Cc: Nicholas Tang <nicholas.tang@mediatek.com>
Cc: Kuan-Ying Lee <Kuan-Ying.Lee@mediatek.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent cb32c9c5
...@@ -167,7 +167,7 @@ config KASAN_STACK ...@@ -167,7 +167,7 @@ config KASAN_STACK
instrumentation is also disabled as it adds inline-style instrumentation is also disabled as it adds inline-style
instrumentation that is run unconditionally. instrumentation that is run unconditionally.
config KASAN_SW_TAGS_IDENTIFY config KASAN_TAGS_IDENTIFY
bool "Enable memory corruption identification" bool "Enable memory corruption identification"
depends on KASAN_SW_TAGS depends on KASAN_SW_TAGS
help help
......
...@@ -153,7 +153,7 @@ struct kasan_track { ...@@ -153,7 +153,7 @@ struct kasan_track {
depot_stack_handle_t stack; depot_stack_handle_t stack;
}; };
#ifdef CONFIG_KASAN_SW_TAGS_IDENTIFY #ifdef CONFIG_KASAN_TAGS_IDENTIFY
#define KASAN_NR_FREE_STACKS 5 #define KASAN_NR_FREE_STACKS 5
#else #else
#define KASAN_NR_FREE_STACKS 1 #define KASAN_NR_FREE_STACKS 1
...@@ -170,7 +170,7 @@ struct kasan_alloc_meta { ...@@ -170,7 +170,7 @@ struct kasan_alloc_meta {
#else #else
struct kasan_track free_track[KASAN_NR_FREE_STACKS]; struct kasan_track free_track[KASAN_NR_FREE_STACKS];
#endif #endif
#ifdef CONFIG_KASAN_SW_TAGS_IDENTIFY #ifdef CONFIG_KASAN_TAGS_IDENTIFY
u8 free_pointer_tag[KASAN_NR_FREE_STACKS]; u8 free_pointer_tag[KASAN_NR_FREE_STACKS];
u8 free_track_idx; u8 free_track_idx;
#endif #endif
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
const char *kasan_get_bug_type(struct kasan_access_info *info) const char *kasan_get_bug_type(struct kasan_access_info *info)
{ {
#ifdef CONFIG_KASAN_SW_TAGS_IDENTIFY #ifdef CONFIG_KASAN_TAGS_IDENTIFY
struct kasan_alloc_meta *alloc_meta; struct kasan_alloc_meta *alloc_meta;
struct kmem_cache *cache; struct kmem_cache *cache;
struct page *page; struct page *page;
......
...@@ -177,7 +177,7 @@ void kasan_set_free_info(struct kmem_cache *cache, ...@@ -177,7 +177,7 @@ void kasan_set_free_info(struct kmem_cache *cache,
if (!alloc_meta) if (!alloc_meta)
return; return;
#ifdef CONFIG_KASAN_SW_TAGS_IDENTIFY #ifdef CONFIG_KASAN_TAGS_IDENTIFY
idx = alloc_meta->free_track_idx; idx = alloc_meta->free_track_idx;
alloc_meta->free_pointer_tag[idx] = tag; alloc_meta->free_pointer_tag[idx] = tag;
alloc_meta->free_track_idx = (idx + 1) % KASAN_NR_FREE_STACKS; alloc_meta->free_track_idx = (idx + 1) % KASAN_NR_FREE_STACKS;
...@@ -196,7 +196,7 @@ struct kasan_track *kasan_get_free_track(struct kmem_cache *cache, ...@@ -196,7 +196,7 @@ struct kasan_track *kasan_get_free_track(struct kmem_cache *cache,
if (!alloc_meta) if (!alloc_meta)
return NULL; return NULL;
#ifdef CONFIG_KASAN_SW_TAGS_IDENTIFY #ifdef CONFIG_KASAN_TAGS_IDENTIFY
for (i = 0; i < KASAN_NR_FREE_STACKS; i++) { for (i = 0; i < KASAN_NR_FREE_STACKS; i++) {
if (alloc_meta->free_pointer_tag[i] == tag) if (alloc_meta->free_pointer_tag[i] == tag)
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment