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