Loading drivers/misc/lkdtm.h +4 −1 Original line number Diff line number Diff line #ifndef __LKDTM_H #define __LKDTM_H #define pr_fmt(fmt) "lkdtm: " fmt #include <linux/kernel.h> /* lkdtm_bugs.c */ void __init lkdtm_bugs_init(int *recur_param); void lkdtm_PANIC(void); Loading Loading @@ -53,5 +57,4 @@ void lkdtm_USERCOPY_STACK_FRAME_FROM(void); void lkdtm_USERCOPY_STACK_BEYOND(void); void lkdtm_USERCOPY_KERNEL(void); #endif drivers/misc/lkdtm_bugs.c +1 −5 Original line number Diff line number Diff line Loading @@ -4,12 +4,8 @@ * lockups) along with other things that don't fit well into existing LKDTM * test source files. */ #define pr_fmt(fmt) "lkdtm: " fmt #include <linux/kernel.h> #include <linux/sched.h> #include "lkdtm.h" #include <linux/sched.h> /* * Make sure our attempts to over run the kernel stack doesn't trigger Loading drivers/misc/lkdtm_core.c +37 −35 Original line number Diff line number Diff line Loading @@ -30,9 +30,7 @@ * * See Documentation/fault-injection/provoke-crashes.txt for instructions */ #define pr_fmt(fmt) "lkdtm: " fmt #include <linux/kernel.h> #include "lkdtm.h" #include <linux/fs.h> #include <linux/module.h> #include <linux/buffer_head.h> Loading @@ -49,16 +47,16 @@ #include <linux/ide.h> #endif #include "lkdtm.h" #define DEFAULT_COUNT 10 static void lkdtm_handler(void); static int lkdtm_debugfs_open(struct inode *inode, struct file *file); static ssize_t lkdtm_debugfs_read(struct file *f, char __user *user_buf, size_t count, loff_t *off); static ssize_t direct_entry(struct file *f, const char __user *user_buf, size_t count, loff_t *off); #ifdef CONFIG_KPROBES static void lkdtm_handler(void); static ssize_t lkdtm_debugfs_entry(struct file *f, const char __user *user_buf, size_t count, loff_t *off); Loading Loading @@ -128,7 +126,7 @@ static int jp_generic_ide_ioctl(ide_drive_t *drive, struct file *file, return 0; } # endif #endif /* Crash points */ struct crashpoint { Loading Loading @@ -238,10 +236,6 @@ static struct jprobe *lkdtm_jprobe; struct crashpoint *lkdtm_crashpoint; struct crashtype *lkdtm_crashtype; /* Global crash counter and spinlock. */ static int crash_count = DEFAULT_COUNT; static DEFINE_SPINLOCK(crash_count_lock); /* Module parameters */ static int recur_count = -1; module_param(recur_count, int, 0644); Loading Loading @@ -285,29 +279,6 @@ static noinline void lkdtm_do_action(struct crashtype *crashtype) crashtype->func(); } /* Called by jprobe entry points. */ static void lkdtm_handler(void) { unsigned long flags; bool do_it = false; BUG_ON(!lkdtm_crashpoint || !lkdtm_crashtype); spin_lock_irqsave(&crash_count_lock, flags); crash_count--; pr_info("Crash point %s of type %s hit, trigger in %d rounds\n", lkdtm_crashpoint->name, lkdtm_crashtype->name, crash_count); if (crash_count == 0) { do_it = true; crash_count = cpoint_count; } spin_unlock_irqrestore(&crash_count_lock, flags); if (do_it) lkdtm_do_action(lkdtm_crashtype); } static int lkdtm_register_cpoint(struct crashpoint *crashpoint, struct crashtype *crashtype) { Loading Loading @@ -337,6 +308,34 @@ static int lkdtm_register_cpoint(struct crashpoint *crashpoint, return ret; } #ifdef CONFIG_KPROBES /* Global crash counter and spinlock. */ static int crash_count = DEFAULT_COUNT; static DEFINE_SPINLOCK(crash_count_lock); /* Called by jprobe entry points. */ static void lkdtm_handler(void) { unsigned long flags; bool do_it = false; BUG_ON(!lkdtm_crashpoint || !lkdtm_crashtype); spin_lock_irqsave(&crash_count_lock, flags); crash_count--; pr_info("Crash point %s of type %s hit, trigger in %d rounds\n", lkdtm_crashpoint->name, lkdtm_crashtype->name, crash_count); if (crash_count == 0) { do_it = true; crash_count = cpoint_count; } spin_unlock_irqrestore(&crash_count_lock, flags); if (do_it) lkdtm_do_action(lkdtm_crashtype); } static ssize_t lkdtm_debugfs_entry(struct file *f, const char __user *user_buf, size_t count, loff_t *off) Loading Loading @@ -374,6 +373,7 @@ static ssize_t lkdtm_debugfs_entry(struct file *f, return count; } #endif /* Generic read callback that just prints out the available crash types */ static ssize_t lkdtm_debugfs_read(struct file *f, char __user *user_buf, Loading Loading @@ -476,8 +476,10 @@ static int __init lkdtm_module_init(void) } } #ifdef CONFIG_KPROBES /* Set crash count. */ crash_count = cpoint_count; #endif /* Handle test-specific initialization. */ lkdtm_bugs_init(&recur_count); Loading drivers/misc/lkdtm_heap.c +1 −5 Original line number Diff line number Diff line Loading @@ -2,12 +2,8 @@ * This is for all the tests relating directly to heap memory, including * page allocation and slab allocations. */ #define pr_fmt(fmt) "lkdtm: " fmt #include <linux/kernel.h> #include <linux/slab.h> #include "lkdtm.h" #include <linux/slab.h> /* * This tries to stay within the next largest power-of-2 kmalloc cache Loading drivers/misc/lkdtm_perms.c +1 −5 Original line number Diff line number Diff line Loading @@ -3,17 +3,13 @@ * permissions: non-executable regions, non-writable regions, and * even non-readable regions. */ #define pr_fmt(fmt) "lkdtm: " fmt #include <linux/kernel.h> #include "lkdtm.h" #include <linux/slab.h> #include <linux/vmalloc.h> #include <linux/mman.h> #include <linux/uaccess.h> #include <asm/cacheflush.h> #include "lkdtm.h" /* Whether or not to fill the target memory area with do_nothing(). */ #define CODE_WRITE true #define CODE_AS_IS false Loading Loading
drivers/misc/lkdtm.h +4 −1 Original line number Diff line number Diff line #ifndef __LKDTM_H #define __LKDTM_H #define pr_fmt(fmt) "lkdtm: " fmt #include <linux/kernel.h> /* lkdtm_bugs.c */ void __init lkdtm_bugs_init(int *recur_param); void lkdtm_PANIC(void); Loading Loading @@ -53,5 +57,4 @@ void lkdtm_USERCOPY_STACK_FRAME_FROM(void); void lkdtm_USERCOPY_STACK_BEYOND(void); void lkdtm_USERCOPY_KERNEL(void); #endif
drivers/misc/lkdtm_bugs.c +1 −5 Original line number Diff line number Diff line Loading @@ -4,12 +4,8 @@ * lockups) along with other things that don't fit well into existing LKDTM * test source files. */ #define pr_fmt(fmt) "lkdtm: " fmt #include <linux/kernel.h> #include <linux/sched.h> #include "lkdtm.h" #include <linux/sched.h> /* * Make sure our attempts to over run the kernel stack doesn't trigger Loading
drivers/misc/lkdtm_core.c +37 −35 Original line number Diff line number Diff line Loading @@ -30,9 +30,7 @@ * * See Documentation/fault-injection/provoke-crashes.txt for instructions */ #define pr_fmt(fmt) "lkdtm: " fmt #include <linux/kernel.h> #include "lkdtm.h" #include <linux/fs.h> #include <linux/module.h> #include <linux/buffer_head.h> Loading @@ -49,16 +47,16 @@ #include <linux/ide.h> #endif #include "lkdtm.h" #define DEFAULT_COUNT 10 static void lkdtm_handler(void); static int lkdtm_debugfs_open(struct inode *inode, struct file *file); static ssize_t lkdtm_debugfs_read(struct file *f, char __user *user_buf, size_t count, loff_t *off); static ssize_t direct_entry(struct file *f, const char __user *user_buf, size_t count, loff_t *off); #ifdef CONFIG_KPROBES static void lkdtm_handler(void); static ssize_t lkdtm_debugfs_entry(struct file *f, const char __user *user_buf, size_t count, loff_t *off); Loading Loading @@ -128,7 +126,7 @@ static int jp_generic_ide_ioctl(ide_drive_t *drive, struct file *file, return 0; } # endif #endif /* Crash points */ struct crashpoint { Loading Loading @@ -238,10 +236,6 @@ static struct jprobe *lkdtm_jprobe; struct crashpoint *lkdtm_crashpoint; struct crashtype *lkdtm_crashtype; /* Global crash counter and spinlock. */ static int crash_count = DEFAULT_COUNT; static DEFINE_SPINLOCK(crash_count_lock); /* Module parameters */ static int recur_count = -1; module_param(recur_count, int, 0644); Loading Loading @@ -285,29 +279,6 @@ static noinline void lkdtm_do_action(struct crashtype *crashtype) crashtype->func(); } /* Called by jprobe entry points. */ static void lkdtm_handler(void) { unsigned long flags; bool do_it = false; BUG_ON(!lkdtm_crashpoint || !lkdtm_crashtype); spin_lock_irqsave(&crash_count_lock, flags); crash_count--; pr_info("Crash point %s of type %s hit, trigger in %d rounds\n", lkdtm_crashpoint->name, lkdtm_crashtype->name, crash_count); if (crash_count == 0) { do_it = true; crash_count = cpoint_count; } spin_unlock_irqrestore(&crash_count_lock, flags); if (do_it) lkdtm_do_action(lkdtm_crashtype); } static int lkdtm_register_cpoint(struct crashpoint *crashpoint, struct crashtype *crashtype) { Loading Loading @@ -337,6 +308,34 @@ static int lkdtm_register_cpoint(struct crashpoint *crashpoint, return ret; } #ifdef CONFIG_KPROBES /* Global crash counter and spinlock. */ static int crash_count = DEFAULT_COUNT; static DEFINE_SPINLOCK(crash_count_lock); /* Called by jprobe entry points. */ static void lkdtm_handler(void) { unsigned long flags; bool do_it = false; BUG_ON(!lkdtm_crashpoint || !lkdtm_crashtype); spin_lock_irqsave(&crash_count_lock, flags); crash_count--; pr_info("Crash point %s of type %s hit, trigger in %d rounds\n", lkdtm_crashpoint->name, lkdtm_crashtype->name, crash_count); if (crash_count == 0) { do_it = true; crash_count = cpoint_count; } spin_unlock_irqrestore(&crash_count_lock, flags); if (do_it) lkdtm_do_action(lkdtm_crashtype); } static ssize_t lkdtm_debugfs_entry(struct file *f, const char __user *user_buf, size_t count, loff_t *off) Loading Loading @@ -374,6 +373,7 @@ static ssize_t lkdtm_debugfs_entry(struct file *f, return count; } #endif /* Generic read callback that just prints out the available crash types */ static ssize_t lkdtm_debugfs_read(struct file *f, char __user *user_buf, Loading Loading @@ -476,8 +476,10 @@ static int __init lkdtm_module_init(void) } } #ifdef CONFIG_KPROBES /* Set crash count. */ crash_count = cpoint_count; #endif /* Handle test-specific initialization. */ lkdtm_bugs_init(&recur_count); Loading
drivers/misc/lkdtm_heap.c +1 −5 Original line number Diff line number Diff line Loading @@ -2,12 +2,8 @@ * This is for all the tests relating directly to heap memory, including * page allocation and slab allocations. */ #define pr_fmt(fmt) "lkdtm: " fmt #include <linux/kernel.h> #include <linux/slab.h> #include "lkdtm.h" #include <linux/slab.h> /* * This tries to stay within the next largest power-of-2 kmalloc cache Loading
drivers/misc/lkdtm_perms.c +1 −5 Original line number Diff line number Diff line Loading @@ -3,17 +3,13 @@ * permissions: non-executable regions, non-writable regions, and * even non-readable regions. */ #define pr_fmt(fmt) "lkdtm: " fmt #include <linux/kernel.h> #include "lkdtm.h" #include <linux/slab.h> #include <linux/vmalloc.h> #include <linux/mman.h> #include <linux/uaccess.h> #include <asm/cacheflush.h> #include "lkdtm.h" /* Whether or not to fill the target memory area with do_nothing(). */ #define CODE_WRITE true #define CODE_AS_IS false Loading