Re: [PATCH 01/30] x86, mm: do not set _PAGE_USER for init_mm page tables

From: Borislav Petkov
Date: Thu Nov 09 2017 - 05:29:35 EST


On Wed, Nov 08, 2017 at 11:46:47AM -0800, Dave Hansen wrote:
>
> From: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
>
> init_mm is for kernel-exclusive use. If someone is allocating page
> tables for it, do not set _PAGE_USER on them.
>
> Signed-off-by: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
> Reviewed-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> Cc: Moritz Lipp <moritz.lipp@xxxxxxxxxxxxxx>
> Cc: Daniel Gruss <daniel.gruss@xxxxxxxxxxxxxx>
> Cc: Michael Schwarz <michael.schwarz@xxxxxxxxxxxxxx>
> Cc: Richard Fellner <richard.fellner@xxxxxxxxxxxxxxxxx>
> Cc: Andy Lutomirski <luto@xxxxxxxxxx>
> Cc: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
> Cc: Kees Cook <keescook@xxxxxxxxxx>
> Cc: Hugh Dickins <hughd@xxxxxxxxxx>
> Cc: x86@xxxxxxxxxx
> ---
>
> b/arch/x86/include/asm/pgalloc.h | 33 ++++++++++++++++++++++++++++-----
> 1 file changed, 28 insertions(+), 5 deletions(-)
>
> diff -puN arch/x86/include/asm/pgalloc.h~kaiser-prep-clear-_PAGE_USER-for-init_mm arch/x86/include/asm/pgalloc.h
> --- a/arch/x86/include/asm/pgalloc.h~kaiser-prep-clear-_PAGE_USER-for-init_mm 2017-11-08 10:45:25.928681403 -0800
> +++ b/arch/x86/include/asm/pgalloc.h 2017-11-08 10:45:25.931681403 -0800
> @@ -61,20 +61,37 @@ static inline void __pte_free_tlb(struct
> ___pte_free_tlb(tlb, pte);
> }
>
> +/*
> + * init_mm is for kernel-exclusive use. Any page tables that
> + * are seteup for it should not be usable by userspace.

s/seteup/setup/

--
Regards/Gruss,
Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.