kernel-hardening.lists.openwall.com archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/2] RFC: introduce CONFIG_INIT_ALL_MEMORY
@ 2019-04-08 17:04 Alexander Potapenko
  2019-04-08 17:04 ` [PATCH v3 1/2] initmem: introduce CONFIG_INIT_ALL_MEMORY and CONFIG_INIT_ALL_STACK Alexander Potapenko
  2019-04-08 17:04 ` [PATCH v3 2/2] initmem: introduce CONFIG_INIT_ALL_HEAP Alexander Potapenko
  0 siblings, 2 replies; 12+ messages in thread
From: Alexander Potapenko @ 2019-04-08 17:04 UTC (permalink / raw)
  To: yamada.masahiro, jmorris, serge
  Cc: linux-security-module, linux-kbuild, ndesaulniers, kcc, dvyukov,
	keescook, sspatil, kernel-hardening

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 based on Clang's -ftrivial-auto-var-init
(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)
or GCC's -fplugin-arg-structleak_plugin-byref-all
The heap initialization part is compiler-agnostic and is based on the
existing CONFIG_SLUB_DEBUG and CONFIG_PAGE_POISONING.

Alexander Potapenko (2):
  initmem: introduce CONFIG_INIT_ALL_MEMORY and CONFIG_INIT_ALL_STACK
  initmem: introduce CONFIG_INIT_ALL_HEAP

 Makefile                 |  3 ++-
 mm/page_poison.c         |  5 +++++
 mm/slub.c                |  2 ++
 scripts/Makefile.initmem | 10 ++++++++++
 security/Kconfig         |  1 +
 security/Kconfig.initmem | 40 ++++++++++++++++++++++++++++++++++++++++
 6 files changed, 60 insertions(+), 1 deletion(-)
 create mode 100644 scripts/Makefile.initmem
 create mode 100644 security/Kconfig.initmem

-- 
2.21.0.392.gf8f6787159e-goog

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

end of thread, other threads:[~2019-04-09 17:06 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-08 17:04 [PATCH v3 0/2] RFC: introduce CONFIG_INIT_ALL_MEMORY Alexander Potapenko
2019-04-08 17:04 ` [PATCH v3 1/2] initmem: introduce CONFIG_INIT_ALL_MEMORY and CONFIG_INIT_ALL_STACK Alexander Potapenko
2019-04-08 22:15   ` Randy Dunlap
2019-04-09  8:29     ` Alexander Potapenko
2019-04-09  8:37   ` Masahiro Yamada
2019-04-09  9:02     ` Alexander Potapenko
2019-04-09  9:03       ` Alexander Potapenko
2019-04-09 17:06     ` Kees Cook
2019-04-08 17:04 ` [PATCH v3 2/2] initmem: introduce CONFIG_INIT_ALL_HEAP Alexander Potapenko
2019-04-08 17:39   ` Jann Horn
2019-04-09  9:32   ` Mark Rutland
2019-04-09  9:53     ` Alexander Potapenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).