On 9/24/25 4:50 AM, Jinchao Wang wrote:
> Add Kconfig and Makefile infrastructure.
>
> The implementation is located under `mm/kstackwatch/`.
>
> Signed-off-by: Jinchao Wang <wangjinchao...@gmail.com>
> ---
> mm/Kconfig.debug | 8 ++++++++
> mm/Makefile | 1 +
> mm/kstackwatch/Makefile | 2 ++
> mm/kstackwatch/kernel.c | 23 +++++++++++++++++++++++
> mm/kstackwatch/kstackwatch.h | 5 +++++
> mm/kstackwatch/stack.c | 1 +
> mm/kstackwatch/watch.c | 1 +
> 7 files changed, 41 insertions(+)
> create mode 100644 mm/kstackwatch/Makefile
> create mode 100644 mm/kstackwatch/kernel.c
> create mode 100644 mm/kstackwatch/kstackwatch.h
> create mode 100644 mm/kstackwatch/stack.c
> create mode 100644 mm/kstackwatch/watch.c
>
> diff --git a/mm/Kconfig.debug b/mm/Kconfig.debug
> index 32b65073d0cc..89be351c0be5 100644
> --- a/mm/Kconfig.debug
> +++ b/mm/Kconfig.debug
> @@ -309,3 +309,11 @@ config PER_VMA_LOCK_STATS
> overhead in the page fault path.
>
> If in doubt, say N.
> +
> +config KSTACK_WATCH
> + bool "Kernel Stack Watch"
> + depends on HAVE_HW_BREAKPOINT && KPROBES && FPROBE && STACKTRACE
> + help
> + A lightweight real-time debugging tool to detect stack corrupting.
corruption.
> +
> + If unsure, say N.
--
~Randy