lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.20.1801162158350.2366@nanos>
Date:   Tue, 16 Jan 2018 22:03:19 +0100 (CET)
From:   Thomas Gleixner <tglx@...utronix.de>
To:     Joerg Roedel <joro@...tes.org>
cc:     Ingo Molnar <mingo@...nel.org>, "H . Peter Anvin" <hpa@...or.com>,
        x86@...nel.org, linux-kernel@...r.kernel.org, linux-mm@...ck.org,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Andy Lutomirski <luto@...nel.org>,
        Dave Hansen <dave.hansen@...el.com>,
        Josh Poimboeuf <jpoimboe@...hat.com>,
        Juergen Gross <jgross@...e.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Borislav Petkov <bp@...en8.de>, Jiri Kosina <jkosina@...e.cz>,
        Boris Ostrovsky <boris.ostrovsky@...cle.com>,
        Brian Gerst <brgerst@...il.com>,
        David Laight <David.Laight@...lab.com>,
        Denys Vlasenko <dvlasenk@...hat.com>,
        Eduardo Valentin <eduval@...zon.com>,
        Greg KH <gregkh@...uxfoundation.org>,
        Will Deacon <will.deacon@....com>, aliguori@...zon.com,
        daniel.gruss@...k.tugraz.at, hughd@...gle.com, keescook@...gle.com,
        Andrea Arcangeli <aarcange@...hat.com>,
        Waiman Long <llong@...hat.com>, jroedel@...e.de
Subject: Re: [PATCH 09/16] x86/mm/pti: Clone CPU_ENTRY_AREA on PMD level on
 x86_32

On Tue, 16 Jan 2018, Joerg Roedel wrote:
> +#ifdef CONFIG_X86_64
>  /*
>   * Clone a single p4d (i.e. a top-level entry on 4-level systems and a
>   * next-level entry on 5-level systems.
> @@ -322,13 +323,29 @@ static void __init pti_clone_p4d(unsigned long addr)
>  	kernel_p4d = p4d_offset(kernel_pgd, addr);
>  	*user_p4d = *kernel_p4d;
>  }
> +#endif
>  
>  /*
>   * Clone the CPU_ENTRY_AREA into the user space visible page table.
>   */
>  static void __init pti_clone_user_shared(void)
>  {
> +#ifdef CONFIG_X86_32
> +	/*
> +	 * On 32 bit PAE systems with 1GB of Kernel address space there is only
> +	 * one pgd/p4d for the whole kernel. Cloning that would map the whole
> +	 * address space into the user page-tables, making PTI useless. So clone
> +	 * the page-table on the PMD level to prevent that.
> +	 */
> +	unsigned long start, end;
> +
> +	start = CPU_ENTRY_AREA_BASE;
> +	end   = start + (PAGE_SIZE * CPU_ENTRY_AREA_PAGES);
> +
> +	pti_clone_pmds(start, end, _PAGE_GLOBAL);
> +#else
>  	pti_clone_p4d(CPU_ENTRY_AREA_BASE);
> +#endif
>  }

Just a minor nit. You already wrap pti_clone_p4d() into X86_64. So it would
be cleaner to do:

  	kernel_p4d = p4d_offset(kernel_pgd, addr);
  	*user_p4d = *kernel_p4d;
}

static void __init pti_clone_user_shared(void)
{
  	pti_clone_p4d(CPU_ENTRY_AREA_BASE);
}

#else /* CONFIG_X86_64 */

/*
 * Big fat comment.
 */
static void __init pti_clone_user_shared(void)
{
	....
}
#endif /* !CONFIG_X86_64 */

Thanks,

	tglx

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ