BACKPORT: security: Create "kernel hardening" config area

Right now kernel hardening options are scattered around various Kconfig
files. This can be a central place to collect these kinds of options
going forward. This is initially populated with the memory initialization
options from the gcc-plugins.

The Android backport only adds INIT_STACK_NONE, as GCC plugins are
unavailable in the Android 4.14 tree.

Change-Id: Ic11cb574d2b447e30b0d93977a6707b53744e1cf
Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Masahiro Yamada <yamada.masahiro@socionext.com>
(cherry picked from commit 9f671e58159adea641f76c56d1f0bbdcb3c524ff)
Bug: 133428616
Signed-off-by: Alexander Potapenko <glider@google.com>
tirimbino
Kees Cook 6 years ago committed by Todd Kjos
parent 7fbc8c5127
commit 0d29c71f48
  1. 2
      security/Kconfig
  2. 32
      security/Kconfig.hardening

@ -272,5 +272,7 @@ config DEFAULT_SECURITY
default "apparmor" if DEFAULT_SECURITY_APPARMOR
default "" if DEFAULT_SECURITY_DAC
source "security/Kconfig.hardening"
endmenu

@ -0,0 +1,32 @@
menu "Kernel hardening options"
menu "Memory initialization"
choice
prompt "Initialize kernel stack variables at function entry"
default INIT_STACK_NONE
help
This option enables initialization of stack variables at
function entry time. This has the possibility to have the
greatest coverage (since all functions can have their
variables initialized), but the performance impact depends
on the function calling complexity of a given workload's
syscalls.
This chooses the level of coverage over classes of potentially
uninitialized variables. The selected class will be
initialized before use in a function.
config INIT_STACK_NONE
bool "no automatic initialization (weakest)"
help
Disable automatic stack variable initialization.
This leaves the kernel vulnerable to the standard
classes of uninitialized stack variable exploits
and information exposures.
endchoice
endmenu
endmenu
Loading…
Cancel
Save