[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACT4Y+ZPUF8D7xB0PuDC+uqE5sY3=+rv-Fic2NsZX-ZWz+V0jg@mail.gmail.com>
Date: Mon, 13 Mar 2017 08:25:42 +0100
From: Dmitry Vyukov <dvyukov@...gle.com>
To: "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Andrew Morton <akpm@...ux-foundation.org>,
"x86@...nel.org" <x86@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Arnd Bergmann <arnd@...db.de>,
"H. Peter Anvin" <hpa@...or.com>, Andi Kleen <ak@...ux.intel.com>,
Dave Hansen <dave.hansen@...el.com>,
Andy Lutomirski <luto@...capital.net>,
Michal Hocko <mhocko@...e.com>, linux-arch@...r.kernel.org,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
LKML <linux-kernel@...r.kernel.org>,
Andrey Ryabinin <aryabinin@...tuozzo.com>
Subject: Re: [PATCH 19/26] x86/kasan: extend to support 5-level paging
On Mon, Mar 13, 2017 at 6:50 AM, Kirill A. Shutemov
<kirill.shutemov@...ux.intel.com> wrote:
> This patch bring support for non-folded additional page table level.
>
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@...ux.intel.com>
> Cc: Dmitry Vyukov <dvyukov@...gle.com
+Andrey Ryabinin
> ---
> arch/x86/mm/kasan_init_64.c | 18 ++++++++++++++++--
> 1 file changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/mm/kasan_init_64.c b/arch/x86/mm/kasan_init_64.c
> index 733f8ba6a01f..bcabc56e0dc4 100644
> --- a/arch/x86/mm/kasan_init_64.c
> +++ b/arch/x86/mm/kasan_init_64.c
> @@ -50,8 +50,18 @@ static void __init kasan_map_early_shadow(pgd_t *pgd)
> unsigned long end = KASAN_SHADOW_END;
>
> for (i = pgd_index(start); start < end; i++) {
> - pgd[i] = __pgd(__pa_nodebug(kasan_zero_pud)
> - | _KERNPG_TABLE);
> + switch (CONFIG_PGTABLE_LEVELS) {
> + case 4:
> + pgd[i] = __pgd(__pa_nodebug(kasan_zero_pud) |
> + _KERNPG_TABLE);
> + break;
> + case 5:
> + pgd[i] = __pgd(__pa_nodebug(kasan_zero_p4d) |
> + _KERNPG_TABLE);
> + break;
> + default:
> + BUILD_BUG();
> + }
> start += PGDIR_SIZE;
> }
> }
> @@ -79,6 +89,7 @@ void __init kasan_early_init(void)
> pteval_t pte_val = __pa_nodebug(kasan_zero_page) | __PAGE_KERNEL;
> pmdval_t pmd_val = __pa_nodebug(kasan_zero_pte) | _KERNPG_TABLE;
> pudval_t pud_val = __pa_nodebug(kasan_zero_pmd) | _KERNPG_TABLE;
> + p4dval_t p4d_val = __pa_nodebug(kasan_zero_pud) | _KERNPG_TABLE;
>
> for (i = 0; i < PTRS_PER_PTE; i++)
> kasan_zero_pte[i] = __pte(pte_val);
> @@ -89,6 +100,9 @@ void __init kasan_early_init(void)
> for (i = 0; i < PTRS_PER_PUD; i++)
> kasan_zero_pud[i] = __pud(pud_val);
>
> + for (i = 0; CONFIG_PGTABLE_LEVELS >= 5 && i < PTRS_PER_P4D; i++)
> + kasan_zero_p4d[i] = __p4d(p4d_val);
> +
> kasan_map_early_shadow(early_level4_pgt);
> kasan_map_early_shadow(init_level4_pgt);
> }
> --
> 2.11.0
>
Powered by blists - more mailing lists