Skip to content

Commit c4efe88

Browse files
keesintel-lab-lkp
authored andcommitted
stackleak: Rename CONFIG_GCC_PLUGIN_STACKLEAK to CONFIG_STACKLEAK
In preparation for adding Clang sanitizer coverage stack depth tracking that can support stack depth callbacks, remove "GCC_PLUGIN" from "CONFIG_GCC_PLUGIN_STACKLEAK" and remove "PLUGIN" from "DISABLE_STACKLEAK_PLUGIN". Rearrange the Kconfig to have a top-level CONFIG_STACKLEAK that will depend on either GCC plugins or Clang soon. While here, also split "prev_lowest_stack" into CONFIG_STACKLEAK_METRICS, since that's the only place it is referenced from. Signed-off-by: Kees Cook <[email protected]>
1 parent f7c8774 commit c4efe88

File tree

22 files changed

+43
-37
lines changed

22 files changed

+43
-37
lines changed

Documentation/admin-guide/sysctl/kernel.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1465,7 +1465,7 @@ stack_erasing
14651465
=============
14661466

14671467
This parameter can be used to control kernel stack erasing at the end
1468-
of syscalls for kernels built with ``CONFIG_GCC_PLUGIN_STACKLEAK``.
1468+
of syscalls for kernels built with ``CONFIG_STACKLEAK``.
14691469

14701470
That erasing reduces the information which kernel stack leak bugs
14711471
can reveal and blocks some uninitialized stack variable attacks.

Documentation/security/self-protection.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ Memory poisoning
303303

304304
When releasing memory, it is best to poison the contents, to avoid reuse
305305
attacks that rely on the old contents of memory. E.g., clear stack on a
306-
syscall return (``CONFIG_GCC_PLUGIN_STACKLEAK``), wipe heap memory on a
306+
syscall return (``CONFIG_STACKLEAK``), wipe heap memory on a
307307
free. This frustrates many uninitialized variable attacks, stack content
308308
exposures, heap content exposures, and use-after-free attacks.
309309

arch/arm/boot/compressed/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ OBJS =
99

1010
HEAD = head.o
1111
OBJS += misc.o decompress.o
12-
CFLAGS_decompress.o += $(DISABLE_STACKLEAK_PLUGIN)
12+
CFLAGS_decompress.o += $(DISABLE_STACKLEAK)
1313
ifeq ($(CONFIG_DEBUG_UNCOMPRESS),y)
1414
OBJS += debug.o
1515
AFLAGS_head.o += -DDEBUG

arch/arm/kernel/entry-common.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ no_work_pending:
119119

120120
ct_user_enter save = 0
121121

122-
#ifdef CONFIG_GCC_PLUGIN_STACKLEAK
122+
#ifdef CONFIG_STACKLEAK
123123
bl stackleak_erase_on_task_stack
124124
#endif
125125
restore_user_regs fast = 0, offset = 0

arch/arm64/kernel/entry.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ SYM_CODE_END(ret_to_kernel)
614614
SYM_CODE_START_LOCAL(ret_to_user)
615615
ldr x19, [tsk, #TSK_TI_FLAGS] // re-check for single-step
616616
enable_step_tsk x19, x2
617-
#ifdef CONFIG_GCC_PLUGIN_STACKLEAK
617+
#ifdef CONFIG_STACKLEAK
618618
bl stackleak_erase_on_task_stack
619619
#endif
620620
kernel_exit 0

arch/arm64/kernel/pi/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Copyright 2022 Google LLC
33

44
KBUILD_CFLAGS := $(subst $(CC_FLAGS_FTRACE),,$(KBUILD_CFLAGS)) -fpie \
5-
-Os -DDISABLE_BRANCH_PROFILING $(DISABLE_STACKLEAK_PLUGIN) \
5+
-Os -DDISABLE_BRANCH_PROFILING $(DISABLE_STACKLEAK) \
66
$(DISABLE_LATENT_ENTROPY_PLUGIN) \
77
$(call cc-option,-mbranch-protection=none) \
88
-I$(srctree)/scripts/dtc/libfdt -fno-stack-protector \

arch/arm64/kvm/hyp/nvhe/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ asflags-y := -D__KVM_NVHE_HYPERVISOR__ -D__DISABLE_EXPORTS
1212
ccflags-y := -D__KVM_NVHE_HYPERVISOR__ -D__DISABLE_EXPORTS -D__DISABLE_TRACE_MMIO__
1313
ccflags-y += -fno-stack-protector \
1414
-DDISABLE_BRANCH_PROFILING \
15-
$(DISABLE_STACKLEAK_PLUGIN)
15+
$(DISABLE_STACKLEAK)
1616

1717
hostprogs := gen-hyprel
1818
HOST_EXTRACFLAGS += -I$(objtree)/include

arch/riscv/kernel/entry.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ SYM_CODE_START_NOALIGN(ret_from_exception)
220220
#endif
221221
bnez s0, 1f
222222

223-
#ifdef CONFIG_GCC_PLUGIN_STACKLEAK
223+
#ifdef CONFIG_STACKLEAK
224224
call stackleak_erase_on_task_stack
225225
#endif
226226

arch/riscv/kernel/pi/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# This file was copied from arm64/kernel/pi/Makefile.
33

44
KBUILD_CFLAGS := $(subst $(CC_FLAGS_FTRACE),,$(KBUILD_CFLAGS)) -fpie \
5-
-Os -DDISABLE_BRANCH_PROFILING $(DISABLE_STACKLEAK_PLUGIN) \
5+
-Os -DDISABLE_BRANCH_PROFILING $(DISABLE_STACKLEAK) \
66
$(call cc-option,-mbranch-protection=none) \
77
-I$(srctree)/scripts/dtc/libfdt -fno-stack-protector \
88
-include $(srctree)/include/linux/hidden.h \

arch/riscv/purgatory/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ targets += purgatory.ro purgatory.chk
5353

5454
PURGATORY_CFLAGS_REMOVE := -mcmodel=kernel
5555
PURGATORY_CFLAGS := -mcmodel=medany -ffreestanding -fno-zero-initialized-in-bss
56-
PURGATORY_CFLAGS += $(DISABLE_STACKLEAK_PLUGIN) -DDISABLE_BRANCH_PROFILING
56+
PURGATORY_CFLAGS += $(DISABLE_STACKLEAK) -DDISABLE_BRANCH_PROFILING
5757
PURGATORY_CFLAGS += -fno-stack-protector -g0
5858

5959
# Default KBUILD_CFLAGS can have -pg option set when FTRACE is enabled. That

0 commit comments

Comments
 (0)