File tree Expand file tree Collapse file tree 4 files changed +20
-3
lines changed Expand file tree Collapse file tree 4 files changed +20
-3
lines changed Original file line number Diff line number Diff line change 5
5
#if defined(CONFIG_CC_IS_CLANG ) && CONFIG_CLANG_VERSION < 170000
6
6
#define __head __section(".head.text") __no_sanitize_undefined __no_stack_protector
7
7
#else
8
- #define __head __section(".head.text") __no_sanitize_undefined
8
+ #define __head __section(".head.text") __no_sanitize_undefined __no_sanitize_coverage
9
9
#endif
10
10
11
11
struct x86_mapping_info {
Original file line number Diff line number Diff line change 49
49
50
50
/* These are for everybody (although not all archs will actually
51
51
discard it in modules) */
52
- #define __init __section(".init.text") __cold __latent_entropy __noinitretpoline
52
+ #define __init __section(".init.text") __cold __latent_entropy \
53
+ __noinitretpoline \
54
+ __no_sanitize_coverage
53
55
#define __initdata __section(".init.data")
54
56
#define __initconst __section(".init.rodata")
55
57
#define __exitdata __section(".exit.data")
Original file line number Diff line number Diff line change @@ -22,3 +22,15 @@ ubsan-integer-wrap-cflags-$(CONFIG_UBSAN_INTEGER_WRAP) += \
22
22
-fsanitize=implicit-unsigned-integer-truncation \
23
23
-fsanitize-ignorelist=$(srctree)/scripts/integer-wrap-ignore.scl
24
24
export CFLAGS_UBSAN_INTEGER_WRAP := $(ubsan-integer-wrap-cflags-y)
25
+
26
+ ifdef CONFIG_CC_IS_CLANG
27
+ stackleak-cflags-$(CONFIG_STACKLEAK) += \
28
+ -fsanitize-coverage=stack-depth \
29
+ -fsanitize-coverage-stack-depth-callback-min=$(CONFIG_STACKLEAK_TRACK_MIN_SIZE)
30
+ export STACKLEAK_CFLAGS := $(stackleak-cflags-y)
31
+ ifdef CONFIG_STACKLEAK
32
+ DISABLE_STACKLEAK := -fno-sanitize-coverage=stack-depth
33
+ endif
34
+ export DISABLE_STACKLEAK
35
+ KBUILD_CFLAGS += $(STACKLEAK_CFLAGS)
36
+ endif
Original file line number Diff line number Diff line change @@ -158,10 +158,13 @@ config GCC_PLUGIN_STRUCTLEAK_VERBOSE
158
158
initialized. Since not all existing initializers are detected
159
159
by the plugin, this can produce false positive warnings.
160
160
161
+ config CC_HAS_SANCOV_STACK_DEPTH_CALLBACK
162
+ def_bool $(cc-option,-fsanitize-coverage-stack-depth-callback-min=1)
163
+
161
164
config STACKLEAK
162
165
bool "Poison kernel stack before returning from syscalls"
163
166
depends on HAVE_ARCH_STACKLEAK
164
- depends on GCC_PLUGINS
167
+ depends on GCC_PLUGINS || CC_HAS_SANCOV_STACK_DEPTH_CALLBACK
165
168
help
166
169
This option makes the kernel erase the kernel stack before
167
170
returning from system calls. This has the effect of leaving
You can’t perform that action at this time.
0 commit comments