Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752993AbeAQK4i (ORCPT + 1 other); Wed, 17 Jan 2018 05:56:38 -0500 Received: from mail.cn.fujitsu.com ([183.91.158.132]:24168 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752446AbeAQKzR (ORCPT ); Wed, 17 Jan 2018 05:55:17 -0500 X-IronPort-AV: E=Sophos;i="5.43,368,1503331200"; d="scan'208";a="35406316" From: Chao Fan To: , , , , , , , CC: , , Chao Fan Subject: [PATCH v7 3/5] x86/KASLR: Give a warning if movable_node specified without kaslr_mem= Date: Wed, 17 Jan 2018 18:53:49 +0800 Message-ID: <20180117105351.12226-4-fanc.fnst@cn.fujitsu.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180117105351.12226-1-fanc.fnst@cn.fujitsu.com> References: <20180117105351.12226-1-fanc.fnst@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain X-yoursite-MailScanner-ID: 8902549F19A4.A7CD7 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: fanc.fnst@cn.fujitsu.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: Since only 'movable_node' specified without 'kaslr_mem=' may break memory hotplug, so reconmmend users using 'kaslr_mem=' when 'movable_node' specified.. Signed-off-by: Chao Fan --- arch/x86/boot/compressed/kaslr.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c index b200a7ceafc1..dca846b522fc 100644 --- a/arch/x86/boot/compressed/kaslr.c +++ b/arch/x86/boot/compressed/kaslr.c @@ -282,6 +282,16 @@ static int handle_mem_filter(void) !strstr(args, "kaslr_mem=")) return 0; +#ifdef CONFIG_MEMORY_HOTPLUG + /* + * Check if "kaslr_mem=" specified when "movable_node" found. If not, + * just give warrning. Otherwise memory hotplug could be + * affected if kernel put on movable memory regions. + */ + if (strstr(args, "movable_node") && !strstr(args, "kaslr_mem=")) + warn("kaslr_mem= should specified when using movable_node.\n"); +#endif + tmp_cmdline = malloc(len + 1); if (!tmp_cmdline) error("Failed to allocate space for tmp_cmdline"); -- 2.14.3