Commit 274a5855 authored by Kees Cook's avatar Kees Cook Committed by Greg Kroah-Hartman

lkdtm: add "SPINLOCKUP" trigger

For additional lockup testing, add "SPINLOCKUP" to trigger a spinlock
deadlock when triggered twice.
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 65892723
...@@ -78,6 +78,7 @@ enum ctype { ...@@ -78,6 +78,7 @@ enum ctype {
CT_WRITE_AFTER_FREE, CT_WRITE_AFTER_FREE,
CT_SOFTLOCKUP, CT_SOFTLOCKUP,
CT_HARDLOCKUP, CT_HARDLOCKUP,
CT_SPINLOCKUP,
CT_HUNG_TASK, CT_HUNG_TASK,
}; };
...@@ -106,6 +107,7 @@ static char* cp_type[] = { ...@@ -106,6 +107,7 @@ static char* cp_type[] = {
"WRITE_AFTER_FREE", "WRITE_AFTER_FREE",
"SOFTLOCKUP", "SOFTLOCKUP",
"HARDLOCKUP", "HARDLOCKUP",
"SPINLOCKUP",
"HUNG_TASK", "HUNG_TASK",
}; };
...@@ -123,6 +125,7 @@ static enum cname cpoint = CN_INVALID; ...@@ -123,6 +125,7 @@ static enum cname cpoint = CN_INVALID;
static enum ctype cptype = CT_NONE; static enum ctype cptype = CT_NONE;
static int count = DEFAULT_COUNT; static int count = DEFAULT_COUNT;
static DEFINE_SPINLOCK(count_lock); static DEFINE_SPINLOCK(count_lock);
static DEFINE_SPINLOCK(lock_me_up);
module_param(recur_count, int, 0644); module_param(recur_count, int, 0644);
MODULE_PARM_DESC(recur_count, " Recursion level for the stack overflow test, "\ MODULE_PARM_DESC(recur_count, " Recursion level for the stack overflow test, "\
...@@ -345,6 +348,10 @@ static void lkdtm_do_action(enum ctype which) ...@@ -345,6 +348,10 @@ static void lkdtm_do_action(enum ctype which)
for (;;) for (;;)
cpu_relax(); cpu_relax();
break; break;
case CT_SPINLOCKUP:
/* Must be called twice to trigger. */
spin_lock(&lock_me_up);
break;
case CT_HUNG_TASK: case CT_HUNG_TASK:
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
schedule(); schedule();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment