[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALCETrX+j+XNrO=bGHcVirmUdg0iWXF+b5j4EJoi98pN5U5zzA@mail.gmail.com>
Date: Mon, 4 Dec 2017 14:28:46 -0800
From: Andy Lutomirski <luto@...nel.org>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: LKML <linux-kernel@...r.kernel.org>, X86 ML <x86@...nel.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Andy Lutomirsky <luto@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Dave Hansen <dave.hansen@...el.com>,
Borislav Petkov <bpetkov@...e.de>,
Greg KH <gregkh@...uxfoundation.org>,
Kees Cook <keescook@...gle.com>,
Hugh Dickins <hughd@...gle.com>,
Brian Gerst <brgerst@...il.com>,
Josh Poimboeuf <jpoimboe@...hat.com>,
Denys Vlasenko <dvlasenk@...hat.com>,
Rik van Riel <riel@...hat.com>,
Boris Ostrovsky <boris.ostrovsky@...cle.com>,
Juergen Gross <jgross@...e.com>,
David Laight <David.Laight@...lab.com>,
Eduardo Valentin <eduval@...zon.com>, aliguori@...zon.com,
Will Deacon <will.deacon@....com>,
Daniel Gruss <daniel.gruss@...k.tugraz.at>,
Dave Hansen <dave.hansen@...ux.intel.com>
Subject: Re: [patch 35/60] x86/espfix: Ensure that ESPFIX is visible in user PGD
On Mon, Dec 4, 2017 at 6:07 AM, Thomas Gleixner <tglx@...utronix.de> wrote:
> From: Dave Hansen <dave.hansen@...ux.intel.com>
>
> Clone the ESPFIX alias mapping area so the entry/exit code has access to it
> even with the user space page tables.
>
> [ tglx: Remove the per cpu user mapped oddity ]
>
> Signed-off-by: Dave Hansen <dave.hansen@...ux.intel.com>
> Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
>
> ---
> arch/x86/kernel/espfix_64.c | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> --- a/arch/x86/kernel/espfix_64.c
> +++ b/arch/x86/kernel/espfix_64.c
> @@ -129,6 +129,22 @@ void __init init_espfix_bsp(void)
> p4d = p4d_alloc(&init_mm, pgd, ESPFIX_BASE_ADDR);
> p4d_populate(&init_mm, p4d, espfix_pud_page);
>
> + /*
> + * Just copy the top-level PGD that is mapping the espfix area to
> + * ensure it is mapped into the user page tables.
> + *
> + * For 5-level paging, the espfix pgd was populated when
> + * kpti_init() pre-populated all the pgd entries. The above
> + * p4d_alloc() would never do anything and the p4d_populate() would
> + * be done to a p4d already mapped in the userspace pgd.
> + */
Is this actually true? From brief inspection, it doesn't seem to be
the case, nor do I see why it should be true.
> +#ifdef CONFIG_KERNEL_PAGE_TABLE_ISOLATION
> + if (CONFIG_PGTABLE_LEVELS <= 4) {
> + set_pgd(kernel_to_user_pgdp(pgd),
> + __pgd(_KERNPG_TABLE | (p4d_pfn(*p4d) << PAGE_SHIFT)));
> + }
> +#endif
> +
> /* Randomize the locations */
> init_espfix_random();
>
>
>
Powered by blists - more mailing lists