All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Arnd Bergmann <arnd@arndb.de>, Ankita Garg <ankita@in.ibm.com>,
	Simon Kagstrom <simon.kagstrom@netinsight.net>,
	Kees Cook <keescook@chromium.org>
Subject: [PATCH 3/4] lkdtm: add "SPINLOCKUP" trigger
Date: Sat, 22 Jun 2013 11:37:06 -0700	[thread overview]
Message-ID: <1371926227-2609-4-git-send-email-keescook@chromium.org> (raw)
In-Reply-To: <1371926227-2609-1-git-send-email-keescook@chromium.org>

For additional lockup testing, add "SPINLOCKUP" to trigger a spinlock
deadlock when triggered twice.

Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/misc/lkdtm.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/misc/lkdtm.c b/drivers/misc/lkdtm.c
index b1323fc..8bc7f0b 100644
--- a/drivers/misc/lkdtm.c
+++ b/drivers/misc/lkdtm.c
@@ -78,6 +78,7 @@ enum ctype {
 	CT_WRITE_AFTER_FREE,
 	CT_SOFTLOCKUP,
 	CT_HARDLOCKUP,
+	CT_SPINLOCKUP,
 	CT_HUNG_TASK,
 };
 
@@ -106,6 +107,7 @@ static char* cp_type[] = {
 	"WRITE_AFTER_FREE",
 	"SOFTLOCKUP",
 	"HARDLOCKUP",
+	"SPINLOCKUP",
 	"HUNG_TASK",
 };
 
@@ -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, "\
@@ -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();
-- 
1.7.9.5


  parent reply	other threads:[~2013-06-22 18:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-22 18:37 [PATCH 0/4] lkdtm: various improvements Kees Cook
2013-06-22 18:37 ` [PATCH 1/4] lkdtm: fix stack protector trigger Kees Cook
2013-07-08 13:09   ` Kees Cook
2013-07-08 16:42     ` Greg Kroah-Hartman
2013-07-08 16:59       ` Kees Cook
2013-06-22 18:37 ` [PATCH 2/4] lkdtm: add "WARNING" trigger Kees Cook
2013-06-22 18:37 ` Kees Cook [this message]
2013-06-22 18:37 ` [PATCH 4/4] lkdtm: add "EXEC_*" triggers Kees Cook
2013-07-08 17:01 [PATCH 1/4] lkdtm: fix stack protector trigger Kees Cook
2013-07-08 17:01 ` [PATCH 3/4] lkdtm: add "SPINLOCKUP" trigger Kees Cook

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1371926227-2609-4-git-send-email-keescook@chromium.org \
    --to=keescook@chromium.org \
    --cc=ankita@in.ibm.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=simon.kagstrom@netinsight.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.