History

kasan: update required compiler versions in documentation

Updates the recently changed compiler requirements for KASAN. In particular, we require GCC >= 8.3.0, and add a note that Clang 11 supports OOB detection of globals.

Marco Elver committed 6 years ago

Commit ac4766b1 parent 7a3767f2 files · +17 −14Browse files

Unified · Split

2 files
  1. Documentation/dev-tools/kasan.rst +2 −5
  2. lib/Kconfig.kasan +15 −9
Documentation/dev-tools/kasan.rst+2−5
@@ -13,11 +13,8 @@ KASAN uses compile-time instrumentation to insert validity checks before every · 12 unmodified lines
13memory access, and therefore requires a compiler version that supports that.13memory access, and therefore requires a compiler version that supports that.
14 14
15Generic KASAN is supported in both GCC and Clang. With GCC it requires version15Generic KASAN is supported in both GCC and Clang. With GCC it requires version
164.9.2 or later for basic support and version 5.0 or later for detection of168.3.0 or later. With Clang it requires version 7.0.0 or later, but detection of
17out-of-bounds accesses for stack and global variables and for inline17out-of-bounds accesses for global variables is only supported since Clang 11.
18instrumentation mode (see the Usage section). With Clang it requires version
197.0.0 or later and it doesn't support detection of out-of-bounds accesses for
20global variables yet.
21 18
22Tag-based KASAN is only supported in Clang and requires version 7.0.0 or later.19Tag-based KASAN is only supported in Clang and requires version 7.0.0 or later.
23 20
lib/Kconfig.kasan+15−9
@@ -40,6 +40,7 @@ choice · 39 unmodified lines
40 software tag-based KASAN (a version based on software memory40 software tag-based KASAN (a version based on software memory
41 tagging, arm64 only, similar to userspace HWASan, enabled with41 tagging, arm64 only, similar to userspace HWASan, enabled with
42 CONFIG_KASAN_SW_TAGS).42 CONFIG_KASAN_SW_TAGS).
43
43 Both generic and tag-based KASAN are strictly debugging features.44 Both generic and tag-based KASAN are strictly debugging features.
44 45
45config KASAN_GENERIC46config KASAN_GENERIC
@@ -51,16 +52,18 @@ config KASAN_GENERIC · 5 unmodified lines
51 select STACKDEPOT52 select STACKDEPOT
52 help53 help
53 Enables generic KASAN mode.54 Enables generic KASAN mode.
54 Supported in both GCC and Clang. With GCC it requires version 4.9.255
55 or later for basic support and version 5.0 or later for detection of56 This mode is supported in both GCC and Clang. With GCC it requires
56 out-of-bounds accesses for stack and global variables and for inline57 version 8.3.0 or later. With Clang it requires version 7.0.0 or
57 instrumentation mode (CONFIG_KASAN_INLINE). With Clang it requires58 later, but detection of out-of-bounds accesses for global variables
58 version 3.7.0 or later and it doesn't support detection of59 is supported only since Clang 11.
59 out-of-bounds accesses for global variables yet.60
60 This mode consumes about 1/8th of available memory at kernel start61 This mode consumes about 1/8th of available memory at kernel start
61 and introduces an overhead of ~x1.5 for the rest of the allocations.62 and introduces an overhead of ~x1.5 for the rest of the allocations.
62 The performance slowdown is ~x3.63 The performance slowdown is ~x3.
64
63 For better error detection enable CONFIG_STACKTRACE.65 For better error detection enable CONFIG_STACKTRACE.
66
64 Currently CONFIG_KASAN_GENERIC doesn't work with CONFIG_DEBUG_SLAB67 Currently CONFIG_KASAN_GENERIC doesn't work with CONFIG_DEBUG_SLAB
65 (the resulting kernel does not boot).68 (the resulting kernel does not boot).
66 69
@@ -73,15 +76,19 @@ config KASAN_SW_TAGS · 6 unmodified lines
73 select STACKDEPOT76 select STACKDEPOT
74 help77 help
75 Enables software tag-based KASAN mode.78 Enables software tag-based KASAN mode.
79
76 This mode requires Top Byte Ignore support by the CPU and therefore80 This mode requires Top Byte Ignore support by the CPU and therefore
77 is only supported for arm64.81 is only supported for arm64. This mode requires Clang version 7.0.0
78 This mode requires Clang version 7.0.0 or later.82 or later.
83
79 This mode consumes about 1/16th of available memory at kernel start84 This mode consumes about 1/16th of available memory at kernel start
80 and introduces an overhead of ~20% for the rest of the allocations.85 and introduces an overhead of ~20% for the rest of the allocations.
81 This mode may potentially introduce problems relating to pointer86 This mode may potentially introduce problems relating to pointer
82 casting and comparison, as it embeds tags into the top byte of each87 casting and comparison, as it embeds tags into the top byte of each
83 pointer.88 pointer.
89
84 For better error detection enable CONFIG_STACKTRACE.90 For better error detection enable CONFIG_STACKTRACE.
91
85 Currently CONFIG_KASAN_SW_TAGS doesn't work with CONFIG_DEBUG_SLAB92 Currently CONFIG_KASAN_SW_TAGS doesn't work with CONFIG_DEBUG_SLAB
86 (the resulting kernel does not boot).93 (the resulting kernel does not boot).
87 94
@@ -107,7 +114,6 @@ config KASAN_INLINE · 19 unmodified lines
107 memory accesses. This is faster than outline (in some workloads114 memory accesses. This is faster than outline (in some workloads
108 it gives about x2 boost over outline instrumentation), but115 it gives about x2 boost over outline instrumentation), but
109 make kernel's .text size much bigger.116 make kernel's .text size much bigger.
110 For CONFIG_KASAN_GENERIC this requires GCC 5.0 or later.
111 117
112endchoice118endchoice
113 119

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