security-kmsan-fix-interoperability-with-auto-initialization.patch removed from -mm tree
The quilt patch titled
Subject: security: kmsan: fix interoperability with auto-initialization
has been removed from the -mm tree. Its filename was
security-kmsan-fix-interoperability-with-auto-initialization.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Alexander Potapenko <[email protected]>
Subject: security: kmsan: fix interoperability with auto-initialization
Date: Thu, 15 Sep 2022 17:04:04 +0200
Heap and stack initialization is great, but not when we are trying uses of uninitialized memory. When the kernel is built with KMSAN, having kernel memory initialization enabled may introduce false negatives.
We disable CONFIG_INIT_STACK_ALL_PATTERN and CONFIG_INIT_STACK_ALL_ZERO under CONFIG_KMSAN, making it impossible to auto-initialize stack variables in KMSAN builds. We also disable CONFIG_INIT_ON_ALLOC_DEFAULT_ON and CONFIG_INIT_ON_FREE_DEFAULT_ON to prevent accidental use of heap auto-initialization.
We however still let the users enable heap auto-initialization at boot-time (by setting init_on_alloc=1 or init_on_free=1), in which case a warning is printed.
---
mm/page_alloc.c | 4 ++++ security/Kconfig.hardening | 4 ++++ 2 files changed, 8 insertions(+)
mm/page_alloc.c renamed from mm/page_alloc.c~security-kmsan-fix-interoperability-with-auto-initialization +4 -0
@@ -938,6 +938,10 @@ void init_mem_debugging_and_hardening(voelse static_branch_disable (&init_on_free); +if (IS_ENABLED (CONFIG_KMSAN ) && + (_init_on_alloc_enabled_early || _init_on_free_enabled_early)) +pr_info ("mem auto-init: please make sure init_on_alloc and init_on_free are disabled when running KMSAN\n" ); +#ifdef CONFIG_DEBUG_PAGEALLOC if (!debug_pagealloc_enabled ())return ;
security/Kconfig.hardening renamed from security/Kconfig.hardening~security-kmsan-fix-interoperability-with-auto-initialization +4 -0
@@ -106,6 +106,7 @@ choice config INIT_STACK_ALL_PATTERN bool "pattern-init everything (strongest)" depends on CC_HAS_AUTO_VAR_INIT_PATTERN + depends on !KMSAN help Initializes everything on the stack (including padding) with a specific debug value. This is intended to eliminate
@@ -124,6 +125,7 @@ choice config INIT_STACK_ALL_ZERO bool "zero-init everything (strongest and safest)" depends on CC_HAS_AUTO_VAR_INIT_ZERO + depends on !KMSAN help Initializes everything on the stack (including padding) with a zero value. This is intended to eliminate all
@@ -218,6 +220,7 @@ config STACKLEAK_RUNTIME_DISABLE config INIT_ON_ALLOC_DEFAULT_ON bool "Enable heap memory zeroing on allocation by default" + depends on !KMSAN help This has the effect of setting "init_on_alloc=1" on the kernel command line. This can be disabled with "init_on_alloc=0".
@@ -230,6 +233,7 @@ config INIT_ON_ALLOC_DEFAULT_ON config INIT_ON_FREE_DEFAULT_ON bool "Enable heap memory zeroing on free by default" + depends on !KMSAN help This has the effect of setting "init_on_free=1" on the kernel command line. This can be disabled with "init_on_free=0".
_
Patches currently in -mm which might be from [email protected] are