Skip to content

Commit 61a6bd8

Browse files
joergroedelKAGA-KOKO
authored andcommitted
Revert "x86/mm/legacy: Populate the user page-table with user pgd's"
This reverts commit 1f40a46. It turned out that this patch is not sufficient to enable PTI on 32 bit systems with legacy 2-level page-tables. In this paging mode the huge-page PTEs are in the top-level page-table directory, where also the mirroring to the user-space page-table happens. So every huge PTE exits twice, in the kernel and in the user page-table. That means that accessed/dirty bits need to be fetched from two PTEs in this mode to be safe, but this is not trivial to implement because it needs changes to generic code just for the sake of enabling PTI with 32-bit legacy paging. As all systems that need PTI should support PAE anyway, remove support for PTI when 32-bit legacy paging is used. Fixes: 7757d60 ('x86/pti: Allow CONFIG_PAGE_TABLE_ISOLATION for x86_32') Reported-by: Meelis Roos <mroos@linux.ee> Signed-off-by: Joerg Roedel <jroedel@suse.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: hpa@zytor.com Cc: linux-mm@kvack.org Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Andy Lutomirski <luto@kernel.org> Cc: Dave Hansen <dave.hansen@intel.com> Cc: Borislav Petkov <bp@alien8.de> Cc: Andrea Arcangeli <aarcange@redhat.com> Link: https://lkml.kernel.org/r/1536922754-31379-1-git-send-email-joro@8bytes.org
1 parent cf40361 commit 61a6bd8

File tree

2 files changed

+1
-10
lines changed

2 files changed

+1
-10
lines changed

arch/x86/include/asm/pgtable-2level.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ static inline void native_set_pte(pte_t *ptep , pte_t pte)
1919

2020
static inline void native_set_pmd(pmd_t *pmdp, pmd_t pmd)
2121
{
22-
#ifdef CONFIG_PAGE_TABLE_ISOLATION
23-
pmd.pud.p4d.pgd = pti_set_user_pgtbl(&pmdp->pud.p4d.pgd, pmd.pud.p4d.pgd);
24-
#endif
2522
*pmdp = pmd;
2623
}
2724

@@ -61,9 +58,6 @@ static inline pte_t native_ptep_get_and_clear(pte_t *xp)
6158
#ifdef CONFIG_SMP
6259
static inline pmd_t native_pmdp_get_and_clear(pmd_t *xp)
6360
{
64-
#ifdef CONFIG_PAGE_TABLE_ISOLATION
65-
pti_set_user_pgtbl(&xp->pud.p4d.pgd, __pgd(0));
66-
#endif
6761
return __pmd(xchg((pmdval_t *)xp, 0));
6862
}
6963
#else
@@ -73,9 +67,6 @@ static inline pmd_t native_pmdp_get_and_clear(pmd_t *xp)
7367
#ifdef CONFIG_SMP
7468
static inline pud_t native_pudp_get_and_clear(pud_t *xp)
7569
{
76-
#ifdef CONFIG_PAGE_TABLE_ISOLATION
77-
pti_set_user_pgtbl(&xp->p4d.pgd, __pgd(0));
78-
#endif
7970
return __pud(xchg((pudval_t *)xp, 0));
8071
}
8172
#else

security/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ config SECURITY_NETWORK
5757
config PAGE_TABLE_ISOLATION
5858
bool "Remove the kernel mapping in user mode"
5959
default y
60-
depends on X86 && !UML
60+
depends on (X86_64 || X86_PAE) && !UML
6161
help
6262
This feature reduces the number of hardware side channels by
6363
ensuring that the majority of kernel addresses are not mapped

0 commit comments

Comments
 (0)