Skip to content

Commit fc2fbc8

Browse files
hansendcIngo Molnar
authored andcommitted
x86/mm/pti: Populate user PGD
In clone_pgd_range() copy the init user PGDs which cover the kernel half of the address space, so a process has all the required kernel mappings visible. [ tglx: Split out from the big kaiser dump and folded Andys simplification ] Signed-off-by: Dave Hansen <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Borislav Petkov <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Boris Ostrovsky <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Brian Gerst <[email protected]> Cc: David Laight <[email protected]> Cc: Denys Vlasenko <[email protected]> Cc: Eduardo Valentin <[email protected]> Cc: Greg KH <[email protected]> Cc: H. Peter Anvin <[email protected]> Cc: Josh Poimboeuf <[email protected]> Cc: Juergen Gross <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Will Deacon <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent d9e9a64 commit fc2fbc8

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

arch/x86/include/asm/pgtable.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1119,7 +1119,14 @@ static inline void pmdp_set_wrprotect(struct mm_struct *mm,
11191119
*/
11201120
static inline void clone_pgd_range(pgd_t *dst, pgd_t *src, int count)
11211121
{
1122-
memcpy(dst, src, count * sizeof(pgd_t));
1122+
memcpy(dst, src, count * sizeof(pgd_t));
1123+
#ifdef CONFIG_PAGE_TABLE_ISOLATION
1124+
if (!static_cpu_has(X86_FEATURE_PTI))
1125+
return;
1126+
/* Clone the user space pgd as well */
1127+
memcpy(kernel_to_user_pgdp(dst), kernel_to_user_pgdp(src),
1128+
count * sizeof(pgd_t));
1129+
#endif
11231130
}
11241131

11251132
#define PTE_SHIFT ilog2(PTRS_PER_PTE)

0 commit comments

Comments
 (0)