Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
forked fromtorvalds/linux

Commit445b69e

Browse files
hansendcKAGA-KOKO
authored andcommitted
x86/pti: Make unpoison of pgd for trusted boot work for real
The inital fix for trusted boot and PTI potentially misses the pgd clearingif pud_alloc() sets a PGD. It probably works in *practice* because for twoadjacent calls to map_tboot_page() that share a PGD entry, the first willclear NX, *then* allocate and set the PGD (without NX clear). The secondcall will *not* allocate but will clear the NX bit.Defer the NX clearing to a point after it is known that all top-levelallocations have occurred. Add a comment to clarify why.[ tglx: Massaged changelog ]Fixes:262b6b3 ("x86/tboot: Unbreak tboot with PTI enabled")Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>Signed-off-by: Thomas Gleixner <tglx@linutronix.de>Reviewed-by: Andrea Arcangeli <aarcange@redhat.com>Cc: Jon Masters <jcm@redhat.com>Cc: "Tim Chen" <tim.c.chen@linux.intel.com>Cc: gnomes@lxorguk.ukuu.org.ukCc: peterz@infradead.orgCc: ning.sun@intel.comCc: tboot-devel@lists.sourceforge.netCc: andi@firstfloor.orgCc: luto@kernel.orgCc: law@redhat.comCc: pbonzini@redhat.comCc: torvalds@linux-foundation.orgCc: gregkh@linux-foundation.orgCc: dwmw@amazon.co.ukCc: nickc@redhat.comCc: stable@vger.kernel.orgLink:https://lkml.kernel.org/r/20180110224939.2695CD47@viggo.jf.intel.com
1 parent612e8e9 commit445b69e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

‎arch/x86/kernel/tboot.c‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ static int map_tboot_page(unsigned long vaddr, unsigned long pfn,
127127
p4d=p4d_alloc(&tboot_mm,pgd,vaddr);
128128
if (!p4d)
129129
return-1;
130-
pgd->pgd &= ~_PAGE_NX;
131130
pud=pud_alloc(&tboot_mm,p4d,vaddr);
132131
if (!pud)
133132
return-1;
@@ -139,6 +138,17 @@ static int map_tboot_page(unsigned long vaddr, unsigned long pfn,
139138
return-1;
140139
set_pte_at(&tboot_mm,vaddr,pte,pfn_pte(pfn,prot));
141140
pte_unmap(pte);
141+
142+
/*
143+
* PTI poisons low addresses in the kernel page tables in the
144+
* name of making them unusable for userspace. To execute
145+
* code at such a low address, the poison must be cleared.
146+
*
147+
* Note: 'pgd' actually gets set in p4d_alloc() _or_
148+
* pud_alloc() depending on 4/5-level paging.
149+
*/
150+
pgd->pgd &= ~_PAGE_NX;
151+
142152
return0;
143153
}
144154

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp