[Fault-injection-developer] fith kernel patch based on 2.5.47 + kprobes-2-4in1-1
Status: Alpha
Brought to you by:
rustyl
From: Zhuang, L. <lou...@in...> - 2002-11-15 10:02:08
|
Hi Folks, This is a kernel patch needed by FITH, which should be applied on 2. 5.47 kernel plus kprobes-2-4in1-1 - Louis diff -Nur -X /root/dontdiff 47-kp/Makefile 47-kp-fi/Makefile --- 47-kp/Makefile Mon Nov 11 11:28:04 2002 +++ 47-kp-fi/Makefile Fri Nov 15 17:25:20 2002 @@ -1,7 +1,7 @@ VERSION = 2 PATCHLEVEL = 5 SUBLEVEL = 47 -EXTRAVERSION = +EXTRAVERSION =kp-fi # *DOCUMENTATION* # To see a list of typical targets execute "make help" diff -Nur -X /root/dontdiff 47-kp/arch/i386/Kconfig 47-kp-fi/arch/i386/Kconfig --- 47-kp/arch/i386/Kconfig Fri Nov 15 17:22:47 2002 +++ 47-kp-fi/arch/i386/Kconfig Fri Nov 15 17:31:49 2002 @@ -1562,11 +1562,20 @@ config DEBUGREG bool "Global Debug Registers" - depend on DEBUG_KERNEL + depends on DEBUG_KERNEL + help config KWATCH bool "Kwatch points" - depend on DEBUGREG + depends on DEBUGREG + help + +config FI + bool "Fault Injection" + depends on KPROBES + help + Say Y here if you want to enable Fault Injection (FI) mechanism. + The FI can monitor MMIO/IO access in kernel. config DEBUG_STACKOVERFLOW bool "Check for stack overflows" diff -Nur -X /root/dontdiff 47-kp/arch/i386/kernel/i386_ksyms.c 47-kp-fi/arch/i386/kernel/i386_ksyms.c --- 47-kp/arch/i386/kernel/i386_ksyms.c Mon Nov 11 11:28:32 2002 +++ 47-kp-fi/arch/i386/kernel/i386_ksyms.c Fri Nov 15 17:25:20 2002 @@ -32,6 +32,7 @@ #include <asm/tlbflush.h> #include <asm/nmi.h> #include <asm/edd.h> +#include <asm/fi.h> extern void dump_thread(struct pt_regs *, struct user *); extern spinlock_t rtc_lock; @@ -216,3 +217,9 @@ EXPORT_SYMBOL(edd); EXPORT_SYMBOL(eddnr); #endif + +#ifdef CONFIG_FI +EXPORT_SYMBOL(irq_desc); +EXPORT_SYMBOL(fi_page_fault); +EXPORT_SYMBOL(fi_post_page_fault); +#endif diff -Nur -X /root/dontdiff 47-kp/arch/i386/kernel/traps.c 47-kp-fi/arch/i386/kernel/traps.c --- 47-kp/arch/i386/kernel/traps.c Fri Nov 15 17:20:45 2002 +++ 47-kp-fi/arch/i386/kernel/traps.c Fri Nov 15 17:25:20 2002 @@ -47,6 +47,7 @@ #include <asm/smp.h> #include <asm/pgalloc.h> #include <asm/arch_hooks.h> +#include <asm/fi.h> #include <linux/irq.h> #include <linux/module.h> @@ -564,6 +565,9 @@ return 0; } +int (*fi_post_page_fault) (unsigned long condition, + struct pt_regs *reg); + /* * Our handling of the processor debug registers is non-trivial. * We do not clear them on entry and exit from the kernel. Therefore @@ -599,7 +603,10 @@ if (kwatch_handler(condition, regs)) return 1; - +#ifdef CONFIG_FI + if (fi_post_page_fault && fi_post_page_fault(condition, regs)) + return 1; +#endif /* Interrupts not disabled for normal trap handling. */ restore_interrupts(regs); diff -Nur -X /root/dontdiff 47-kp/arch/i386/mm/fault.c 47-kp-fi/arch/i386/mm/fault.c --- 47-kp/arch/i386/mm/fault.c Thu Nov 14 15:22:14 2002 +++ 47-kp-fi/arch/i386/mm/fault.c Fri Nov 15 17:25:20 2002 @@ -26,6 +26,7 @@ #include <asm/pgalloc.h> #include <asm/hardirq.h> #include <asm/desc.h> +#include <asm/fi.h> extern void die(const char *,struct pt_regs *,long); @@ -139,6 +140,7 @@ } asmlinkage void do_invalid_op(struct pt_regs *, unsigned long); +int (*fi_page_fault) ( struct pt_regs *regs, unsigned long address); /* * This routine handles page faults. It determines the address, @@ -166,7 +168,10 @@ if (kprobe_running() && kprobe_fault_handler(regs, 14)) return; - +#ifdef CONFIG_FI + if (fi_page_fault && fi_page_fault(regs, address)) + return; +#endif /* It's safe to allow irq's after cr2 has been saved */ if (regs->eflags & X86_EFLAGS_IF) local_irq_enable(); diff -Nur -X /root/dontdiff 47-kp/drivers/net/e100/e100.h 47-kp-fi/drivers/net/e100/e100.h --- 47-kp/drivers/net/e100/e100.h Mon Nov 11 11:28:07 2002 +++ 47-kp-fi/drivers/net/e100/e100.h Fri Nov 15 17:25:20 2002 @@ -100,7 +100,7 @@ #define E100_MAX_NIC 16 -#define E100_MAX_SCB_WAIT 100 /* Max udelays in wait_scb */ +#define E100_MAX_SCB_WAIT 5000 /* Max udelays in wait_scb */ #define E100_MAX_CU_IDLE_WAIT 50 /* Max udelays in wait_cus_idle */ /* HWI feature related constant */ diff -Nur -X /root/dontdiff 47-kp/include/asm-i386/fi.h 47-kp-fi/include/asm-i386/fi.h --- 47-kp/include/asm-i386/fi.h Thu Jan 1 08:00:00 1970 +++ 47-kp-fi/include/asm-i386/fi.h Fri Nov 15 17:25:20 2002 @@ -0,0 +1,8 @@ +#ifndef _ASM_FI_H +#define _ASM_FI_H +#ifdef CONFIG_FI +extern int (*fi_page_fault) ( struct pt_regs *regs, unsigned long address); +extern int (*fi_post_page_fault) (unsigned long condition, + struct pt_regs *reg); +#endif +#endif /* _ASM_FI_H */ diff -Nur -X /root/dontdiff 47-kp/kernel/ksyms.c 47-kp-fi/kernel/ksyms.c --- 47-kp/kernel/ksyms.c Mon Nov 11 11:28:02 2002 +++ 47-kp-fi/kernel/ksyms.c Fri Nov 15 17:25:20 2002 @@ -601,3 +601,7 @@ /* debug */ EXPORT_SYMBOL(dump_stack); + +#ifdef CONFIG_FI +EXPORT_SYMBOL(module_list); +#endif |