Skip to content

Commit f490e07

Browse files
KAGA-KOKOPeter Zijlstra
authored andcommitted
x86/pti/32: Size initial_page_table correctly
Commit 945fd17 ("x86/cpu_entry_area: Sync cpu_entry_area to initial_page_table") introduced the sync for the initial page table for 32bit. sync_initial_page_table() uses clone_pgd_range() which does the update for the kernel page table. If PTI is enabled it also updates the user space page table counterpart, which is assumed to be in the next page after the target PGD. At this point in time 32-bit did not have PTI support, so the user space page table update was not taking place. The support for PTI on 32-bit which was introduced later on, did not take that into account and missed to add the user space counter part for the initial page table. As a consequence sync_initial_page_table() overwrites any data which is located in the page behing initial_page_table causing random failures, e.g. by corrupting doublefault_tss and wreckaging the doublefault handler on 32bit. Fix it by adding a "user" page table right after initial_page_table. Fixes: 7757d60 ("x86/pti: Allow CONFIG_PAGE_TABLE_ISOLATION for x86_32") Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Joerg Roedel <[email protected]> Cc: [email protected]
1 parent 3580d0b commit f490e07

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

arch/x86/kernel/head_32.S

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,16 @@ ENTRY(initial_page_table)
571571
# error "Kernel PMDs should be 1, 2 or 3"
572572
# endif
573573
.align PAGE_SIZE /* needs to be page-sized too */
574+
575+
#ifdef CONFIG_PAGE_TABLE_ISOLATION
576+
/*
577+
* PTI needs another page so sync_initial_pagetable() works correctly
578+
* and does not scribble over the data which is placed behind the
579+
* actual initial_page_table. See clone_pgd_range().
580+
*/
581+
.fill 1024, 4, 0
582+
#endif
583+
574584
#endif
575585

576586
.data

0 commit comments

Comments
 (0)