From: Andrey Ryabinin <aryabinin@virtuozzo.com> To: Andrew Morton <akpm@linux-foundation.org> Cc: Alexander Potapenko <glider@google.com>, Dmitry Vyukov <dvyukov@google.com>, <kasan-dev@googlegroups.com>, <linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>, Andrey Ryabinin <aryabinin@virtuozzo.com>, Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>, <x86@kernel.org> Subject: [PATCH 2/4] x86/kasan: don't allocate extra shadow memory Date: Thu, 1 Jun 2017 19:23:36 +0300 [thread overview] Message-ID: <20170601162338.23540-2-aryabinin@virtuozzo.com> (raw) In-Reply-To: <20170601162338.23540-1-aryabinin@virtuozzo.com> We used to read several bytes of the shadow memory in advance. Therefore additional shadow memory mapped to prevent crash if speculative load would happen near the end of the mapped shadow memory. Now we don't have such speculative loads, so we no longer need to map additional shadow memory. Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: x86@kernel.org --- arch/x86/mm/kasan_init_64.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/arch/x86/mm/kasan_init_64.c b/arch/x86/mm/kasan_init_64.c index 0c7d8129bed6..39231a9c981a 100644 --- a/arch/x86/mm/kasan_init_64.c +++ b/arch/x86/mm/kasan_init_64.c @@ -23,12 +23,7 @@ static int __init map_range(struct range *range) start = (unsigned long)kasan_mem_to_shadow(pfn_to_kaddr(range->start)); end = (unsigned long)kasan_mem_to_shadow(pfn_to_kaddr(range->end)); - /* - * end + 1 here is intentional. We check several shadow bytes in advance - * to slightly speed up fastpath. In some rare cases we could cross - * boundary of mapped shadow, so we just map some more here. - */ - return vmemmap_populate(start, end + 1, NUMA_NO_NODE); + return vmemmap_populate(start, end, NUMA_NO_NODE); } static void __init clear_pgds(unsigned long start, -- 2.13.0
WARNING: multiple messages have this Message-ID (diff)
From: Andrey Ryabinin <aryabinin@virtuozzo.com> To: Andrew Morton <akpm@linux-foundation.org> Cc: Alexander Potapenko <glider@google.com>, Dmitry Vyukov <dvyukov@google.com>, kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Ryabinin <aryabinin@virtuozzo.com>, Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>, x86@kernel.org Subject: [PATCH 2/4] x86/kasan: don't allocate extra shadow memory Date: Thu, 1 Jun 2017 19:23:36 +0300 [thread overview] Message-ID: <20170601162338.23540-2-aryabinin@virtuozzo.com> (raw) In-Reply-To: <20170601162338.23540-1-aryabinin@virtuozzo.com> We used to read several bytes of the shadow memory in advance. Therefore additional shadow memory mapped to prevent crash if speculative load would happen near the end of the mapped shadow memory. Now we don't have such speculative loads, so we no longer need to map additional shadow memory. Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: x86@kernel.org --- arch/x86/mm/kasan_init_64.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/arch/x86/mm/kasan_init_64.c b/arch/x86/mm/kasan_init_64.c index 0c7d8129bed6..39231a9c981a 100644 --- a/arch/x86/mm/kasan_init_64.c +++ b/arch/x86/mm/kasan_init_64.c @@ -23,12 +23,7 @@ static int __init map_range(struct range *range) start = (unsigned long)kasan_mem_to_shadow(pfn_to_kaddr(range->start)); end = (unsigned long)kasan_mem_to_shadow(pfn_to_kaddr(range->end)); - /* - * end + 1 here is intentional. We check several shadow bytes in advance - * to slightly speed up fastpath. In some rare cases we could cross - * boundary of mapped shadow, so we just map some more here. - */ - return vmemmap_populate(start, end + 1, NUMA_NO_NODE); + return vmemmap_populate(start, end, NUMA_NO_NODE); } static void __init clear_pgds(unsigned long start, -- 2.13.0 -- 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:[~2017-06-01 16:22 UTC|newest] Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-06-01 16:23 [PATCH 1/4] mm/kasan: get rid of speculative shadow checks Andrey Ryabinin 2017-06-01 16:23 ` Andrey Ryabinin 2017-06-01 16:23 ` Andrey Ryabinin [this message] 2017-06-01 16:23 ` [PATCH 2/4] x86/kasan: don't allocate extra shadow memory Andrey Ryabinin 2017-06-01 16:23 ` [PATCH 3/4] arm64/kasan: " Andrey Ryabinin 2017-06-01 16:23 ` Andrey Ryabinin 2017-06-01 16:23 ` Andrey Ryabinin 2017-06-01 16:34 ` Mark Rutland 2017-06-01 16:34 ` Mark Rutland 2017-06-01 16:34 ` Mark Rutland 2017-06-01 16:45 ` Dmitry Vyukov 2017-06-01 16:45 ` Dmitry Vyukov 2017-06-01 16:45 ` Dmitry Vyukov 2017-06-01 16:52 ` Mark Rutland 2017-06-01 16:52 ` Mark Rutland 2017-06-01 16:52 ` Mark Rutland 2017-06-01 16:59 ` Andrey Ryabinin 2017-06-01 16:59 ` Andrey Ryabinin 2017-06-01 16:59 ` Andrey Ryabinin 2017-06-01 17:00 ` Andrey Ryabinin 2017-06-01 17:00 ` Andrey Ryabinin 2017-06-01 17:00 ` Andrey Ryabinin 2017-06-01 17:05 ` Dmitry Vyukov 2017-06-01 17:05 ` Dmitry Vyukov 2017-06-01 17:05 ` Dmitry Vyukov 2017-06-01 17:38 ` Dmitry Vyukov 2017-06-01 17:38 ` Dmitry Vyukov 2017-06-01 17:38 ` Dmitry Vyukov 2017-06-01 16:23 ` [PATCH 4/4] mm/kasan: Add support for memory hotplug Andrey Ryabinin 2017-06-01 16:23 ` Andrey Ryabinin 2017-06-01 17:45 ` [PATCH 1/4] mm/kasan: get rid of speculative shadow checks Dmitry Vyukov 2017-06-01 17:45 ` Dmitry Vyukov
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=20170601162338.23540-2-aryabinin@virtuozzo.com \ --to=aryabinin@virtuozzo.com \ --cc=akpm@linux-foundation.org \ --cc=dvyukov@google.com \ --cc=glider@google.com \ --cc=hpa@zytor.com \ --cc=kasan-dev@googlegroups.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-mm@kvack.org \ --cc=mingo@redhat.com \ --cc=tglx@linutronix.de \ --cc=x86@kernel.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: linkBe 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.