diff options
| author | Andy Lutomirski <luto@kernel.org> | 2017-12-04 09:07:45 -0500 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2017-12-23 15:13:00 -0500 |
| commit | f7cfbee91559ca7e3e961a00ffac921208a115ad (patch) | |
| tree | 5057b5b52baccddbe6dd47b8a662305c1fda4c90 | |
| parent | 8d4b067895791ab9fdb1aadfc505f64d71239dd2 (diff) | |
x86/mm/pti: Share cpu_entry_area with user space page tables
Share the cpu entry area so the user space and kernel space page tables
have the same P4D page.
Signed-off-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: David Laight <David.Laight@aculab.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Eduardo Valentin <eduval@amazon.com>
Cc: Greg KH <gregkh@linuxfoundation.org>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Will Deacon <will.deacon@arm.com>
Cc: aliguori@amazon.com
Cc: daniel.gruss@iaik.tugraz.at
Cc: hughd@google.com
Cc: keescook@google.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
| -rw-r--r-- | arch/x86/mm/pti.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/arch/x86/mm/pti.c b/arch/x86/mm/pti.c index d58bcee470fc..59290356f19f 100644 --- a/arch/x86/mm/pti.c +++ b/arch/x86/mm/pti.c | |||
| @@ -265,6 +265,29 @@ pti_clone_pmds(unsigned long start, unsigned long end, pmdval_t clear) | |||
| 265 | } | 265 | } |
| 266 | 266 | ||
| 267 | /* | 267 | /* |
| 268 | * Clone a single p4d (i.e. a top-level entry on 4-level systems and a | ||
| 269 | * next-level entry on 5-level systems. | ||
| 270 | */ | ||
| 271 | static void __init pti_clone_p4d(unsigned long addr) | ||
| 272 | { | ||
| 273 | p4d_t *kernel_p4d, *user_p4d; | ||
| 274 | pgd_t *kernel_pgd; | ||
| 275 | |||
| 276 | user_p4d = pti_user_pagetable_walk_p4d(addr); | ||
| 277 | kernel_pgd = pgd_offset_k(addr); | ||
| 278 | kernel_p4d = p4d_offset(kernel_pgd, addr); | ||
| 279 | *user_p4d = *kernel_p4d; | ||
| 280 | } | ||
| 281 | |||
| 282 | /* | ||
| 283 | * Clone the CPU_ENTRY_AREA into the user space visible page table. | ||
| 284 | */ | ||
| 285 | static void __init pti_clone_user_shared(void) | ||
| 286 | { | ||
| 287 | pti_clone_p4d(CPU_ENTRY_AREA_BASE); | ||
| 288 | } | ||
| 289 | |||
| 290 | /* | ||
| 268 | * Initialize kernel page table isolation | 291 | * Initialize kernel page table isolation |
| 269 | */ | 292 | */ |
| 270 | void __init pti_init(void) | 293 | void __init pti_init(void) |
| @@ -273,4 +296,6 @@ void __init pti_init(void) | |||
| 273 | return; | 296 | return; |
| 274 | 297 | ||
| 275 | pr_info("enabled\n"); | 298 | pr_info("enabled\n"); |
| 299 | |||
| 300 | pti_clone_user_shared(); | ||
| 276 | } | 301 | } |
