summaryrefslogtreecommitdiff
path: root/drivers/misc/lkdtm/stackleak.c
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2022-03-04 03:31:16 +0300
committerKees Cook <keescook@chromium.org>2022-04-13 02:16:48 +0300
commit73f62e60d80c2d74491933ca49006b9e70563738 (patch)
tree97b072c319bda24f42f7c071bd50009bb98dc29d /drivers/misc/lkdtm/stackleak.c
parent8bfdbddd68249e0d8598777cca8249619ee51df0 (diff)
downloadlinux-73f62e60d80c2d74491933ca49006b9e70563738.tar.xz
lkdtm: Move crashtype definitions into each category
It's long been annoying that to add a new LKDTM test one had to update lkdtm.h and core.c to get it "registered". Switch to a per-category list and update the crashtype walking code in core.c to handle it. This also means that all the lkdtm_* tests themselves can be static now. Cc: Arnd Bergmann <arnd@arndb.de> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'drivers/misc/lkdtm/stackleak.c')
-rw-r--r--drivers/misc/lkdtm/stackleak.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/misc/lkdtm/stackleak.c b/drivers/misc/lkdtm/stackleak.c
index 00db21ff115e..210c84dfe1d2 100644
--- a/drivers/misc/lkdtm/stackleak.c
+++ b/drivers/misc/lkdtm/stackleak.c
@@ -11,7 +11,7 @@
#include "lkdtm.h"
#include <linux/stackleak.h>
-void lkdtm_STACKLEAK_ERASING(void)
+static void lkdtm_STACKLEAK_ERASING(void)
{
unsigned long *sp, left, found, i;
const unsigned long check_depth =
@@ -80,3 +80,12 @@ end:
pr_info("OK: the rest of the thread stack is properly erased\n");
}
}
+
+static struct crashtype crashtypes[] = {
+ CRASHTYPE(STACKLEAK_ERASING),
+};
+
+struct crashtype_category stackleak_crashtypes = {
+ .crashtypes = crashtypes,
+ .len = ARRAY_SIZE(crashtypes),
+};