[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-id: <55687CDE.903@samsung.com>
Date: Fri, 29 May 2015 17:51:10 +0300
From: Andrey Ryabinin <a.ryabinin@...sung.com>
To: Alexander Popov <alpopov@...ecurity.com>
Cc: Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>,
Andrey Konovalov <adech.fo@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Kees Cook <keescook@...omium.org>,
"Peter Zijlstra (Intel)" <peterz@...radead.org>,
Andy Lutomirski <luto@...capital.net>,
Alexander Kuleshov <kuleshovmail@...il.com>,
Borislav Petkov <bp@...e.de>,
Denys Vlasenko <dvlasenk@...hat.com>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/1] x86_64: fix KASan shadow region page tables
On 05/29/2015 04:46 PM, Alexander Popov wrote:
> KASan shadow region page tables can't be filled statically because
> physical addresses in these page tables depend on phys_base.
> Initialize KASan shadow region page tables in kasan_early_init().
>
> Signed-off-by: Alexander Popov <alpopov@...ecurity.com>
> ---
Thanks. Couple comments bellow, otherwise looks good.
>
> -extern unsigned char kasan_zero_page[PAGE_SIZE];
> +static pud_t kasan_zero_pud[PTRS_PER_PUD] __page_aligned_data;
> +static pmd_t kasan_zero_pmd[PTRS_PER_PMD] __page_aligned_data;
> +static pte_t kasan_zero_pte[PTRS_PER_PTE] __page_aligned_data;
It's better to keep these in bss.
> +/*
> + * This page used as early shadow. We don't use empty_zero_page
> + * at early stages, stack instrumentation could write some garbage
> + * to this page.
> + * Latter we reuse it as zero shadow for large ranges of memory
> + * that allowed to access, but not instrumented by kasan
> + * (vmalloc/vmemmap ...).
> + */
> +static unsigned char kasan_zero_page[PAGE_SIZE] __page_aligned_bss;
>
> static int __init map_range(struct range *range)
> {
> @@ -166,6 +178,23 @@ static struct notifier_block kasan_die_notifier = {
> };
> #endif
>
> +void __init kasan_early_init(void)
> +{
> + int i;
> + pteval_t pte_val = __pa_nodebug(kasan_zero_page) | _KERNPG_TABLE;
Should be __PAGE_KERNEL.
Yes, currently kasan's ptes have _KERNPG_TABLE flags, but that is wrong.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists