Skip to content

Commit b866145

Browse files
keesgregkh
authored andcommitted
lkdtm: Add kernel version to failure hints
In an effort to keep as much information in once place as possible in CI logs, report the kernel version and architecture in the failure hints. Cc: Arnd Bergmann <[email protected]> Cc: [email protected] Signed-off-by: Kees Cook <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent fe8e353 commit b866145

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

drivers/misc/lkdtm/lkdtm.h

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,17 @@
55
#define pr_fmt(fmt) "lkdtm: " fmt
66

77
#include <linux/kernel.h>
8+
#include <generated/compile.h>
9+
#include <generated/utsrelease.h>
10+
11+
#define LKDTM_KERNEL "kernel (" UTS_RELEASE " " UTS_MACHINE ")"
812

913
#define pr_expected_config(kconfig) \
1014
{ \
1115
if (IS_ENABLED(kconfig)) \
12-
pr_err("Unexpected! This kernel was built with " #kconfig "=y\n"); \
16+
pr_err("Unexpected! This " LKDTM_KERNEL " was built with " #kconfig "=y\n"); \
1317
else \
14-
pr_warn("This is probably expected, since this kernel was built *without* " #kconfig "=y\n"); \
18+
pr_warn("This is probably expected, since this " LKDTM_KERNEL " was built *without* " #kconfig "=y\n"); \
1519
}
1620

1721
#ifndef MODULE
@@ -21,24 +25,24 @@ int lkdtm_check_bool_cmdline(const char *param);
2125
if (IS_ENABLED(kconfig)) { \
2226
switch (lkdtm_check_bool_cmdline(param)) { \
2327
case 0: \
24-
pr_warn("This is probably expected, since this kernel was built with " #kconfig "=y but booted with '" param "=N'\n"); \
28+
pr_warn("This is probably expected, since this " LKDTM_KERNEL " was built with " #kconfig "=y but booted with '" param "=N'\n"); \
2529
break; \
2630
case 1: \
27-
pr_err("Unexpected! This kernel was built with " #kconfig "=y and booted with '" param "=Y'\n"); \
31+
pr_err("Unexpected! This " LKDTM_KERNEL " was built with " #kconfig "=y and booted with '" param "=Y'\n"); \
2832
break; \
2933
default: \
30-
pr_err("Unexpected! This kernel was built with " #kconfig "=y (and booted without '" param "' specified)\n"); \
34+
pr_err("Unexpected! This " LKDTM_KERNEL " was built with " #kconfig "=y (and booted without '" param "' specified)\n"); \
3135
} \
3236
} else { \
3337
switch (lkdtm_check_bool_cmdline(param)) { \
3438
case 0: \
35-
pr_warn("This is probably expected, as kernel was built *without* " #kconfig "=y and booted with '" param "=N'\n"); \
39+
pr_warn("This is probably expected, as this " LKDTM_KERNEL " was built *without* " #kconfig "=y and booted with '" param "=N'\n"); \
3640
break; \
3741
case 1: \
38-
pr_err("Unexpected! This kernel was built *without* " #kconfig "=y but booted with '" param "=Y'\n"); \
42+
pr_err("Unexpected! This " LKDTM_KERNEL " was built *without* " #kconfig "=y but booted with '" param "=Y'\n"); \
3943
break; \
4044
default: \
41-
pr_err("This is probably expected, since this kernel was built *without* " #kconfig "=y (and booted without '" param "' specified)\n"); \
45+
pr_err("This is probably expected, since this " LKDTM_KERNEL " was built *without* " #kconfig "=y (and booted without '" param "' specified)\n"); \
4246
break; \
4347
} \
4448
} \

0 commit comments

Comments
 (0)