From: Andrew Morton <akpm@linux-foundation.org>
To: akpm@linux-foundation.org, andreyknvl@gmail.com,
catalin.marinas@arm.com, chinwen.chang@mediatek.com,
elver@google.com, glider@google.com, Kuan-Ying.Lee@mediatek.com,
linux-mm@kvack.org, mm-commits@vger.kernel.org,
nicholas.tang@mediatek.com, ryabinin.a.a@gmail.com,
torvalds@linux-foundation.org
Subject: [patch 2/7] kasan, slub: reset tag when printing address
Date: Fri, 13 Aug 2021 16:54:27 -0700 [thread overview]
Message-ID: <20210813235427.2ncjDFSFa%akpm@linux-foundation.org> (raw)
In-Reply-To: <20210813165350.dc9afa56d27eadbd8ce629c0@linux-foundation.org>
From: Kuan-Ying Lee <Kuan-Ying.Lee@mediatek.com>
Subject: 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>
---
mm/slub.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/mm/slub.c~kasan-slub-reset-tag-when-printing-address
+++ a/mm/slub.c
@@ -576,8 +576,8 @@ static void print_section(char *level, c
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();
}
_
next prev parent reply other threads:[~2021-08-13 23:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-13 23:53 incoming Andrew Morton
2021-08-13 23:54 ` [patch 1/7] kasan, kmemleak: reset tags when scanning block Andrew Morton
2021-08-13 23:54 ` Andrew Morton [this message]
2021-08-13 23:54 ` [patch 3/7] slub: fix kmalloc_pagealloc_invalid_free unit test Andrew Morton
2021-08-13 23:54 ` [patch 4/7] mm: slub: fix slub_debug disabling for list of slabs Andrew Morton
2021-08-13 23:54 ` [patch 5/7] mm/madvise: report SIGBUS as -EFAULT for MADV_POPULATE_(READ|WRITE) Andrew Morton
2021-08-13 23:54 ` [patch 6/7] mm/memcg: fix incorrect flushing of lruvec data in obj_stock Andrew Morton
2021-08-13 23:54 ` [patch 7/7] lib: use PFN_PHYS() in devmem_is_allowed() Andrew Morton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210813235427.2ncjDFSFa%akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=Kuan-Ying.Lee@mediatek.com \
--cc=andreyknvl@gmail.com \
--cc=catalin.marinas@arm.com \
--cc=chinwen.chang@mediatek.com \
--cc=elver@google.com \
--cc=glider@google.com \
--cc=linux-mm@kvack.org \
--cc=mm-commits@vger.kernel.org \
--cc=nicholas.tang@mediatek.com \
--cc=ryabinin.a.a@gmail.com \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).