]> git.baikalelectronics.ru Git - kernel.git/commitdiff
lkdtm/bugs: Make double-fault test always available
authorKees Cook <keescook@chromium.org>
Thu, 2 Jan 2020 20:29:17 +0000 (12:29 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 14 Jan 2020 14:38:28 +0000 (15:38 +0100)
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: 41b6354b4a6e ("lkdtm: Add a DOUBLE_FAULT crash type on x86")
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/202001021226.751D3F869D@keescook
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/lkdtm/bugs.c

index a4fdad04809a994bf9afdbbb561eb059b0084fc9..9eda771d3a373850531f313539144a177d16e9b7 100644 (file)
@@ -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
+}