55#define pr_fmt (fmt ) "lkdtm: " fmt
66
77#include <linux/kernel.h>
8- #include <generated/compile.h>
9- #include <generated/utsrelease.h>
108
11- #define LKDTM_KERNEL "kernel (" UTS_RELEASE " " UTS_MACHINE ")"
9+ extern char * lkdtm_kernel_info ;
1210
1311#define pr_expected_config (kconfig ) \
1412{ \
1513 if (IS_ENABLED(kconfig)) \
16- pr_err("Unexpected! This " LKDTM_KERNEL " was built with " #kconfig "=y\n"); \
14+ pr_err("Unexpected! This %s was built with " #kconfig "=y\n", \
15+ lkdtm_kernel_info); \
1716 else \
18- pr_warn("This is probably expected, since this " LKDTM_KERNEL " was built *without* " #kconfig "=y\n"); \
17+ pr_warn("This is probably expected, since this %s was built *without* " #kconfig "=y\n", \
18+ lkdtm_kernel_info); \
1919}
2020
2121#ifndef MODULE
@@ -25,24 +25,30 @@ int lkdtm_check_bool_cmdline(const char *param);
2525 if (IS_ENABLED(kconfig)) { \
2626 switch (lkdtm_check_bool_cmdline(param)) { \
2727 case 0: \
28- pr_warn("This is probably expected, since this " LKDTM_KERNEL " was built with " #kconfig "=y but booted with '" param "=N'\n"); \
28+ pr_warn("This is probably expected, since this %s was built with " #kconfig "=y but booted with '" param "=N'\n", \
29+ lkdtm_kernel_info); \
2930 break; \
3031 case 1: \
31- pr_err("Unexpected! This " LKDTM_KERNEL " was built with " #kconfig "=y and booted with '" param "=Y'\n"); \
32+ pr_err("Unexpected! This %s was built with " #kconfig "=y and booted with '" param "=Y'\n", \
33+ lkdtm_kernel_info); \
3234 break; \
3335 default: \
34- pr_err("Unexpected! This " LKDTM_KERNEL " was built with " #kconfig "=y (and booted without '" param "' specified)\n"); \
36+ pr_err("Unexpected! This %s was built with " #kconfig "=y (and booted without '" param "' specified)\n", \
37+ lkdtm_kernel_info); \
3538 } \
3639 } else { \
3740 switch (lkdtm_check_bool_cmdline(param)) { \
3841 case 0: \
39- pr_warn("This is probably expected, as this " LKDTM_KERNEL " was built *without* " #kconfig "=y and booted with '" param "=N'\n"); \
42+ pr_warn("This is probably expected, as this %s was built *without* " #kconfig "=y and booted with '" param "=N'\n", \
43+ lkdtm_kernel_info); \
4044 break; \
4145 case 1: \
42- pr_err("Unexpected! This " LKDTM_KERNEL " was built *without* " #kconfig "=y but booted with '" param "=Y'\n"); \
46+ pr_err("Unexpected! This %s was built *without* " #kconfig "=y but booted with '" param "=Y'\n", \
47+ lkdtm_kernel_info); \
4348 break; \
4449 default: \
45- pr_err("This is probably expected, since this " LKDTM_KERNEL " was built *without* " #kconfig "=y (and booted without '" param "' specified)\n"); \
50+ pr_err("This is probably expected, since this %s was built *without* " #kconfig "=y (and booted without '" param "' specified)\n", \
51+ lkdtm_kernel_info); \
4652 break; \
4753 } \
4854 } \
0 commit comments