Skip to content

Commit

Permalink
lkdtm: add "SPINLOCKUP" trigger
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
kees authored and gregkh committed Jul 25, 2013
1 parent 6589272 commit 274a585
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions drivers/misc/lkdtm.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ enum ctype {
CT_WRITE_AFTER_FREE,
CT_SOFTLOCKUP,
CT_HARDLOCKUP,
CT_SPINLOCKUP,
CT_HUNG_TASK,
};

Expand Down Expand Up @@ -106,6 +107,7 @@ static char* cp_type[] = {
"WRITE_AFTER_FREE",
"SOFTLOCKUP",
"HARDLOCKUP",
"SPINLOCKUP",
"HUNG_TASK",
};

Expand All @@ -123,6 +125,7 @@ static enum cname cpoint = CN_INVALID;
static enum ctype cptype = CT_NONE;
static int count = DEFAULT_COUNT;
static DEFINE_SPINLOCK(count_lock);
static DEFINE_SPINLOCK(lock_me_up);

module_param(recur_count, int, 0644);
MODULE_PARM_DESC(recur_count, " Recursion level for the stack overflow test, "\
Expand Down Expand Up @@ -345,6 +348,10 @@ static void lkdtm_do_action(enum ctype which)
for (;;)
cpu_relax();
break;
case CT_SPINLOCKUP:
/* Must be called twice to trigger. */
spin_lock(&lock_me_up);
break;
case CT_HUNG_TASK:
set_current_state(TASK_UNINTERRUPTIBLE);
schedule();
Expand Down

0 comments on commit 274a585

Please sign in to comment.