public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH drivers/misc v5.5] lkdtm/bugs: Make double-fault test always available
@ 2020-01-02 20:29 Kees Cook
  0 siblings, 0 replies; only message in thread
From: Kees Cook @ 2020-01-02 20:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Andy Lutomirski

Adjust the DOUBLE_FAULT test to always be available (so test harnesses
don't have to make exceptions more missing tests), and for the
arch-specific tests to "XFAIL" so that test harnesses can reason about
expected vs unexpected failures.

Fixes: b09511c253e5 ("lkdtm: Add a DOUBLE_FAULT crash type on x86")
Signed-off-by: Kees Cook <keescook@chromium.org>
---
Hi Greg, this is intended for v5.5 drivers/misc as I consider it a bug fix.
---
 drivers/misc/lkdtm/bugs.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/misc/lkdtm/bugs.c b/drivers/misc/lkdtm/bugs.c
index a4fdad04809a..9eda771d3a37 100644
--- a/drivers/misc/lkdtm/bugs.c
+++ b/drivers/misc/lkdtm/bugs.c
@@ -338,13 +338,13 @@ void lkdtm_UNSET_SMEP(void)
 		native_write_cr4(cr4);
 	}
 #else
-	pr_err("FAIL: this test is x86_64-only\n");
+	pr_err("XFAIL: this test is x86_64-only\n");
 #endif
 }
 
-#ifdef CONFIG_X86_32
 void lkdtm_DOUBLE_FAULT(void)
 {
+#ifdef CONFIG_X86_32
 	/*
 	 * Trigger #DF by setting the stack limit to zero.  This clobbers
 	 * a GDT TLS slot, which is okay because the current task will die
@@ -373,6 +373,8 @@ void lkdtm_DOUBLE_FAULT(void)
 	asm volatile ("movw %0, %%ss; addl $0, (%%esp)" ::
 		      "r" ((unsigned short)(GDT_ENTRY_TLS_MIN << 3)));
 
-	panic("tried to double fault but didn't die\n");
-}
+	pr_err("FAIL: tried to double fault but didn't die\n");
+#else
+	pr_err("XFAIL: this test is ia32-only\n");
 #endif
+}
-- 
2.20.1


-- 
Kees Cook

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-01-02 20:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-02 20:29 [PATCH drivers/misc v5.5] lkdtm/bugs: Make double-fault test always available Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox