Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966789AbbBCRt5 (ORCPT ); Tue, 3 Feb 2015 12:49:57 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:52343 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966392AbbBCRn3 (ORCPT ); Tue, 3 Feb 2015 12:43:29 -0500 X-AuditID: cbfec7f5-b7fc86d0000066b7-80-54d1082d70e7 From: Andrey Ryabinin To: linux-kernel@vger.kernel.org Cc: Andrey Ryabinin , Dmitry Vyukov , Konstantin Serebryany , Dmitry Chernenkov , Andrey Konovalov , Yuri Gribov , Konstantin Khlebnikov , Sasha Levin , Christoph Lameter , Joonsoo Kim , Andrew Morton , Dave Hansen , Andi Kleen , x86@kernel.org, linux-mm@kvack.org Subject: [PATCH v11 03/19] kasan: disable memory hotplug Date: Tue, 03 Feb 2015 20:42:56 +0300 Message-id: <1422985392-28652-4-git-send-email-a.ryabinin@samsung.com> X-Mailer: git-send-email 2.2.2 In-reply-to: <1422985392-28652-1-git-send-email-a.ryabinin@samsung.com> References: <1404905415-9046-1-git-send-email-a.ryabinin@samsung.com> <1422985392-28652-1-git-send-email-a.ryabinin@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrCLMWRmVeSWpSXmKPExsVy+t/xK7q6HBdDDDa/NrDY9usRm8XvvTNZ LeasX8NmceTad3aL69/eMFp8evmA0eL5w4fsFhMetrFbrOxuZrPY/uwtk8XKzgesFpd3zWGz uLfmP6vF4iO3mS3ePZvMbPFjw2NWBwGP+Ts/MnrsnHWX3WPBplKPxXteMnlsWtXJ5rHp0yR2 j663V5g8Tsz4zeLx5Mp0Jo+PT2+xePRtWcXo8XmTXABPFJdNSmpOZllqkb5dAlfGgf3vGQt+ cVc8ejqVpYGxiauLkZNDQsBE4uiktcwQtpjEhXvr2UBsIYGljBIfThZ2MXIB2X1MEj8WzWIE SbAJ6En8m7UdrEhEQEFic+8zVpAiZoEVLBJfrq0AKxIWsJDovfsHbCqLgKrE/v99QDYHB6+A m8SWNWCmhICcxIWP8SAVnALuEvv6nzFC7GpilHizuIV5AiPvAkaGVYyiqaXJBcVJ6blGesWJ ucWleel6yfm5mxghIf91B+PSY1aHGAU4GJV4eDXeXQgRYk0sK67MPcQowcGsJMK75zdQiDcl sbIqtSg/vqg0J7X4ECMTB6dUA2Pg8Qevr1TudGRzPd6kuP1BSNDCbrfyWf2x17ZMNcvNC1Q7 y8L7f9bNyU/t6wpq63bcqp25wzurbeXuy5PVp97Q3qcXpHnrzALnhpOCl/flZtQ2zltdxbu6 eLPihync/DH7+e4KXY+1Zr298WBuqnTDp9zcz6/2rt/aGnHNx6/90ttHTTLeBc+UWIozEg21 mIuKEwH0hB+uVwIAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1721 Lines: 59 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: Andrey Ryabinin --- mm/kasan/kasan.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/mm/kasan/kasan.c b/mm/kasan/kasan.c index 6dc1aa7..def8110 100644 --- a/mm/kasan/kasan.c +++ b/mm/kasan/kasan.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -300,3 +301,23 @@ EXPORT_SYMBOL(__asan_storeN_noabort); /* to shut up compiler complaints */ void __asan_handle_no_return(void) {} EXPORT_SYMBOL(__asan_handle_no_return); + +#ifdef CONFIG_MEMORY_HOTPLUG +static int kasan_mem_notifier(struct notifier_block *nb, + unsigned long action, void *data) +{ + return (action == MEM_GOING_ONLINE) ? NOTIFY_BAD : NOTIFY_OK; +} + +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; +} + +module_init(kasan_memhotplug_init); +#endif -- 2.2.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/