Skip to content

Commit c622fc5

Browse files
committed
Merge tag 'meminit-v5.3-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
Pull structleak fix from Kees Cook: "Disable gcc-based stack variable auto-init under KASAN (Arnd Bergmann). This fixes a bunch of build warnings under KASAN and the gcc-plugin-based stack auto-initialization features (which are arguably redundant, so better to let KASAN control this)" * tag 'meminit-v5.3-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux: structleak: disable STRUCTLEAK_BYREF in combination with KASAN_STACK
2 parents 8e61ea1 + 173e6ee commit c622fc5

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

security/Kconfig.hardening

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ choice
6161
config GCC_PLUGIN_STRUCTLEAK_BYREF
6262
bool "zero-init structs passed by reference (strong)"
6363
depends on GCC_PLUGINS
64+
depends on !(KASAN && KASAN_STACK=1)
6465
select GCC_PLUGIN_STRUCTLEAK
6566
help
6667
Zero-initialize any structures on the stack that may
@@ -70,9 +71,15 @@ choice
7071
exposures, like CVE-2017-1000410:
7172
https://git.kernel.org/linus/06e7e776ca4d3654
7273

74+
As a side-effect, this keeps a lot of variables on the
75+
stack that can otherwise be optimized out, so combining
76+
this with CONFIG_KASAN_STACK can lead to a stack overflow
77+
and is disallowed.
78+
7379
config GCC_PLUGIN_STRUCTLEAK_BYREF_ALL
7480
bool "zero-init anything passed by reference (very strong)"
7581
depends on GCC_PLUGINS
82+
depends on !(KASAN && KASAN_STACK=1)
7683
select GCC_PLUGIN_STRUCTLEAK
7784
help
7885
Zero-initialize any stack variables that may be passed

0 commit comments

Comments
 (0)