Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1703294imm; Wed, 1 Aug 2018 22:47:45 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfvKaczhnl92Cw7qjLVEsMgYA6qoOz0ow1/pATdMlNZ87BVrrfq3g0OlawXKGwIAhc0oTpW X-Received: by 2002:a63:7412:: with SMTP id p18-v6mr1236159pgc.395.1533188865017; Wed, 01 Aug 2018 22:47:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533188864; cv=none; d=google.com; s=arc-20160816; b=FFf8EzmvmYo69IuRy5+jYiwe+eK2qF5MQ5vYoSzH4nIAO1cQGlAFCR2jcLm3sS1jCe LJXXvZhgp8VjzAaas3kXJTY+C3d46cAtgd1WeSigSClxvOt0AlJB3waUB1nsAinytBdi 5PVOpSLpcMYwQxYEd+nwyPN8uz3lLuQWCWbc3Xo4FktUMmNx0lypjlWLQjhhZGuI/Ap2 h1Awxye/jjltoOpMlPYq2ScF1QS6MBp48aEQDAvhRR6Lq4+Fnty35gqFdxblr4POAsdB AHGS2EFjKawu2EmOb5kTKZNE/c6+A/0Gpwnta8QzVsPJLZm/Sgr4kEGxGMa8J/CboI38 vmbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=w6DPXYPL93/WLqjq6k/QTSW5gZIUyLwzpIiqJrc/Qaw=; b=ZJ2tD/4Nhmy9FyXFTkSCxJNHIFu0p9VMd7KYbgoSVDMoytC0/WhXA5/jAAycEI3NoI t8tcJ75UP57ZPYAqfw7+1P5bRB5l6+J8CMw4PVTh5jtPNCuNxKj2xznVdWrta81sxczN Re3dxHUkZeem7xyQll04XrI2m+EhBhG0zGB6I23gXwqE455ZJwFvCFoSJwvPRXu7H4kL xKahAunA1w6LG8LixeLN+ndIaXaIZDg1SYXTsyGqn6TxXJOIAEGIsdUGf01vlo50oseG redD71bmDC64qCDNK1a7MX9XI1QFajRE2uBsdCkk0SqCFO9cHJmOkNpJBC9k3x0EFLtK hPIw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m14-v6si974633pfh.92.2018.08.01.22.47.29; Wed, 01 Aug 2018 22:47:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726137AbeHBHgH (ORCPT + 99 others); Thu, 2 Aug 2018 03:36:07 -0400 Received: from mail.cn.fujitsu.com ([183.91.158.132]:33941 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726018AbeHBHgH (ORCPT ); Thu, 2 Aug 2018 03:36:07 -0400 X-IronPort-AV: E=Sophos;i="5.43,368,1503331200"; d="scan'208";a="42971092" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 02 Aug 2018 13:46:31 +0800 Received: from G08CNEXCHPEKD03.g08.fujitsu.local (unknown [10.167.33.85]) by cn.fujitsu.com (Postfix) with ESMTP id 617754B66A09; Thu, 2 Aug 2018 13:46:31 +0800 (CST) Received: from localhost.localdomain (10.167.226.106) by G08CNEXCHPEKD03.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.399.0; Thu, 2 Aug 2018 13:46:33 +0800 Subject: Re: [PATCH v4 4/4] x86/boot/KASLR: Limit kaslr to choosing the immovable memory To: Chao Fan , , , , , , , , CC: , References: <20180723092908.32656-1-fanc.fnst@cn.fujitsu.com> <20180723092908.32656-5-fanc.fnst@cn.fujitsu.com> From: Dou Liyang Message-ID: <961acf17-c76f-1c51-f7e6-a7854a487a09@cn.fujitsu.com> Date: Thu, 2 Aug 2018 13:46:29 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180723092908.32656-5-fanc.fnst@cn.fujitsu.com> Content-Type: text/plain; charset="gbk"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.167.226.106] X-yoursite-MailScanner-ID: 617754B66A09.A975E X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: douly.fnst@cn.fujitsu.com X-Spam-Status: No Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Fan, At 07/23/2018 05:29 PM, Chao Fan wrote: > If 'CONFIG_MEMORY_HOTREMOVE' specified and the account of immovable > memory regions is not zero. Calculate the intersection between memory > regions from e820/efi memory table and immovable memory regions. > Or go on the old code. > > Rename process_mem_region to slots_count to match slots_fetch_random, > and name new function as process_mem_region. > > Signed-off-by: Chao Fan > --- > arch/x86/boot/compressed/kaslr.c | 66 ++++++++++++++++++++++++++------ > 1 file changed, 55 insertions(+), 11 deletions(-) > > diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c > index 4705682caf1f..10bda3a1fcaa 100644 > --- a/arch/x86/boot/compressed/kaslr.c > +++ b/arch/x86/boot/compressed/kaslr.c > @@ -631,9 +631,9 @@ static unsigned long slots_fetch_random(void) > return 0; > } > > -static void process_mem_region(struct mem_vector *entry, > - unsigned long minimum, > - unsigned long image_size) > +static void slots_count(struct mem_vector *entry, ^^^^^^^^^^^ is not suitable. IMO, how about process_mem_slots() or you may have a better name, it's up to you. > + unsigned long minimum, > + unsigned long image_size) > { > struct mem_vector region, overlap; > struct slot_area slot_area; slot_area is also unused. Thanks, dou