All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] RFC: introduce CONFIG_INIT_ALL_MEMORY
@ 2019-03-07 13:35 Alexander Potapenko
  2019-03-07 13:35 ` [PATCH 1/1] RFC: initmem: introduce CONFIG_INIT_ALL_MEMORY and CONFIG_INIT_ALL_STACK Alexander Potapenko
  0 siblings, 1 reply; 7+ messages in thread
From: Alexander Potapenko @ 2019-03-07 13:35 UTC (permalink / raw)
  To: yamada.masahiro, jmorris, serge
  Cc: linux-security-module, linux-kbuild, ndesaulniers, kcc, dvyukov,
	keescook, sspatil

This patch is a part of a bigger initiative to allow initializing
heap/stack memory in the Linux kernels by default.
The rationale behind doing so is to reduce the severity of bugs caused
by using uninitialized memory.

Over the last two years KMSAN (https://github.com/google/kmsan/) has
found more than a hundred bugs running in a really moderate setup (orders
of magnitude less CPU/months than KASAN). Some of those bugs led to
information leaks if uninitialized memory was copied to the userspace,
other could cause DoS because of subverted control flow.
A lot more bugs remain uncovered, so we want to provide the distros and OS
vendors with a last resort measure to mitigate such bugs.

Our plan is to introduce configuration flags to force initialization of
stack and heap variables with a fixed pattern.
This is going to render information leaks inefficient (as we'll only leak
pattern data) and make uses of uninitialized values in conditions more
deterministic and discoverable.

The stack instrumentation part is only implemented in Clang at the moment
(see https://reviews.llvm.org/D54604 ; there's also a GCC feature request
for a similar flag: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87210).
The heap initialization part (still work in progress) is going to be
compiler-agnostic.

It'll be possible to opt-out from stack initalization by annotating local
variables as knowingly initialized, or by disabling the feature for a
single translation unit.
Opting out for a heap allocation will be done using a special GFP flag.

Alexander Potapenko (1):
  initmem: introduce CONFIG_INIT_ALL_MEMORY and CONFIG_INIT_ALL_STACK

 Makefile                 |  3 ++-
 scripts/Makefile.initmem | 17 +++++++++++++++++
 scripts/Makefile.lib     |  6 ++++++
 security/Kconfig         |  1 +
 security/Kconfig.initmem | 22 ++++++++++++++++++++++
 5 files changed, 48 insertions(+), 1 deletion(-)
 create mode 100644 scripts/Makefile.initmem
 create mode 100644 security/Kconfig.initmem

-- 
2.21.0.352.gf09ad66450-goog

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-03-08 13:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-07 13:35 [PATCH 0/1] RFC: introduce CONFIG_INIT_ALL_MEMORY Alexander Potapenko
2019-03-07 13:35 ` [PATCH 1/1] RFC: initmem: introduce CONFIG_INIT_ALL_MEMORY and CONFIG_INIT_ALL_STACK Alexander Potapenko
2019-03-07 17:11   ` Kees Cook
2019-03-08 10:09     ` Alexander Potapenko
2019-03-08 11:57     ` Alexander Potapenko
2019-03-07 18:37   ` Nick Desaulniers
2019-03-08 13:29     ` Alexander Potapenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.