Commit 1ee170ea authored by Kees Cook's avatar Kees Cook
Browse files

lkdtm: Split WARNING into separate tests



There are three paths through the kernel code exception logging:

- BUG (no configurable printk message)
- WARN_ON (no configurable printk message)
- WARN (configurable printk message)

LKDTM was not testing WARN_ON(). This is needed to evaluate the placement
of the "cut here" line, which needs special handling in each of the
three exceptions (and between architectures that implement instruction
exceptions to implement the code exceptions).

Signed-off-by: default avatarKees Cook <keescook@chromium.org>
parent b0eb93cf
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -75,7 +75,12 @@ static int warn_counter;

void lkdtm_WARNING(void)
{
	WARN(1, "Warning message trigger count: %d\n", warn_counter++);
	WARN_ON(++warn_counter);
}

void lkdtm_WARNING_MESSAGE(void)
{
	WARN(1, "Warning message trigger count: %d\n", ++warn_counter);
}

void lkdtm_EXCEPTION(void)
+1 −0
Original line number Diff line number Diff line
@@ -104,6 +104,7 @@ static const struct crashtype crashtypes[] = {
	CRASHTYPE(PANIC),
	CRASHTYPE(BUG),
	CRASHTYPE(WARNING),
	CRASHTYPE(WARNING_MESSAGE),
	CRASHTYPE(EXCEPTION),
	CRASHTYPE(LOOP),
	CRASHTYPE(EXHAUST_STACK),
+1 −0
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ void __init lkdtm_bugs_init(int *recur_param);
void lkdtm_PANIC(void);
void lkdtm_BUG(void);
void lkdtm_WARNING(void);
void lkdtm_WARNING_MESSAGE(void);
void lkdtm_EXCEPTION(void);
void lkdtm_LOOP(void);
void lkdtm_EXHAUST_STACK(void);