Re: [PATCH v4 1/1] x86_64: fix KASan shadow region page tables

From: Ingo Molnar
Date: Wed Jun 03 2015 - 03:44:56 EST



* Alexander Popov <alpopov@xxxxxxxxxxxxxx> wrote:

> #ifdef CONFIG_KASAN
> void __init kasan_map_early_shadow(pgd_t *pgd);
> +void __init kasan_early_init(void);
> void __init kasan_init(void);
> #else
> static inline void kasan_map_early_shadow(pgd_t *pgd) { }
> +static inline void kasan_early_init(void) { }
> static inline void kasan_init(void) { }
> #endif
>
> diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
> index 2b55ee6..e9a84a1 100644
> --- a/arch/x86/kernel/head64.c
> +++ b/arch/x86/kernel/head64.c
> @@ -161,11 +161,15 @@ asmlinkage __visible void __init x86_64_start_kernel(char * real_mode_data)
> /* Kill off the identity-map trampoline */
> reset_early_page_tables();
>
> - kasan_map_early_shadow(early_level4_pgt);
> -
> - /* clear bss before set_intr_gate with early_idt_handler */
> + /*
> + * Clear bss before kasan_early_init and set_intr_gate
> + * with early_idt_handler
> + */
> clear_bss();
>
> + kasan_early_init();
> + kasan_map_early_shadow(early_level4_pgt);

So why isn't kasan_map_early_shadow() called in kasan_early_init()?

High level x86 init code should not be polluted with too many low level details.

Thanks,

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/