lkml.org 
[lkml]   [2017]   [Nov]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2 06/18] x86/kasan/64: Teach KASAN about the cpu_entry_area
Date
The cpu_entry_area will contain stacks.  Make sure that KASAN has
appropriate shadow mappings for them.

Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: kasan-dev@googlegroups.com
Signed-off-by: Andy Lutomirski <luto@kernel.org>
---
arch/x86/mm/kasan_init_64.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/arch/x86/mm/kasan_init_64.c b/arch/x86/mm/kasan_init_64.c
index 99dfed6dfef8..43d376687315 100644
--- a/arch/x86/mm/kasan_init_64.c
+++ b/arch/x86/mm/kasan_init_64.c
@@ -330,7 +330,14 @@ void __init kasan_init(void)
early_pfn_to_nid(__pa(_stext)));

kasan_populate_zero_shadow(kasan_mem_to_shadow((void *)MODULES_END),
- (void *)KASAN_SHADOW_END);
+ kasan_mem_to_shadow((void *)(__fix_to_virt(FIX_CPU_ENTRY_AREA_BOTTOM))));
+
+ kasan_populate_shadow((unsigned long)kasan_mem_to_shadow((void *)(__fix_to_virt(FIX_CPU_ENTRY_AREA_BOTTOM))),
+ (unsigned long)kasan_mem_to_shadow((void *)(__fix_to_virt(FIX_CPU_ENTRY_AREA_TOP) + PAGE_SIZE)),
+ 0);
+
+ kasan_populate_zero_shadow(kasan_mem_to_shadow((void *)(__fix_to_virt(FIX_CPU_ENTRY_AREA_TOP) + PAGE_SIZE)),
+ (void *)KASAN_SHADOW_END);

load_cr3(init_top_pgt);
__flush_tlb_all();
--
2.13.6
\
 
 \ /
  Last update: 2017-11-22 05:47    [W:0.289 / U:0.892 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site