Skip to contentSkip to conversation

KASAN: prohibit KASAN+STRUCTLEAK combination

PATCH Superseded Dmitry Vyukov 2 participants 3 messages Apr 19, 2018 Memory management

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KASAN: prohibit KASAN+STRUCTLEAK combination

Currently STRUCTLEAK inserts initialization out of live scope of variables from KASAN point of view. This leads to KASAN false positive reports. Prohibit this combination for now.

Cc Fengguang Wu <[email protected]>
Cc Sergey Senozhatsky <[email protected]>
Cc Andrey Ryabinin <[email protected]>
Cc Kees Cook <[email protected]>

---

This combination leads to periodic confusion
and pointless debugging:

https://marc.info/?l=linux-kernel&m=151991367323082
https://marc.info/?l=linux-kernel&m=151992229326243
https://lkml.org/lkml/2017/11/30/33

---
 arch/Kconfig | 4 ++++
 1 file changed, 4 insertions(+)
arch/Kconfig +4 -0
index 8e0d665c8d53..983578c44cca 100644
@@ -464,6 +464,10 @@ config GCC_PLUGIN_LATENT_ENTROPY
 config GCC_PLUGIN_STRUCTLEAK
 	bool "Force initialization of variables containing userspace addresses"
 	depends on GCC_PLUGINS
+	# Currently STRUCTLEAK inserts initialization out of live scope of
+	# variables from KASAN point of view. This leads to KASAN false
+	# positive reports. Prohibit this combination for now.
+	depends on !KASAN
 	help
 	  This plugin zero-initializes any structures containing a
 	  __user attribute. This can prevent some classes of information
Signature · 1 line
2.17.0.484.g0c8726318c-goog
#1 lore raw

arch/Kconfig config GCC_PLUGIN_LATENT_ENTROPY · line 470

Quoted 10 lines · Dmitry Vyukov
arch/Kconfig +4 -0
@@ -464,6 +464,10 @@ config GCC_PLUGIN_LATENT_ENTROPY
 config GCC_PLUGIN_STRUCTLEAK
 	bool "Force initialization of variables containing userspace addresses"
 	depends on GCC_PLUGINS
+	# Currently STRUCTLEAK inserts initialization out of live scope of
+	# variables from KASAN point of view. This leads to KASAN false
+	# positive reports. Prohibit this combination for now.
+	depends on !KASAN

KASAN_EXTRA

#2 lore raw
Quoted 4 lines · Andrey Ryabinin

On 04/19/2018 12:48 PM, Dmitry Vyukov wrote:

Quoted 11 lines

arch/Kconfig config GCC_PLUGIN_LATENT_ENTROPY · line 470

Quoted 10 lines
arch/Kconfig +4 -0
@@ -464,6 +464,10 @@ config GCC_PLUGIN_LATENT_ENTROPY
 config GCC_PLUGIN_STRUCTLEAK
      bool "Force initialization of variables containing userspace addresses"
      depends on GCC_PLUGINS
+     # Currently STRUCTLEAK inserts initialization out of live scope of
+     # variables from KASAN point of view. This leads to KASAN false
+     # positive reports. Prohibit this combination for now.
+     depends on !KASAN

KASAN_EXTRA

Remailed, thanks.