aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/lkdtm/heap.c
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2021-06-23 13:39:34 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-06-24 15:32:08 +0200
commit5b777131bd8005acaf7e9d6e7690214155f42890 (patch)
tree4b3e3a8e9964132b55e5d9fc56ca91e8cea9d7dd /drivers/misc/lkdtm/heap.c
parentlkdtm: Enable DOUBLE_FAULT on all architectures (diff)
downloadlinux-dev-5b777131bd8005acaf7e9d6e7690214155f42890.tar.xz
linux-dev-5b777131bd8005acaf7e9d6e7690214155f42890.zip
lkdtm: Add CONFIG hints in errors where possible
For various failure conditions, try to include some details about where to look for reasons about the failure. Signed-off-by: Kees Cook <keescook@chromium.org> Link: https://lore.kernel.org/r/20210623203936.3151093-8-keescook@chromium.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/lkdtm/heap.c')
-rw-r--r--drivers/misc/lkdtm/heap.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/misc/lkdtm/heap.c b/drivers/misc/lkdtm/heap.c
index 36be5e353cd0..a3bb0577ed8b 100644
--- a/drivers/misc/lkdtm/heap.c
+++ b/drivers/misc/lkdtm/heap.c
@@ -109,9 +109,10 @@ void lkdtm_READ_AFTER_FREE(void)
if (saw != *val) {
/* Good! Poisoning happened, so declare a win. */
pr_info("Memory correctly poisoned (%x)\n", saw);
- BUG();
+ } else {
+ pr_err("FAIL: Memory was not poisoned!\n");
+ pr_expected_config_param(CONFIG_INIT_ON_FREE_DEFAULT_ON, "init_on_free");
}
- pr_info("Memory was not poisoned\n");
kfree(val);
}
@@ -165,9 +166,10 @@ void lkdtm_READ_BUDDY_AFTER_FREE(void)
if (saw != *val) {
/* Good! Poisoning happened, so declare a win. */
pr_info("Memory correctly poisoned (%x)\n", saw);
- BUG();
+ } else {
+ pr_err("FAIL: Buddy page was not poisoned!\n");
+ pr_expected_config_param(CONFIG_INIT_ON_FREE_DEFAULT_ON, "init_on_free");
}
- pr_info("Buddy page was not poisoned\n");
kfree(val);
}