From: a.ryabinin@samsung.com (Andrey Ryabinin)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 5/7] arm64: add KASAN support
Date: Mon, 27 Jul 2015 20:53:26 +0300 [thread overview]
Message-ID: <55B67016.6090402@samsung.com> (raw)
In-Reply-To: <20150727155922.GB350@e104818-lin.cambridge.arm.com>
On 07/27/2015 06:59 PM, Catalin Marinas wrote:
> On Fri, Jul 24, 2015 at 07:41:57PM +0300, Andrey Ryabinin wrote:
>> diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
>> index 4d2a925..2cacf55 100644
>> --- a/arch/arm64/Makefile
>> +++ b/arch/arm64/Makefile
>> @@ -40,6 +40,12 @@ else
>> TEXT_OFFSET := 0x00080000
>> endif
>>
>> +# KASAN_SHADOW_OFFSET = VA_START + (1 << (VA_BITS - 3)) - (1 << 61)
>> +KASAN_SHADOW_OFFSET := $(shell printf "0x%x\n" $$(( \
>> + (-1 << $(CONFIG_ARM64_VA_BITS)) \
>> + + (1 << ($(CONFIG_ARM64_VA_BITS) - 3)) \
>> + - (1 << (64 - 3)) )) )
>
> Does this work with any POSIX shell? Do we always have a 64-bit type?
> As I wasn't sure about this, I suggested awk (or perl).
>
Ok, It will be safer to use 32-bit arithmetic.
I've checked this on 32-bit bash, however this doesn't guarantee that it works with
any other version of bash or another shell.
>> +static void __init clear_pgds(unsigned long start,
>> + unsigned long end)
>> +{
>> + /*
>> + * Remove references to kasan page tables from
>> + * swapper_pg_dir. pgd_clear() can't be used
>> + * here because it's nop on 2,3-level pagetable setups
>> + */
>> + for (; start && start < end; start += PGDIR_SIZE)
>> + set_pgd(pgd_offset_k(start), __pgd(0));
>> +}
>
> I don't think we need the "start" check, just "start < end". Do you
> expect a start == 0 (or overflow)?
Right, we don't need this.
WARNING: multiple messages have this Message-ID (diff)
From: Andrey Ryabinin <a.ryabinin@samsung.com>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>,
linux-arm-kernel@lists.infradead.org,
Alexey Klimov <klimov.linux@gmail.com>,
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 v4 5/7] arm64: add KASAN support
Date: Mon, 27 Jul 2015 20:53:26 +0300 [thread overview]
Message-ID: <55B67016.6090402@samsung.com> (raw)
In-Reply-To: <20150727155922.GB350@e104818-lin.cambridge.arm.com>
On 07/27/2015 06:59 PM, Catalin Marinas wrote:
> On Fri, Jul 24, 2015 at 07:41:57PM +0300, Andrey Ryabinin wrote:
>> diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
>> index 4d2a925..2cacf55 100644
>> --- a/arch/arm64/Makefile
>> +++ b/arch/arm64/Makefile
>> @@ -40,6 +40,12 @@ else
>> TEXT_OFFSET := 0x00080000
>> endif
>>
>> +# KASAN_SHADOW_OFFSET = VA_START + (1 << (VA_BITS - 3)) - (1 << 61)
>> +KASAN_SHADOW_OFFSET := $(shell printf "0x%x\n" $$(( \
>> + (-1 << $(CONFIG_ARM64_VA_BITS)) \
>> + + (1 << ($(CONFIG_ARM64_VA_BITS) - 3)) \
>> + - (1 << (64 - 3)) )) )
>
> Does this work with any POSIX shell? Do we always have a 64-bit type?
> As I wasn't sure about this, I suggested awk (or perl).
>
Ok, It will be safer to use 32-bit arithmetic.
I've checked this on 32-bit bash, however this doesn't guarantee that it works with
any other version of bash or another shell.
>> +static void __init clear_pgds(unsigned long start,
>> + unsigned long end)
>> +{
>> + /*
>> + * Remove references to kasan page tables from
>> + * swapper_pg_dir. pgd_clear() can't be used
>> + * here because it's nop on 2,3-level pagetable setups
>> + */
>> + for (; start && start < end; start += PGDIR_SIZE)
>> + set_pgd(pgd_offset_k(start), __pgd(0));
>> +}
>
> I don't think we need the "start" check, just "start < end". Do you
> expect a start == 0 (or overflow)?
Right, we don't need this.
--
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>
WARNING: multiple messages have this Message-ID (diff)
From: Andrey Ryabinin <a.ryabinin@samsung.com>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>,
linux-arm-kernel@lists.infradead.org,
Alexey Klimov <klimov.linux@gmail.com>,
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 v4 5/7] arm64: add KASAN support
Date: Mon, 27 Jul 2015 20:53:26 +0300 [thread overview]
Message-ID: <55B67016.6090402@samsung.com> (raw)
In-Reply-To: <20150727155922.GB350@e104818-lin.cambridge.arm.com>
On 07/27/2015 06:59 PM, Catalin Marinas wrote:
> On Fri, Jul 24, 2015 at 07:41:57PM +0300, Andrey Ryabinin wrote:
>> diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
>> index 4d2a925..2cacf55 100644
>> --- a/arch/arm64/Makefile
>> +++ b/arch/arm64/Makefile
>> @@ -40,6 +40,12 @@ else
>> TEXT_OFFSET := 0x00080000
>> endif
>>
>> +# KASAN_SHADOW_OFFSET = VA_START + (1 << (VA_BITS - 3)) - (1 << 61)
>> +KASAN_SHADOW_OFFSET := $(shell printf "0x%x\n" $$(( \
>> + (-1 << $(CONFIG_ARM64_VA_BITS)) \
>> + + (1 << ($(CONFIG_ARM64_VA_BITS) - 3)) \
>> + - (1 << (64 - 3)) )) )
>
> Does this work with any POSIX shell? Do we always have a 64-bit type?
> As I wasn't sure about this, I suggested awk (or perl).
>
Ok, It will be safer to use 32-bit arithmetic.
I've checked this on 32-bit bash, however this doesn't guarantee that it works with
any other version of bash or another shell.
>> +static void __init clear_pgds(unsigned long start,
>> + unsigned long end)
>> +{
>> + /*
>> + * Remove references to kasan page tables from
>> + * swapper_pg_dir. pgd_clear() can't be used
>> + * here because it's nop on 2,3-level pagetable setups
>> + */
>> + for (; start && start < end; start += PGDIR_SIZE)
>> + set_pgd(pgd_offset_k(start), __pgd(0));
>> +}
>
> I don't think we need the "start" check, just "start < end". Do you
> expect a start == 0 (or overflow)?
Right, we don't need this.
next prev parent reply other threads:[~2015-07-27 17:53 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-24 16:41 [PATCH v4 0/7] KASAN for arm64 Andrey Ryabinin
2015-07-24 16:41 ` Andrey Ryabinin
2015-07-24 16:41 ` Andrey Ryabinin
2015-07-24 16:41 ` [PATCH v4 1/7] x86/kasan: generate KASAN_SHADOW_OFFSET in Makefile Andrey Ryabinin
2015-07-24 16:41 ` Andrey Ryabinin
2015-07-24 16:41 ` Andrey Ryabinin
2015-07-27 16:40 ` Catalin Marinas
2015-07-27 16:40 ` Catalin Marinas
2015-07-27 16:40 ` Catalin Marinas
2015-07-27 17:52 ` Andrey Ryabinin
2015-07-27 17:52 ` Andrey Ryabinin
2015-07-27 17:52 ` Andrey Ryabinin
2015-07-24 16:41 ` [PATCH v4 2/7] mm: kasan: introduce generic kasan_populate_zero_shadow() Andrey Ryabinin
2015-07-24 16:41 ` Andrey Ryabinin
2015-07-24 16:41 ` Andrey Ryabinin
2015-07-27 14:23 ` Yury
2015-07-27 14:23 ` Yury
2015-07-27 14:23 ` Yury
2015-07-27 17:52 ` Andrey Ryabinin
2015-07-27 17:52 ` Andrey Ryabinin
2015-07-27 17:52 ` Andrey Ryabinin
2015-08-10 6:01 ` Aneesh Kumar K.V
2015-08-10 6:01 ` Aneesh Kumar K.V
2015-08-10 6:01 ` Aneesh Kumar K.V
2015-08-10 12:00 ` Andrey Ryabinin
2015-08-10 12:00 ` Andrey Ryabinin
2015-08-10 12:00 ` Andrey Ryabinin
2015-07-24 16:41 ` [PATCH v4 3/7] arm64: introduce VA_START macro - the first kernel virtual address Andrey Ryabinin
2015-07-24 16:41 ` Andrey Ryabinin
2015-07-24 16:41 ` Andrey Ryabinin
2015-07-24 16:41 ` [PATCH v4 4/7] arm64: move PGD_SIZE definition to pgalloc.h Andrey Ryabinin
2015-07-24 16:41 ` Andrey Ryabinin
2015-07-24 16:41 ` Andrey Ryabinin
2015-07-24 16:41 ` [PATCH v4 5/7] arm64: add KASAN support Andrey Ryabinin
2015-07-24 16:41 ` Andrey Ryabinin
2015-07-24 16:41 ` Andrey Ryabinin
2015-07-27 15:59 ` Catalin Marinas
2015-07-27 15:59 ` Catalin Marinas
2015-07-27 15:59 ` Catalin Marinas
2015-07-27 17:53 ` Andrey Ryabinin [this message]
2015-07-27 17:53 ` Andrey Ryabinin
2015-07-27 17:53 ` Andrey Ryabinin
2015-07-24 16:41 ` [PATCH v4 6/7] ARM64: kasan: print memory assignment Andrey Ryabinin
2015-07-24 16:41 ` Andrey Ryabinin
2015-07-24 16:41 ` Andrey Ryabinin
2015-07-24 16:41 ` [PATCH v4 7/7] x86/kasan: switch to generic kasan_populate_zero_shadow() Andrey Ryabinin
2015-07-24 16:41 ` Andrey Ryabinin
2015-07-24 16:41 ` Andrey Ryabinin
2015-07-27 16:57 ` Catalin Marinas
2015-07-27 16:57 ` Catalin Marinas
2015-07-27 16:57 ` Catalin Marinas
2015-07-27 17:53 ` Andrey Ryabinin
2015-07-27 17:53 ` Andrey Ryabinin
2015-07-27 17:53 ` Andrey Ryabinin
2015-07-27 8:13 ` [PATCH v4 0/7] KASAN for arm64 Andrey Ryabinin
2015-07-27 8:13 ` Andrey Ryabinin
2015-07-27 8:13 ` Andrey Ryabinin
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=55B67016.6090402@samsung.com \
--to=a.ryabinin@samsung.com \
--cc=linux-arm-kernel@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.