Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp5267496imm; Tue, 26 Jun 2018 08:29:10 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ4LO1etup/6YBR8o2NoSRSiQk+PdgsQ2qDO3EMXOviOuHJQU5kmzV2ol6PF+ezMPKtDEf5 X-Received: by 2002:a63:7101:: with SMTP id m1-v6mr1841630pgc.66.1530026950013; Tue, 26 Jun 2018 08:29:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530026949; cv=none; d=google.com; s=arc-20160816; b=izRKqo7ntLpxdDpKTTtXBe6Dy6W/LjMtd4Y4p/kt9XU1dfUEhVsZK6CXZ1kRt8xHmp +09azmSfZ/drGIrkX/mkqgzB1Zfb7GfbJe51ruhfa4vDAFO7FObf5J0MD3Wo7k7wszaV /gII/LGFIQDOTWu0UdP+P/jimbPv/qutk7OZ9uQB6qMNVGbxxYEE7ErCH3f14csiao4F GQ/4hv4r7vsCY4ONqjj1excy7D5WOKxzLR/xW5BwQCmTI8mRY3ozZ+fsHxXuVJW5gH1/ 0veBolwgZvA9W+WgZK3EigbIjWxtkM+Exl1h/EtOW/Oz2txzvKI/KlDZVytq8jWss+Aq /MKQ== 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:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :arc-authentication-results; bh=/h5jLsl4hgoS8EOtp78+QEfh7CiKZnWXw5ENbSO+7oM=; b=WOzgeqi45UL+73xy/Ag+uOTzhNdfpn+Bt82XYx+USMbogLUmiq++ZnEsg9THq034F0 5iUT4iwSxfebvRsFH+mv4PGiTcztk/SrVlyyMLlMumkKeFtLojx91kQKJ0omb262Aaef yMYGr/figrnmgQTY9rd1VVRcfAKRlnCAY4H5aKbxTehwZdVV0aLxZgs4AD5d00wpZiHj 5CUzrWj7KWpn1q4MensORwIJ7TlgT188had68S6ff2noKKkZA4UIx5KXOdO4IK1YzIpZ cki0UbwvAZotzcsgeqjYHOtam1XJ1fEf8BJqQuBrbWfU+30xuXehqo9BIgVYo7crwdyK 8sHw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s14-v6si1555711pgn.76.2018.06.26.08.28.55; Tue, 26 Jun 2018 08:29:09 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751706AbeFZP0T (ORCPT + 99 others); Tue, 26 Jun 2018 11:26:19 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:54456 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751115AbeFZP0R (ORCPT ); Tue, 26 Jun 2018 11:26:17 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6A0558151D6F; Tue, 26 Jun 2018 15:26:17 +0000 (UTC) Received: from doriath (ovpn-116-226.phx2.redhat.com [10.3.116.226]) by smtp.corp.redhat.com (Postfix) with ESMTP id B5F941117636; Tue, 26 Jun 2018 15:26:14 +0000 (UTC) Date: Tue, 26 Jun 2018 11:06:30 -0400 From: Luiz Capitulino To: Baoquan He Cc: linux-kernel@vger.kernel.org, mingo@kernel.org, keescook@chromium.org, tglx@linutronix.de, x86@kernel.org, hpa@zytor.com, fanc.fnst@cn.fujitsu.com, yasu.isimatu@gmail.com, indou.takao@jp.fujitsu.com, douly.fnst@cn.fujitsu.com Subject: Re: [PATCH v2 0/2] x86/boot/KASLR: Skip specified number of 1GB huge pages when do physical randomization Message-ID: <20180626110630.6080122a@doriath> In-Reply-To: <20180625031656.12443-1-bhe@redhat.com> References: <20180625031656.12443-1-bhe@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Tue, 26 Jun 2018 15:26:17 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Tue, 26 Jun 2018 15:26:17 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'lcapitulino@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 25 Jun 2018 11:16:54 +0800 Baoquan He wrote: > This is a regression bug fix. Luiz's team reported that 1GB huge page > allocation will get one less 1GB page randomly when KASLR is enabled. On > their KVM guest with 4GB RAM, which only has one good 1GB huge page, > they found the 1GB huge page allocation sometime failed with below > kernel option adding. > > default_hugepagesz=1G hugepagesz=1G hugepages=1 > > This is because kernel may be randomized into those good 1GB huge pages. > > And also on those bare-metal machines with larger memory, one less 1GB huge > page might be seen with KASLR enabled than 'nokaslr' specified case. It's > also because that kernel might be randomized into one of those good 1GB huge > pages. > > The solution in this patchset is to skip specified number of GB huge > pages when do kernel physical randomization. If the specified number of GB > huge pages is bigger than amount of good GB huge pages which system can > provide, it's consistent with the current huge page implementation. Reviewed-and-Tested-by: Luiz Capitulino > > v1->v2: > There are several code style problems and typos which were pointed out > by Ingo, fix them in this patchset. > > Baoquan He (2): > x86/boot/KASLR: Add two functions for 1GB huge pages handling > x86/boot/KASLR: Skip specified number of 1GB huge pages when do > physical randomization > > arch/x86/boot/compressed/kaslr.c | 96 +++++++++++++++++++++++++++++++++++++--- > 1 file changed, 91 insertions(+), 5 deletions(-) >