stackleak: Rename STACKLEAK to KSTACK_ERASE
authorKees Cook <kees@kernel.org>
Thu, 17 Jul 2025 23:25:06 +0000 (16:25 -0700)
committerKees Cook <kees@kernel.org>
Tue, 22 Jul 2025 04:35:01 +0000 (21:35 -0700)
commit57fbad15c2eee77276a541c616589b32976d2b8e
tree7ef2b8ac0372560cf39665ae44bc67ec34b2bef4
parentfc07839203f3b98fa9afac370aaba283afc10433
stackleak: Rename STACKLEAK to KSTACK_ERASE

In preparation for adding Clang sanitizer coverage stack depth tracking
that can support stack depth callbacks:

- Add the new top-level CONFIG_KSTACK_ERASE option which will be
  implemented either with the stackleak GCC plugin, or with the Clang
  stack depth callback support.
- Rename CONFIG_GCC_PLUGIN_STACKLEAK as needed to CONFIG_KSTACK_ERASE,
  but keep it for anything specific to the GCC plugin itself.
- Rename all exposed "STACKLEAK" names and files to "KSTACK_ERASE" (named
  for what it does rather than what it protects against), but leave as
  many of the internals alone as possible to avoid even more churn.

While here, also split "prev_lowest_stack" into CONFIG_KSTACK_ERASE_METRICS,
since that's the only place it is referenced from.

Suggested-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20250717232519.2984886-1-kees@kernel.org
Signed-off-by: Kees Cook <kees@kernel.org>
40 files changed:
Documentation/admin-guide/sysctl/kernel.rst
Documentation/arch/x86/x86_64/mm.rst
Documentation/security/self-protection.rst
Documentation/translations/zh_CN/security/self-protection.rst
MAINTAINERS
arch/Kconfig
arch/arm/Kconfig
arch/arm/boot/compressed/Makefile
arch/arm/kernel/entry-common.S
arch/arm64/Kconfig
arch/arm64/kernel/entry.S
arch/arm64/kernel/pi/Makefile
arch/arm64/kvm/hyp/nvhe/Makefile
arch/loongarch/Kconfig
arch/riscv/Kconfig
arch/riscv/kernel/entry.S
arch/riscv/kernel/pi/Makefile
arch/riscv/purgatory/Makefile
arch/s390/Kconfig
arch/s390/kernel/entry.S
arch/x86/Kconfig
arch/x86/entry/calling.h
arch/x86/purgatory/Makefile
drivers/firmware/efi/libstub/Makefile
drivers/misc/lkdtm/Makefile
drivers/misc/lkdtm/kstack_erase.c [new file with mode: 0644]
drivers/misc/lkdtm/stackleak.c [deleted file]
fs/proc/base.c
include/linux/kstack_erase.h [new file with mode: 0644]
include/linux/sched.h
include/linux/stackleak.h [deleted file]
kernel/Makefile
kernel/fork.c
kernel/kstack_erase.c [new file with mode: 0644]
kernel/stackleak.c [deleted file]
lib/Makefile
scripts/Makefile.gcc-plugins
security/Kconfig.hardening
tools/objtool/check.c
tools/testing/selftests/lkdtm/config