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
2727 $(call cc-param,asan-globals=1) \
2828 $(call cc-param,asan-instrumentation-with-call-threshold=$(call_threshold)) \
2929 $(call cc-param,asan-stack=$(CONFIG_KASAN_STACK)) \
30− $(call cc-param,asan-use-after-scope=1) \
3130 $(call cc-param,asan-instrument-allocas=1)
3231 endif
3332
34−ifdef CONFIG_KASAN_EXTRA
35−CFLAGS_KASAN += $(call cc-option, -fsanitize-address-use-after-scope)
36−endif
37−
3833 endif # CONFIG_KASAN_GENERIC
3934
4035 ifdef CONFIG_KASAN_SW_TAGS
scripts/gcc-plugins/Kconfig+0−4
@@ -68,10 +68,6 @@ config GCC_PLUGIN_LATENT_ENTROPY · 67 unmodified lines
6868
6969 config GCC_PLUGIN_STRUCTLEAK
7070 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
7571 help
7672 This plugin zero-initializes any structures containing a
7773 __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