Skip to content

Commit 1ee170e

Browse files
committed
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: Kees Cook <keescook@chromium.org>
1 parent b0eb93c commit 1ee170e

3 files changed

Lines changed: 8 additions & 1 deletion

File tree

‎drivers/misc/lkdtm/bugs.c‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,12 @@ static int warn_counter;
7575

7676
void lkdtm_WARNING(void)
7777
{
78-
WARN(1, "Warning message trigger count: %d\n", warn_counter++);
78+
WARN_ON(++warn_counter);
79+
}
80+
81+
void lkdtm_WARNING_MESSAGE(void)
82+
{
83+
WARN(1, "Warning message trigger count: %d\n", ++warn_counter);
7984
}
8085

8186
void lkdtm_EXCEPTION(void)

‎drivers/misc/lkdtm/core.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ static const struct crashtype crashtypes[] = {
104104
CRASHTYPE(PANIC),
105105
CRASHTYPE(BUG),
106106
CRASHTYPE(WARNING),
107+
CRASHTYPE(WARNING_MESSAGE),
107108
CRASHTYPE(EXCEPTION),
108109
CRASHTYPE(LOOP),
109110
CRASHTYPE(EXHAUST_STACK),

‎drivers/misc/lkdtm/lkdtm.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ void __init lkdtm_bugs_init(int *recur_param);
1111
void lkdtm_PANIC(void);
1212
void lkdtm_BUG(void);
1313
void lkdtm_WARNING(void);
14+
void lkdtm_WARNING_MESSAGE(void);
1415
void lkdtm_EXCEPTION(void);
1516
void lkdtm_LOOP(void);
1617
void lkdtm_EXHAUST_STACK(void);

0 commit comments

Comments
 (0)