mirror of
https://github.com/torvalds/linux.git
synced 2024-12-19 09:32:32 +00:00
5d5aa3cfca
Currently KASAN shadow region page tables created without respect of physical offset (phys_base). This causes kernel halt when phys_base is not zero. So let's initialize KASAN shadow region page tables in kasan_early_init() using __pa_nodebug() which considers phys_base. This patch also separates x86_64_start_kernel() from KASAN low level details by moving kasan_map_early_shadow(init_level4_pgt) into kasan_early_init(). Remove the comment before clear_bss() which stopped bringing much profit to the code readability. Otherwise describing all the new order dependencies would be too verbose. Signed-off-by: Alexander Popov <alpopov@ptsecurity.com> Signed-off-by: Andrey Ryabinin <a.ryabinin@samsung.com> Cc: <stable@vger.kernel.org> # 4.0+ Cc: Alexander Potapenko <glider@google.com> Cc: Andrey Konovalov <adech.fo@gmail.com> Cc: Borislav Petkov <bp@alien8.de> Cc: Dmitry Vyukov <dvyukov@google.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/1435828178-10975-3-git-send-email-a.ryabinin@samsung.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
28 lines
748 B
C
28 lines
748 B
C
#ifndef _ASM_X86_KASAN_H
|
|
#define _ASM_X86_KASAN_H
|
|
|
|
/*
|
|
* Compiler uses shadow offset assuming that addresses start
|
|
* from 0. Kernel addresses don't start from 0, so shadow
|
|
* for kernel really starts from compiler's shadow offset +
|
|
* 'kernel address space start' >> KASAN_SHADOW_SCALE_SHIFT
|
|
*/
|
|
#define KASAN_SHADOW_START (KASAN_SHADOW_OFFSET + \
|
|
(0xffff800000000000ULL >> 3))
|
|
/* 47 bits for kernel address -> (47 - 3) bits for shadow */
|
|
#define KASAN_SHADOW_END (KASAN_SHADOW_START + (1ULL << (47 - 3)))
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
#ifdef CONFIG_KASAN
|
|
void __init kasan_early_init(void);
|
|
void __init kasan_init(void);
|
|
#else
|
|
static inline void kasan_early_init(void) { }
|
|
static inline void kasan_init(void) { }
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#endif
|