[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] x86: drop MEMORY_GUARD
commit fdf01494560219d10f92ce3419a5551e3ce5fe4f Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Wed Dec 15 10:23:51 2021 +0100 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Wed Dec 15 10:23:51 2021 +0100 x86: drop MEMORY_GUARD The functions it guards are dead code. Worse, while intended to exist in debug builds only, as of commit bacbf0cb7349 ("build: convert debug to Kconfig") they also get compiled in release builds. The remaining uses in show_stack_overflow() aren't really related to any memory guarding anymore - with CET-SS support the stacks now get set up the same in debug and release builds. Drop them as well; there's no harm providing the information there in all cases. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- xen/arch/x86/include/asm/config.h | 4 ---- xen/arch/x86/include/asm/mm.h | 8 -------- xen/arch/x86/mm.c | 30 ------------------------------ xen/arch/x86/traps.c | 4 ---- 4 files changed, 46 deletions(-) diff --git a/xen/arch/x86/include/asm/config.h b/xen/arch/x86/include/asm/config.h index 883c2ef0df..de20642524 100644 --- a/xen/arch/x86/include/asm/config.h +++ b/xen/arch/x86/include/asm/config.h @@ -57,10 +57,6 @@ #define NR_hypercalls 64 -#ifndef NDEBUG -#define MEMORY_GUARD -#endif - #define STACK_ORDER 3 #define STACK_SIZE (PAGE_SIZE << STACK_ORDER) diff --git a/xen/arch/x86/include/asm/mm.h b/xen/arch/x86/include/asm/mm.h index cb90527499..5dbcee8696 100644 --- a/xen/arch/x86/include/asm/mm.h +++ b/xen/arch/x86/include/asm/mm.h @@ -530,14 +530,6 @@ extern struct rangeset *mmio_ro_ranges; #define compat_pfn_to_cr3(pfn) (((unsigned)(pfn) << 12) | ((unsigned)(pfn) >> 20)) #define compat_cr3_to_pfn(cr3) (((unsigned)(cr3) >> 12) | ((unsigned)(cr3) << 20)) -#ifdef MEMORY_GUARD -void memguard_guard_range(void *p, unsigned long l); -void memguard_unguard_range(void *p, unsigned long l); -#else -#define memguard_guard_range(_p,_l) ((void)0) -#define memguard_unguard_range(_p,_l) ((void)0) -#endif - void memguard_guard_stack(void *p); void memguard_unguard_stack(void *p); diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index 4a9ac8d5e6..1397f83e41 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -6109,36 +6109,6 @@ void free_perdomain_mappings(struct domain *d) d->arch.perdomain_l3_pg = NULL; } -#ifdef MEMORY_GUARD - -static void __memguard_change_range(void *p, unsigned long l, int guard) -{ - unsigned long _p = (unsigned long)p; - unsigned long _l = (unsigned long)l; - unsigned int flags = __PAGE_HYPERVISOR_RW | MAP_SMALL_PAGES; - - /* Ensure we are dealing with a page-aligned whole number of pages. */ - ASSERT(IS_ALIGNED(_p, PAGE_SIZE)); - ASSERT(IS_ALIGNED(_l, PAGE_SIZE)); - - if ( guard ) - flags &= ~_PAGE_PRESENT; - - map_pages_to_xen(_p, virt_to_mfn(p), PFN_DOWN(_l), flags); -} - -void memguard_guard_range(void *p, unsigned long l) -{ - __memguard_change_range(p, l, 1); -} - -void memguard_unguard_range(void *p, unsigned long l) -{ - __memguard_change_range(p, l, 0); -} - -#endif - static void write_sss_token(unsigned long *ptr) { /* diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c index 2ddcd95dce..df7ffc448b 100644 --- a/xen/arch/x86/traps.c +++ b/xen/arch/x86/traps.c @@ -642,15 +642,12 @@ void show_stack_overflow(unsigned int cpu, const struct cpu_user_regs *regs) { unsigned long esp = regs->rsp; unsigned long curr_stack_base = esp & ~(STACK_SIZE - 1); -#ifdef MEMORY_GUARD unsigned long esp_top, esp_bottom; -#endif if ( _p(curr_stack_base) != stack_base[cpu] ) printk("Current stack base %p differs from expected %p\n", _p(curr_stack_base), stack_base[cpu]); -#ifdef MEMORY_GUARD esp_bottom = (esp | (STACK_SIZE - 1)) + 1; esp_top = esp_bottom - PRIMARY_STACK_SIZE; @@ -678,7 +675,6 @@ void show_stack_overflow(unsigned int cpu, const struct cpu_user_regs *regs) _show_trace(esp, regs->rbp); printk("\n"); -#endif } void show_execution_state(const struct cpu_user_regs *regs) -- generated by git-patchbot for /home/xen/git/xen.git#staging
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |