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 | memory access, and therefore requires a compiler version that supports that. | 13 | memory access, and therefore requires a compiler version that supports that. |
| 14 | 14 | ||
| 15 | Generic KASAN is supported in both GCC and Clang. With GCC it requires version | 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 | 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 stack and global variables and for inline | 17 | out-of-bounds accesses for global variables is only supported since Clang 11. |
| 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. | ||
| 21 | 18 | ||
| 22 | Tag-based KASAN is only supported in Clang and requires version 7.0.0 or later. | 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 | software tag-based KASAN (a version based on software memory | 40 | software tag-based KASAN (a version based on software memory |
| 41 | tagging, arm64 only, similar to userspace HWASan, enabled with | 41 | 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 | ||
| 45 | config KASAN_GENERIC | 46 | config KASAN_GENERIC |
| @@ -51,16 +52,18 @@ config KASAN_GENERIC · 5 unmodified lines | |||
| 51 | select STACKDEPOT | 52 | select STACKDEPOT |
| 52 | help | 53 | 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.2 | 55 | |
| 55 | or later for basic support and version 5.0 or later for detection of | 56 | 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 inline | 57 | version 8.3.0 or later. With Clang it requires version 7.0.0 or |
| 57 | instrumentation mode (CONFIG_KASAN_INLINE). With Clang it requires | 58 | later, but detection of out-of-bounds accesses for global variables |
| 58 | version 3.7.0 or later and it doesn't support detection of | 59 | 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 start | 61 | 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_SLAB | 67 | 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 STACKDEPOT | 76 | select STACKDEPOT |
| 74 | help | 77 | 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 therefore | 80 | 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 start | 84 | 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 pointer | 86 | This mode may potentially introduce problems relating to pointer |
| 82 | casting and comparison, as it embeds tags into the top byte of each | 87 | 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_SLAB | 92 | 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 workloads | 114 | memory accesses. This is faster than outline (in some workloads |
| 108 | it gives about x2 boost over outline instrumentation), but | 115 | 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 | ||
| 112 | endchoice | 118 | endchoice |
| 113 | 119 | ||