x86: add hooks for kmemcheck on x86_64
PATCH 9/13 x86: add hooks for kmemcheck on x86_64
Quoted 1 line
From
a01667599a005303eb3f54b45d31346964b47ebfMon Sep 17 00:00:00 2001
From: Pekka Enberg <[email protected]>
Date: Fri, 4 Apr 2008 11:16:06 +0300
Subject: [PATCH 09/13] x86: add hooks for kmemcheck on x86_64
This makes the necessary changes for kmemcheck to work on x86_64.
Signed-off-by Pekka Enberg <[email protected]>
Signed-off-by Vegard Nossum <[email protected]>
--- arch/x86/kernel/traps_64.c | 9 +++++++++ include/asm-x86/pgtable_64.h | 6 ++++++ include/asm-x86/string_64.h | 1 + 3 files changed, 16 insertions(+), 0 deletions(-)
arch/x86/kernel/traps_64.c +9 -0
@@ -53,6 +53,7 @@#include <asm/proto.h> #include <asm/nmi.h> #include <asm/stacktrace.h> +#include <asm/kmemcheck.h> asmlinkage void divide_error(void); asmlinkage void debug(void);
@@ -911,6 +912,14 @@ asmlinkage void __kprobes do_debug(struct pt_regs * regs,get_debugreg (condition,6 ); +/* Catch kmemcheck conditions first of all! */ +if (condition &DR_STEP ) { +if (kmemcheck_active (regs)) { +kmemcheck_hide (regs); +return ; + } + } +/* * The processor cleared BTF, so don't mark that we need it set. */
include/asm-x86/pgtable_64.h +6 -0
@@ -169,6 +169,12 @@ static inline int pmd_bad(pmd_t pmd)#define pte_none (x) (!pte_val((x)))#define pte_present (x) (pte_val((x)) & (_PAGE_PRESENT | _PAGE_PROTNONE)) +#ifdef CONFIG_KMEMCHECK +#define pte_hidden (x) (pte_val((x)) & (_PAGE_HIDDEN)) +#else +#define pte_hidden (x) 0 +#endif +#define pages_to_mb (x) ((x) >> (20 - PAGE_SHIFT))/* FIXME: is this right? */ #define pte_page (x) pfn_to_page(pte_pfn((x)))#define pte_pfn (x) ((pte_val((x)) & __PHYSICAL_MASK) >> PAGE_SHIFT)
include/asm-x86/string_64.h +1 -0
@@ -45,6 +45,7 @@ extern void *__memcpy(void *to, const void *from, size_t len);#define __HAVE_ARCH_MEMSETvoid *memset (void *s,int c,size_t n); +void *__memset (void *s,int c,size_t n);#define __HAVE_ARCH_MEMMOVEvoid *memmove (void *dest,const void *src,size_t count);
Signature · 1 line
1.5.5.1