UPSTREAM: 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. Link: https://lkml.kernel.org/r/20210804090957.12393-3-Kuan-Ying.Lee@mediatek.com Fixes: aa1ef4d7b3f6 ("kasan, mm: reset tags when accessing metadata") Signed-off-by: Kuan-Ying Lee <Kuan-Ying.Lee@mediatek.com> Reviewed-by: Marco Elver <elver@google.com> Reviewed-by: Andrey Konovalov <andreyknvl@gmail.com> Cc: Alexander Potapenko <glider@google.com> Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Chinwen Chang <chinwen.chang@mediatek.com> Cc: Nicholas Tang <nicholas.tang@mediatek.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> (cherry picked from commit 340caf178ddc2efb0294afaf54c715f7928c258e) Bug: 187129171 Signed-off-by: Connor O'Brien <connoro@google.com> Change-Id: I18dcd88e9e638f9454f5aecf7f71e8aecb14f7cf
This commit is contained in:

committed by
Connor O'Brien

parent
3b6f980a85
commit
c0cce1da8b
@@ -534,8 +534,8 @@ static void print_section(char *level, char *text, u8 *addr,
|
|||||||
unsigned int length)
|
unsigned int length)
|
||||||
{
|
{
|
||||||
metadata_access_enable();
|
metadata_access_enable();
|
||||||
print_hex_dump(level, kasan_reset_tag(text), DUMP_PREFIX_ADDRESS,
|
print_hex_dump(level, text, DUMP_PREFIX_ADDRESS,
|
||||||
16, 1, addr, length, 1);
|
16, 1, kasan_reset_tag((void *)addr), length, 1);
|
||||||
metadata_access_disable();
|
metadata_access_disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user