Skip to content

Commit cea23ef

Browse files
keesgregkh
authored andcommitted
lkdtm/bugs: Make double-fault test always available
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: b09511c ("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>
1 parent 500589d commit cea23ef

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

‎drivers/misc/lkdtm/bugs.c‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -338,13 +338,13 @@ void lkdtm_UNSET_SMEP(void)
338338
native_write_cr4(cr4);
339339
}
340340
#else
341-
pr_err("FAIL: this test is x86_64-only\n");
341+
pr_err("XFAIL: this test is x86_64-only\n");
342342
#endif
343343
}
344344

345-
#ifdef CONFIG_X86_32
346345
void lkdtm_DOUBLE_FAULT(void)
347346
{
347+
#ifdef CONFIG_X86_32
348348
/*
349349
* Trigger #DF by setting the stack limit to zero. This clobbers
350350
* a GDT TLS slot, which is okay because the current task will die
@@ -373,6 +373,8 @@ void lkdtm_DOUBLE_FAULT(void)
373373
asm volatile ("movw %0, %%ss; addl $0, (%%esp)" ::
374374
"r" ((unsigned short)(GDT_ENTRY_TLS_MIN << 3)));
375375

376-
panic("tried to double fault but didn't die\n");
377-
}
376+
pr_err("FAIL: tried to double fault but didn't die\n");
377+
#else
378+
pr_err("XFAIL: this test is ia32-only\n");
378379
#endif
380+
}

0 commit comments

Comments
 (0)