Re: [patch 39/60] x86/mm/kpti: Share cpu_entry_area PMDs

From: Borislav Petkov
Date: Wed Dec 06 2017 - 16:18:17 EST


On Mon, Dec 04, 2017 at 03:07:45PM +0100, Thomas Gleixner wrote:
> From: Andy Lutomirski <luto@xxxxxxxxxx>
>
> Share the FIX_USR_SHARED PMDs so the user space and kernel space page
> tables have the same PMD page.
>
> [ tglx: Made it use the FIX_USR_SHARED range so later additions
> are covered automatically ]
>
> Signed-off-by: Andy Lutomirski <luto@xxxxxxxxxx>
> Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> ---
> arch/x86/mm/kpti.c | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> --- a/arch/x86/mm/kpti.c
> +++ b/arch/x86/mm/kpti.c
> @@ -167,6 +167,23 @@ kpti_clone_pmds(unsigned long start, uns
> }
>
> /*
> + * Clone the populated PMDs of the user shared fixmaps into the user space
> + * visible page table.
> + */
> +static void __init kpti_clone_user_shared(void)
> +{
> + unsigned long bot, top;
> +
> + bot = __fix_to_virt(FIX_USR_SHARED_BOTTOM);
> + top = __fix_to_virt(FIX_USR_SHARED_TOP) + PAGE_SIZE;
> +
> + /* Top of the user shared block must be PMD-aligned. */
> + WARN_ON(top & ~PMD_MASK);

Or

WARN_ON(top & (PMD_SIZE - 1));


Otherwise:

Reviewed-by: Borislav Petkov <bp@xxxxxxx>

--
Regards/Gruss,
Boris.

SUSE Linux GmbH, GF: Felix ImendÃrffer, Jane Smithard, Graham Norton, HRB 21284 (AG NÃrnberg)
--