History

kasan: remove use after scope bugs detection.

Use after scope bugs detector seems to be almost entirely useless for the linux kernel. It exists over two years, but I've seen only one valid bug so far [1]. And the bug was fixed before it has been reported. There were some other use-after-scope reports, but they were false-positives due to different reasons like incompatibility with structleak plugin. This feature significantly increases stack usage, especially with GCC < 9 version, and causes a 32K stack overflow. It probably adds performance penalty too. Given all that, let's remove use-after-scope detector entirely. While preparing this patch I've noticed that we mistakenly enable use-after-scope detection for clang compiler regardless of CONFIG_KASAN_EXTRA setting. This is also fixed now. [1] http://lkml.kernel.org/r/<20171129052106.rhgbjhhis53hkgfn@wfg-t540p.sh.intel.com>

Andrey Ryabinin committed 7 years ago

Commit 7771bdb1 parent 46612b79 files · +0 −73Browse files

Showing the changes to scripts (2 of 9 files). Show all

Unified · Split

2 files
  1. scripts/Makefile.kasan +0 −5
  2. scripts/gcc-plugins/Kconfig +0 −4
scripts/Makefile.kasan+0−5
@@ -27,14 +27,9 @@ else · 26 unmodified lines
27 $(call cc-param,asan-globals=1) \27 $(call cc-param,asan-globals=1) \
28 $(call cc-param,asan-instrumentation-with-call-threshold=$(call_threshold)) \28 $(call cc-param,asan-instrumentation-with-call-threshold=$(call_threshold)) \
29 $(call cc-param,asan-stack=$(CONFIG_KASAN_STACK)) \29 $(call cc-param,asan-stack=$(CONFIG_KASAN_STACK)) \
30 $(call cc-param,asan-use-after-scope=1) \
31 $(call cc-param,asan-instrument-allocas=1)30 $(call cc-param,asan-instrument-allocas=1)
32endif31endif
33 32
34ifdef CONFIG_KASAN_EXTRA
35CFLAGS_KASAN += $(call cc-option, -fsanitize-address-use-after-scope)
36endif
37
38endif # CONFIG_KASAN_GENERIC33endif # CONFIG_KASAN_GENERIC
39 34
40ifdef CONFIG_KASAN_SW_TAGS35ifdef CONFIG_KASAN_SW_TAGS
scripts/gcc-plugins/Kconfig+0−4
@@ -68,10 +68,6 @@ config GCC_PLUGIN_LATENT_ENTROPY · 67 unmodified lines
68 68
69config GCC_PLUGIN_STRUCTLEAK69config GCC_PLUGIN_STRUCTLEAK
70 bool "Force initialization of variables containing userspace addresses"70 bool "Force initialization of variables containing userspace addresses"
71 # Currently STRUCTLEAK inserts initialization out of live scope of
72 # variables from KASAN point of view. This leads to KASAN false
73 # positive reports. Prohibit this combination for now.
74 depends on !KASAN_EXTRA
75 help71 help
76 This plugin zero-initializes any structures containing a72 This plugin zero-initializes any structures containing a
77 __user attribute. This can prevent some classes of information73 __user attribute. This can prevent some classes of information

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t