CONFIG_DMB_TRAP diff
Hello again (last one until Monday - I promise),
With Lamont's wisdom, I implemented support for Date Memory Break trap.
This enables the kernel programmer to capture the evil code which stomps on other people's "private" data. Only works for stores through virtual addresses. gsc_writeX() and DMA will still bypass this mechanism.
pb, dhd, (or some equivalent deity), could you review/commit this code? Or tell me it's ok to commit?
I've touched:
arch/parisc/config.in
arch/parisc/kernel/entry.S
arch/parisc/mm/kmap.c
include/asm-parisc/pgtable.h
thanks,
grant
Index: arch/parisc/config.in
===================================================================
RCS file: /home/cvs/parisc/linux/arch/parisc/config.in,v retrieving revision 1.25
config.in +6 -2
@@ -16,8 +16,12 @@ endmenu mainmenu_option next_comment comment 'General options' -# bool 'Symmetric multi-processing support' CONFIG_SMP -define_bool CONFIG_SMP n +bool 'Symmetric multi-processing support' CONFIG_SMP +# define_bool CONFIG_SMP n + +# One needs to tweak dmb_trap_11 code in entry.S to match. +# Not tested for 64-bit kernel. +bool 'Debug support for Data Memory Break Trap' CONFIG_DMB_TRAP bool 'Kernel Debugger support' CONFIG_KWDB # define_bool CONFIG_KWDB n
Index: arch/parisc/kernel/entry.S
===================================================================
RCS file: /home/cvs/parisc/linux/arch/parisc/kernel/entry.S,v retrieving revision 1.53
entry.S +63 -3
107 lines not on this page · raw message
Index: arch/parisc/mm/kmap.c
===================================================================
RCS file: /home/cvs/parisc/linux/arch/parisc/mm/kmap.c,v retrieving revision 1.3
kmap.c +13 -1
@@ -43,7 +43,16 @@ static void unmap_cached_pte(pte_t * pte }#endif +#ifdef CONFIG_DMB_TRAP /* These two routines should probably check a few things... */ +void set_data_memory_break (pte_t * pte,unsigned long arg) +{ +pte_val (*pte) |= _PAGE_DMB; +} + +#endif + +/* These two routines should probably check a few things... */ static void set_uncached (pte_t * pte,unsigned long arg) {pte_val (*pte) |= _PAGE_NO_CACHE;
@@ -106,7 +115,10 @@ static inline void iterate_pmd(pgd_t * d }while (address < end); } -static void iterate_pages (unsigned long address,unsigned long size, +#ifndef CONFIG_DMB_TRAP +static +#endif +void iterate_pages (unsigned long address,unsigned long size,pte_iterator_t op,unsigned long arg) {pgd_t *dir;
Index: include/asm-parisc/pgtable.h
===================================================================
RCS file: /home/cvs/parisc/linux/include/asm-parisc/pgtable.h,v retrieving revision 1.29
pgtable.h +4 -0
@@ -109,6 +109,10 @@ extern void *vmalloc_start;#define _PAGE_USER 0x400/* Software: User accessable page */ #define _PAGE_USER_BIT 21/* Needs to agree with _PAGE_USER above */ /* 0x800 still available */ +#ifdef CONFIG_DMB_TRAP +#define _PAGE_DMB 0x800/* Data Memory Break Trap */ +#define _PAGE_DMB_BIT 20/* Data Memory Break Trap */ +#endif #ifdef __ASSEMBLY__#define _PGB_ (x) (1 << (63 - (x)))