x86/xpti: don't map stack guard pages

Other than for the main mappings, don't even do this in release builds,
as there are no huge page shattering concerns here.

Note that since we don't run on the restructed page tables while HVM
guests execute, the non-present mappings won't trigger the triple fault
issue AMD SVM is susceptible to with our current placement of STGI vs
TR loading.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
master commit: d303784b68
master date: 2018-03-06 16:46:57 +0100
This commit is contained in:
Jan Beulich committed 2018-03-20 14:39:01 +01:00
1 parent f7bf4d230a
commit 3cadc8bb84
3 files changed
+11 -1

No files matched your search

+8
View File
@@ -6841,6 +6841,14 @@ void memguard_unguard_stack(void *p)
memguard_unguard_range(p, PAGE_SIZE);
}
bool memguard_is_stack_guard_page(unsigned long addr)
{
addr &= STACK_SIZE - 1;
return addr >= STACK_SIZE - PRIMARY_STACK_SIZE - PAGE_SIZE &&
addr < STACK_SIZE - PRIMARY_STACK_SIZE;
}
void arch_dump_shared_mem_info(void)
{
printk("Shared frames %u -- Saved frames %u\n",
+2 -1
View File
@@ -790,7 +790,8 @@ static int setup_cpu_root_pgt(unsigned int cpu)
/* Install direct map page table entries for stack, IDT, and TSS. */
for ( off = rc = 0; !rc && off < STACK_SIZE; off += PAGE_SIZE )
rc = clone_mapping(__va(__pa(stack_base[cpu])) + off, rpt);
if ( !memguard_is_stack_guard_page(off) )
rc = clone_mapping(__va(__pa(stack_base[cpu])) + off, rpt);
if ( !rc )
rc = clone_mapping(idt_tables[cpu], rpt);
+1
View File
@@ -500,6 +500,7 @@ void memguard_unguard_range(void *p, unsigned long l);
void memguard_guard_stack(void *p);
void memguard_unguard_stack(void *p);
bool __attribute_const__ memguard_is_stack_guard_page(unsigned long addr);
struct mmio_ro_emulate_ctxt {
unsigned long cr2;
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.