|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v2 2/2] 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.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
v2: New.
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -799,7 +799,8 @@ static int setup_cpu_root_pgt(unsigned i
/* 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);
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -5576,6 +5576,14 @@ void memguard_unguard_stack(void *p)
STACK_SIZE - PRIMARY_STACK_SIZE - IST_MAX *
PAGE_SIZE);
}
+bool memguard_is_stack_guard_page(unsigned long addr)
+{
+ addr &= STACK_SIZE - 1;
+
+ return addr >= IST_MAX * PAGE_SIZE &&
+ addr < STACK_SIZE - PRIMARY_STACK_SIZE;
+}
+
void arch_dump_shared_mem_info(void)
{
printk("Shared frames %u -- Saved frames %u\n",
--- a/xen/include/asm-x86/mm.h
+++ b/xen/include/asm-x86/mm.h
@@ -519,6 +519,7 @@ void memguard_unguard_range(void *p, uns
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;
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |