lkml.org 
[lkml]   [2018]   [Jan]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 08/16] x86/pgtable/32: Allocate 8k page-tables when PTI is enabled
On Tue, Jan 16, 2018 at 8:36 AM, Joerg Roedel <joro@8bytes.org> wrote:
> From: Joerg Roedel <jroedel@suse.de>
>
> Allocate a kernel and a user page-table root when PTI is
> enabled. Also allocate a full page per root for PAEm because
> otherwise the bit to flip in cr3 to switch between them
> would be non-constant, which creates a lot of hassle.
> Keep that for a later optimization.
>
> Signed-off-by: Joerg Roedel <jroedel@suse.de>
> ---
> arch/x86/kernel/head_32.S | 23 ++++++++++++++++++-----
> arch/x86/mm/pgtable.c | 11 ++++++-----
> 2 files changed, 24 insertions(+), 10 deletions(-)
>
> diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S
> index c29020907886..fc550559bf58 100644
> --- a/arch/x86/kernel/head_32.S
> +++ b/arch/x86/kernel/head_32.S
> @@ -512,28 +512,41 @@ ENTRY(initial_code)
> ENTRY(setup_once_ref)
> .long setup_once
>
> +#ifdef CONFIG_PAGE_TABLE_ISOLATION
> +#define PGD_ALIGN (2 * PAGE_SIZE)
> +#define PTI_USER_PGD_FILL 1024
> +#else
> +#define PGD_ALIGN (PAGE_SIZE)
> +#define PTI_USER_PGD_FILL 0
> +#endif
> /*
> * BSS section
> */
> __PAGE_ALIGNED_BSS
> - .align PAGE_SIZE
> + .align PGD_ALIGN
> #ifdef CONFIG_X86_PAE
> .globl initial_pg_pmd
> initial_pg_pmd:
> .fill 1024*KPMDS,4,0
> + .fill PTI_USER_PGD_FILL,4,0

Couldn't this be simplified to just .align PGD_ALIGN, 0 without the .fill?

\
 
 \ /
  Last update: 2018-01-18 00:44    [W:0.200 / U:1.140 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site