On Tue, Jan 16, 2018 at 8:36 AM, Joerg Roedel <j...@8bytes.org> wrote:
> From: Joerg Roedel <jroe...@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 <jroe...@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?

Reply via email to