File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,12 @@ kstack-erase-cflags-$(CONFIG_GCC_PLUGIN_STACKLEAK_VERBOSE) += -fplugin-arg-stack
8
8
DISABLE_KSTACK_ERASE := -fplugin-arg-stackleak_plugin-disable
9
9
endif
10
10
11
+ ifdef CONFIG_CC_IS_CLANG
12
+ kstack-erase-cflags-y += -fsanitize-coverage=stack-depth
13
+ kstack-erase-cflags-y += -fsanitize-coverage-stack-depth-callback-min=$(CONFIG_KSTACK_ERASE_TRACK_MIN_SIZE)
14
+ DISABLE_KSTACK_ERASE := -fno-sanitize-coverage=stack-depth
15
+ endif
16
+
11
17
KSTACK_ERASE_CFLAGS := $(kstack-erase-cflags-y)
12
18
13
19
export STACKLEAK_CFLAGS DISABLE_KSTACK_ERASE
Original file line number Diff line number Diff line change @@ -82,10 +82,13 @@ choice
82
82
83
83
endchoice
84
84
85
+ config CC_HAS_SANCOV_STACK_DEPTH_CALLBACK
86
+ def_bool $(cc-option,-fsanitize-coverage-stack-depth-callback-min=1)
87
+
85
88
config KSTACK_ERASE
86
89
bool "Poison kernel stack before returning from syscalls"
87
90
depends on HAVE_ARCH_KSTACK_ERASE
88
- depends on GCC_PLUGINS
91
+ depends on GCC_PLUGINS || CC_HAS_SANCOV_STACK_DEPTH_CALLBACK
89
92
help
90
93
This option makes the kernel erase the kernel stack before
91
94
returning from system calls. This has the effect of leaving
You can’t perform that action at this time.
0 commit comments