aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2013-07-08 13:01:32 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-07-25 01:47:20 -0400
commit274a5855c034800b8e9a6ca32bbf81298ae917d8 (patch)
tree8e0172fc6630f20746a336d969982b16a6ce5bb2 /drivers/misc
parent65892723c386d658234ffffa35789e68e0601982 (diff)
lkdtm: add "SPINLOCKUP" trigger
For additional lockup testing, add "SPINLOCKUP" to trigger a spinlock deadlock when triggered twice. Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/lkdtm.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/misc/lkdtm.c b/drivers/misc/lkdtm.c
index b1323fc881b1..8bc7f0bcd945 100644
--- a/drivers/misc/lkdtm.c
+++ b/drivers/misc/lkdtm.c
@@ -78,6 +78,7 @@ enum ctype {
78 CT_WRITE_AFTER_FREE, 78 CT_WRITE_AFTER_FREE,
79 CT_SOFTLOCKUP, 79 CT_SOFTLOCKUP,
80 CT_HARDLOCKUP, 80 CT_HARDLOCKUP,
81 CT_SPINLOCKUP,
81 CT_HUNG_TASK, 82 CT_HUNG_TASK,
82}; 83};
83 84
@@ -106,6 +107,7 @@ static char* cp_type[] = {
106 "WRITE_AFTER_FREE", 107 "WRITE_AFTER_FREE",
107 "SOFTLOCKUP", 108 "SOFTLOCKUP",
108 "HARDLOCKUP", 109 "HARDLOCKUP",
110 "SPINLOCKUP",
109 "HUNG_TASK", 111 "HUNG_TASK",
110}; 112};
111 113
@@ -123,6 +125,7 @@ static enum cname cpoint = CN_INVALID;
123static enum ctype cptype = CT_NONE; 125static enum ctype cptype = CT_NONE;
124static int count = DEFAULT_COUNT; 126static int count = DEFAULT_COUNT;
125static DEFINE_SPINLOCK(count_lock); 127static DEFINE_SPINLOCK(count_lock);
128static DEFINE_SPINLOCK(lock_me_up);
126 129
127module_param(recur_count, int, 0644); 130module_param(recur_count, int, 0644);
128MODULE_PARM_DESC(recur_count, " Recursion level for the stack overflow test, "\ 131MODULE_PARM_DESC(recur_count, " Recursion level for the stack overflow test, "\
@@ -345,6 +348,10 @@ static void lkdtm_do_action(enum ctype which)
345 for (;;) 348 for (;;)
346 cpu_relax(); 349 cpu_relax();
347 break; 350 break;
351 case CT_SPINLOCKUP:
352 /* Must be called twice to trigger. */
353 spin_lock(&lock_me_up);
354 break;
348 case CT_HUNG_TASK: 355 case CT_HUNG_TASK:
349 set_current_state(TASK_UNINTERRUPTIBLE); 356 set_current_state(TASK_UNINTERRUPTIBLE);
350 schedule(); 357 schedule();