[PATCH] lkdtm/usercopy: fix CONFIG_ARCH_HAS_CURRENT_STACK_POINTER guard
From: Pengpeng Hou
Date: Thu Dec 03 2026 - 21:08:46 EST
The LKDTM usercopy test checks the bare ARCH_HAS_CURRENT_STACK_POINTER
name. The generated C macro is CONFIG_ARCH_HAS_CURRENT_STACK_POINTER, so
the test omits its stack-pointer diagnostic even on architectures that
provide it.
Use the generated macro to guard that diagnostic.
The issue was found by our static-analysis tool and manually reviewed.
Fixes: f387e86d3a74 ("lkdtm/usercopy: Expand size of "out of frame" object")
Signed-off-by: Pengpeng Hou <hppiscas@xxxxxxx>
---
The original patch was prepared with Gemini. Codex assisted with this
review and revision (Assisted-by: gpt 5).
Built usercopy.o on x86-64 with GCC 11.4 and W=1 (CONFIG_LKDTM=m,
CONFIG_ARCH_HAS_CURRENT_STACK_POINTER=y). No runtime or hardware test
was performed.
drivers/misc/lkdtm/usercopy.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/misc/lkdtm/usercopy.c b/drivers/misc/lkdtm/usercopy.c
index 67db57249a3476ed2bcf93fab0ab4d4776a80a6a..884aa9ab1ee0cf1d24f927ff37471b3d0fbf9923 100644
--- a/drivers/misc/lkdtm/usercopy.c
+++ b/drivers/misc/lkdtm/usercopy.c
@@ -72,7 +72,7 @@ static noinline void do_usercopy_stack(bool to_user, bool bad_frame)
bad_stack -= sizeof(unsigned long);
}
-#ifdef ARCH_HAS_CURRENT_STACK_POINTER
+#ifdef CONFIG_ARCH_HAS_CURRENT_STACK_POINTER
pr_info("stack : %px\n", (void *)current_stack_pointer);
#endif
pr_info("good_stack: %px-%px\n", good_stack, good_stack + sizeof(good_stack));
base-commit: d06ce6f1eb5eeffd4ebcfde345dc34a98131d106