Commit 786a8959 authored by Andrey Ryabinin's avatar Andrey Ryabinin Committed by Linus Torvalds
Browse files

kasan: disable memory hotplug

Currently memory hotplug won't work with KASan.  As we don't have shadow
for hotplugged memory, kernel will crash on the first access to it.  To
make this work we will need to allocate shadow for new memory.

At some future point proper memory hotplug support will be implemented.
Until then, print a warning at startup and disable memory hot-add.

Signed-off-by: default avatarAndrey Ryabinin <>
Cc: Dmitry Vyukov <>
Cc: Konstantin Serebryany <>
Cc: Dmitry Chernenkov <>
Signed-off-by: default avatarAndrey Konovalov <>
Cc: Yuri Gribov <>
Cc: Konstantin Khlebnikov <>
Cc: Sasha Levin <>
Cc: Christoph Lameter <>
Cc: Joonsoo Kim <>
Cc: Dave Hansen <>
Cc: Andi Kleen <>
Cc: Ingo Molnar <>
Cc: Thomas Gleixner <>
Cc: "H. Peter Anvin" <>
Cc: Christoph Lameter <>
Cc: Pekka Enberg <>
Cc: David Rientjes <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 0b24becc
......@@ -20,6 +20,7 @@
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/memblock.h>
#include <linux/memory.h>
#include <linux/mm.h>
#include <linux/printk.h>
#include <linux/sched.h>
......@@ -300,3 +301,23 @@ EXPORT_SYMBOL(__asan_storeN_noabort);
/* to shut up compiler complaints */
void __asan_handle_no_return(void) {}
static int kasan_mem_notifier(struct notifier_block *nb,
unsigned long action, void *data)
static int __init kasan_memhotplug_init(void)
pr_err("WARNING: KASan doesn't support memory hot-add\n");
pr_err("Memory hot-add will be disabled\n");
hotplug_memory_notifier(kasan_mem_notifier, 0);
return 0;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment