From: Catalin Marinas <catalin.marinas@arm.com>
To: Andrey Ryabinin <a.ryabinin@samsung.com>
Cc: Will Deacon <will.deacon@arm.com>,
linux-arm-kernel@lists.infradead.org,
Arnd Bergmann <arnd@arndb.de>,
linux-mm@kvack.org, Linus Walleij <linus.walleij@linaro.org>,
linux-kernel@vger.kernel.org,
David Keitel <dkeitel@codeaurora.org>,
Alexander Potapenko <glider@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
Dmitry Vyukov <dvyukov@google.com>
Subject: Re: [PATCH v3 4/5] arm64: add KASAN support
Date: Wed, 22 Jul 2015 16:49:41 +0100 [thread overview]
Message-ID: <20150722154941.GE16627@e104818-lin.cambridge.arm.com> (raw)
In-Reply-To: <1437561037-31995-5-git-send-email-a.ryabinin@samsung.com>
On Wed, Jul 22, 2015 at 01:30:36PM +0300, Andrey Ryabinin wrote:
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index 318175f..61ebb7c 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -46,6 +46,7 @@ config ARM64
> select HAVE_ARCH_AUDITSYSCALL
> select HAVE_ARCH_BITREVERSE
> select HAVE_ARCH_JUMP_LABEL
> + select HAVE_ARCH_KASAN if SPARSEMEM_VMEMMAP
> select HAVE_ARCH_KGDB
> select HAVE_ARCH_SECCOMP_FILTER
> select HAVE_ARCH_TRACEHOOK
> @@ -122,6 +123,22 @@ config GENERIC_CSUM
> config GENERIC_CALIBRATE_DELAY
> def_bool y
>
> +config KASAN_SHADOW_OFFSET
> + hex
> + depends on KASAN
> + default 0xdfff200000000000 if ARM64_VA_BITS_48
> + default 0xdffffc8000000000 if ARM64_VA_BITS_42
> + default 0xdfffff9000000000 if ARM64_VA_BITS_39
> + help
> + This value used to address to corresponding shadow address
"This value is used to map an address to the corresponding shadow
address..." (unless you meant something else but the above doesn't read
well).
> + by the following formula:
> + shadow_addr = (address >> 3) + KASAN_SHADOW_OFFSET;
> +
> + (1 << 61) shadow addresses - [KASAN_SHADOW_OFFSET,KASAN_SHADOW_END]
> + cover all 64-bits of virtual addresses. So KASAN_SHADOW_OFFSET
> + should satisfy the following equation:
> + KASAN_SHADOW_OFFSET = KASAN_SHADOW_END - (1ULL << 61)
I think we should generate KASAN_SHADOW_OFFSET in the Makefile directly
using some awk snippet/script (we are going to get a 47-bit VA as well
with 16KB page configuration):
---------8<-----------------
#!/bin/awk -f
BEGIN {
# 32-bit arithmetics
va_bits = ARGV[1] - 32
va_start = and(0xffffffff, lshift(0xffffffff, va_bits))
shadow_end = va_start + lshift(1, va_bits - 3)
shadow_offset = shadow_end - lshift(1, 64 - 3 - 32)
printf("0x%x00000000\n", shadow_offset)
}
-------8<-----------------
Otherwise the code looks fine.
--
Catalin
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2015-07-22 15:49 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-22 10:30 [PATCH v3 0/5] KASAN for arm64 Andrey Ryabinin
2015-07-22 10:30 ` [PATCH v3 1/5] mm: kasan: introduce generic kasan_populate_zero_shadow() Andrey Ryabinin
2015-07-22 14:17 ` Catalin Marinas
2015-07-22 14:34 ` Andrey Ryabinin
2015-07-22 14:25 ` Alexey Klimov
2015-07-22 14:44 ` Andrey Ryabinin
2015-07-22 10:30 ` [PATCH v3 2/5] arm64: introduce VA_START macro - the first kernel virtual address Andrey Ryabinin
2015-07-22 14:21 ` Catalin Marinas
2015-07-22 10:30 ` [PATCH v3 3/5] arm64: move PGD_SIZE definition to pgalloc.h Andrey Ryabinin
2015-07-22 14:24 ` Catalin Marinas
2015-07-22 10:30 ` [PATCH v3 4/5] arm64: add KASAN support Andrey Ryabinin
2015-07-22 15:49 ` Catalin Marinas [this message]
2015-07-22 10:30 ` [PATCH v3 5/5] ARM64: kasan: print memory assignment Andrey Ryabinin
2015-07-22 14:24 ` Catalin Marinas
2015-07-22 14:44 ` [PATCH v3 0/5] KASAN for arm64 Alexey Klimov
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=20150722154941.GE16627@e104818-lin.cambridge.arm.com \
--to=catalin.marinas@arm.com \
--cc=a.ryabinin@samsung.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=dkeitel@codeaurora.org \
--cc=dvyukov@google.com \
--cc=glider@google.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=will.deacon@arm.com \
/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