diff mbox series

[v5,28/38] kmsan: init: call KMSAN initialization routines

Message ID 20200325161249.55095-29-glider@google.com (mailing list archive)
State New, archived
Headers show
Series Add KernelMemorySanitizer infrastructure | expand

Commit Message

Alexander Potapenko March 25, 2020, 4:12 p.m. UTC
kmsan_initialize_shadow() creates metadata pages for mappings created
at boot time.

kmsan_initialize() initializes the bookkeeping for init_task and enables
KMSAN.

Signed-off-by: Alexander Potapenko <glider@google.com>
To: Alexander Potapenko <glider@google.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Vegard Nossum <vegard.nossum@oracle.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Andrey Konovalov <andreyknvl@google.com>
Cc: Marco Elver <elver@google.com>
Cc: linux-mm@kvack.org

---

Change-Id: Ie3af251d629b911668f8651d868c544f3c11209f
---
 init/main.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Andrey Konovalov April 8, 2020, 4:04 p.m. UTC | #1
On Wed, Mar 25, 2020 at 5:14 PM <glider@google.com> wrote:
>
> kmsan_initialize_shadow() creates metadata pages for mappings created
> at boot time.
>
> kmsan_initialize() initializes the bookkeeping for init_task and enables
> KMSAN.
>
> Signed-off-by: Alexander Potapenko <glider@google.com>
> To: Alexander Potapenko <glider@google.com>
> Cc: Jens Axboe <axboe@kernel.dk>
> Cc: Andy Lutomirski <luto@kernel.org>
> Cc: Vegard Nossum <vegard.nossum@oracle.com>
> Cc: Dmitry Vyukov <dvyukov@google.com>
> Cc: Andrey Konovalov <andreyknvl@google.com>
> Cc: Marco Elver <elver@google.com>
> Cc: linux-mm@kvack.org

Reviewed-by: Andrey Konovalov <andreyknvl@google.com>

>
> ---
>
> Change-Id: Ie3af251d629b911668f8651d868c544f3c11209f
> ---
>  init/main.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/init/main.c b/init/main.c
> index 345a9ab4450f1..4dd15063d32fe 100644
> --- a/init/main.c
> +++ b/init/main.c
> @@ -33,6 +33,7 @@
>  #include <linux/nmi.h>
>  #include <linux/percpu.h>
>  #include <linux/kmod.h>
> +#include <linux/kmsan.h>
>  #include <linux/vmalloc.h>
>  #include <linux/kernel_stat.h>
>  #include <linux/start_kernel.h>
> @@ -772,6 +773,7 @@ static void __init mm_init(void)
>         page_ext_init_flatmem();
>         init_debug_pagealloc();
>         report_meminit();
> +       kmsan_initialize_shadow();
>         mem_init();
>         kmem_cache_init();
>         kmemleak_init();
> @@ -847,6 +849,7 @@ asmlinkage __visible void __init start_kernel(void)
>         sort_main_extable();
>         trap_init();
>         mm_init();
> +       kmsan_initialize();
>
>         ftrace_init();
>
> --
> 2.25.1.696.g5e7596f4ac-goog
>
diff mbox series

Patch

diff --git a/init/main.c b/init/main.c
index 345a9ab4450f1..4dd15063d32fe 100644
--- a/init/main.c
+++ b/init/main.c
@@ -33,6 +33,7 @@ 
 #include <linux/nmi.h>
 #include <linux/percpu.h>
 #include <linux/kmod.h>
+#include <linux/kmsan.h>
 #include <linux/vmalloc.h>
 #include <linux/kernel_stat.h>
 #include <linux/start_kernel.h>
@@ -772,6 +773,7 @@  static void __init mm_init(void)
 	page_ext_init_flatmem();
 	init_debug_pagealloc();
 	report_meminit();
+	kmsan_initialize_shadow();
 	mem_init();
 	kmem_cache_init();
 	kmemleak_init();
@@ -847,6 +849,7 @@  asmlinkage __visible void __init start_kernel(void)
 	sort_main_extable();
 	trap_init();
 	mm_init();
+	kmsan_initialize();
 
 	ftrace_init();