|author||Ard Biesheuvel <email@example.com>||2017-08-06 12:06:27 +0100|
|committer||Kees Cook <firstname.lastname@example.org>||2017-08-07 11:20:57 -0700|
|parent||Linux 4.13-rc2 (diff)|
gcc-plugins: structleak: add option to init all vars used as byref args
In the Linux kernel, struct type variables are rarely passed by-value, and so functions that initialize such variables typically take an input reference to the variable rather than returning a value that can subsequently be used in an assignment. If the initalization function is not part of the same compilation unit, the lack of an assignment operation defeats any analysis the compiler can perform as to whether the variable may be used before having been initialized. This means we may end up passing on such variables uninitialized, resulting in potential information leaks. So extend the existing structleak GCC plugin so it will [optionally] apply to all struct type variables that have their address taken at any point, rather than only to variables of struct types that have a __user annotation. Signed-off-by: Ard Biesheuvel <email@example.com> Signed-off-by: Kees Cook <firstname.lastname@example.org>
Diffstat (limited to '')
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/Kconfig b/arch/Kconfig
index 21d0089117fe..0f1621489bf0 100644
@@ -458,6 +458,13 @@ config GCC_PLUGIN_STRUCTLEAK
+ bool "Force initialize all struct type variables passed by reference"
+ depends on GCC_PLUGIN_STRUCTLEAK
+ Zero initialize any struct type local variable that may be passed by
+ reference without having been initialized.
bool "Report forcefully initialized variables"
depends on GCC_PLUGIN_STRUCTLEAK