From: Daniel Axtens <dja@axtens.net>
To: aneesh.kumar@linux.ibm.com, christophe.leroy@c-s.fr,
bsingharora@gmail.com
Cc: linuxppc-dev@lists.ozlabs.org, kasan-dev@googlegroups.com,
Daniel Axtens <dja@axtens.net>
Subject: [RFC PATCH 1/5] kasan: do not open-code addr_has_shadow
Date: Fri, 15 Feb 2019 11:04:37 +1100 [thread overview]
Message-ID: <20190215000441.14323-2-dja@axtens.net> (raw)
In-Reply-To: <20190215000441.14323-1-dja@axtens.net>
We have a couple of places checking for the existence of a shadow
mapping for an address by open-coding the inverse of the check in
addr_has_shadow.
Replace the open-coded versions with the helper. This will be
needed in future to allow architectures to override the layout
of the shadow mapping.
Signed-off-by: Daniel Axtens <dja@axtens.net>
---
mm/kasan/generic.c | 3 +--
mm/kasan/tags.c | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/mm/kasan/generic.c b/mm/kasan/generic.c
index ccb6207276e3..ffc64a9a97a5 100644
--- a/mm/kasan/generic.c
+++ b/mm/kasan/generic.c
@@ -173,8 +173,7 @@ static __always_inline void check_memory_region_inline(unsigned long addr,
if (unlikely(size == 0))
return;
- if (unlikely((void *)addr <
- kasan_shadow_to_mem((void *)KASAN_SHADOW_START))) {
+ if (unlikely(!addr_has_shadow((void *)addr))) {
kasan_report(addr, size, write, ret_ip);
return;
}
diff --git a/mm/kasan/tags.c b/mm/kasan/tags.c
index 0777649e07c4..bc759f8f1c67 100644
--- a/mm/kasan/tags.c
+++ b/mm/kasan/tags.c
@@ -109,8 +109,7 @@ void check_memory_region(unsigned long addr, size_t size, bool write,
return;
untagged_addr = reset_tag((const void *)addr);
- if (unlikely(untagged_addr <
- kasan_shadow_to_mem((void *)KASAN_SHADOW_START))) {
+ if (unlikely(!addr_has_shadow(untagged_addr))) {
kasan_report(addr, size, write, ret_ip);
return;
}
--
2.19.1
next prev parent reply other threads:[~2019-02-15 0:08 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-15 0:04 [RFC PATCH 0/5] powerpc: KASAN for 64-bit Book3E Daniel Axtens
2019-02-15 0:04 ` Daniel Axtens [this message]
2019-02-15 0:12 ` [RFC PATCH 1/5] kasan: do not open-code addr_has_shadow Andrew Donnellan
2019-02-15 8:21 ` Dmitry Vyukov
2019-02-15 0:04 ` [RFC PATCH 2/5] kasan: allow architectures to manage the memory-to-shadow mapping Daniel Axtens
2019-02-15 6:35 ` Dmitry Vyukov
2019-02-15 0:04 ` [RFC PATCH 3/5] kasan: allow architectures to provide an outline readiness check Daniel Axtens
2019-02-15 8:25 ` Dmitry Vyukov
2019-02-17 12:05 ` christophe leroy
2019-02-18 6:13 ` Daniel Axtens
2019-02-25 14:01 ` Christophe Leroy
2019-02-26 0:14 ` Daniel Axtens
2019-02-15 0:04 ` [RFC PATCH 4/5] powerpc: move KASAN into its own subdirectory Daniel Axtens
2019-02-15 0:24 ` Andrew Donnellan
2019-02-17 16:29 ` christophe leroy
2019-02-18 9:14 ` Michael Ellerman
2019-02-18 12:27 ` Christophe Leroy
2019-02-19 0:44 ` Michael Ellerman
2019-02-15 0:04 ` [RFC PATCH 5/5] powerpc: KASAN for 64bit Book3E Daniel Axtens
2019-02-15 8:28 ` Dmitry Vyukov
2019-02-19 6:37 ` Daniel Axtens
2019-02-17 14:06 ` christophe leroy
2019-02-18 19:26 ` Christophe Leroy
2019-02-19 0:14 ` Daniel Axtens
2019-02-15 16:39 ` [RFC PATCH 0/5] powerpc: KASAN for 64-bit Book3E Christophe Leroy
2019-02-17 6:34 ` Balbir Singh
2019-02-19 6:35 ` Daniel Axtens
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=20190215000441.14323-2-dja@axtens.net \
--to=dja@axtens.net \
--cc=aneesh.kumar@linux.ibm.com \
--cc=bsingharora@gmail.com \
--cc=christophe.leroy@c-s.fr \
--cc=kasan-dev@googlegroups.com \
--cc=linuxppc-dev@lists.ozlabs.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).