Subject: [PATCH v2 0/2] kasan: reset tag when accessing invalid data

With hardware tag-based kasan enabled, we reset the tag
when we access metadata to avoid from false alarm.

Changes since v2:
- Refine the commit message in detail.
- Thanks Andrey's explanation about false alarm
of kmemleak.

Kuan-Ying Lee (2):
kasan, kmemleak: reset tags when scanning block
kasan, slub: reset tag when printing address

mm/kmemleak.c | 6 +++---
mm/slub.c | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)

--
2.18.0



Subject: [PATCH v2 2/2] kasan, slub: reset tag when printing address

The address still includes the tags when it is printed.
With hardware tag-based kasan enabled, we will get a
false positive KASAN issue when we access metadata.

Reset the tag before we access the metadata.

Fixes: aa1ef4d7b3f6 ("kasan, mm: reset tags when accessing metadata")
Signed-off-by: Kuan-Ying Lee <[email protected]>
Suggested-by: Marco Elver <[email protected]>
---
mm/slub.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/slub.c b/mm/slub.c
index b6c5205252eb..f77d8cd79ef7 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -576,8 +576,8 @@ static void print_section(char *level, char *text, u8 *addr,
unsigned int length)
{
metadata_access_enable();
- print_hex_dump(level, kasan_reset_tag(text), DUMP_PREFIX_ADDRESS,
- 16, 1, addr, length, 1);
+ print_hex_dump(level, text, DUMP_PREFIX_ADDRESS,
+ 16, 1, kasan_reset_tag((void *)addr), length, 1);
metadata_access_disable();
}

--
2.18.0