Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1789892imm; Wed, 16 May 2018 03:09:35 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqKSHyqD704U3KnjQYY1jOIkwsYZcl/3OZ3chgbNcEzksIsigTeTlKpVeD0nDOLLiEzZ80h X-Received: by 2002:a63:ae42:: with SMTP id e2-v6mr202575pgp.424.1526465375595; Wed, 16 May 2018 03:09:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526465375; cv=none; d=google.com; s=arc-20160816; b=XOshKnpymkBsYolK4WYh5BFV4pR4/NDOhAgOhRKY4ohPiO52WW0bFpZXuQ+tdVf1jd ZiDE7aqO4vCWeH989AEAgXs0hAzzjnrwI+RvkUkPHmGvkorXYLHrbe6xGTE/B6C8hNN3 dwsfE77fQigFlPaIdobpOT8+HbGSvO8/IWICJj6yhNX677UFDRL14AztwLM2t6CkL6xc aXZMYTL6RJcZYfCLTC0RRT3tT5KlFt1SWGdjpVtPXC7xpCaGtvHN1u9RYws6TbJ+apLu s8qMHvy6zmzQ/vWXK4w1oDC8MfkQEj04MqkYbMgxCqZ3mA/JGDeLdcl5gKV7Lb3uLSQH r83w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=bcpWP1D1+fc1WEqjPCMzKIiy8mNP9iQVo5O7Xaz/KBI=; b=Jt/i/VFZl4sKztBGjN3SdTIroLSAVWp3q1/5gaUPthpPJ/ZqYgLCarGRMeiT57DPJj 6aqu/mTUVJwQIv0s0UjX734ytZFctXiCeJN2Wx3aqB/MKVkd8lTanBydJ71/LUxHZFPm 9DzBVpry4qPVBhdGhdSNRnk4uDZJY0ZMIlEPZy1t0hAu4s2N0tzLCWZsHaZ0iEdVxXUb olmTgoeRjYDkbgYVWO26e/LN3raYKroI7gX480DoSlfBU+ztJ6uKxAf7BFVM43ot5ihc U8cmGoCWkzxXLnTZeYcH4iLZeOzOOiZ2ylZP0UBiyRlmSA84uDf/z+mNVNF5kZORpSKd +c1A== 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 43-v6si2302615plb.511.2018.05.16.03.09.21; Wed, 16 May 2018 03:09:35 -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 S1752919AbeEPKIf (ORCPT + 99 others); Wed, 16 May 2018 06:08:35 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:48418 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752808AbeEPKFl (ORCPT ); Wed, 16 May 2018 06:05:41 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2D7E9400E9BA; Wed, 16 May 2018 10:05:41 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-8-19.pek2.redhat.com [10.72.8.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id A2DCE2024CBB; Wed, 16 May 2018 10:05:35 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org, mingo@kernel.org, lcapitulino@redhat.com, keescook@chromium.org, tglx@linutronix.de Cc: 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, Baoquan He Subject: [PATCH 0/2] x86/boot/KASLR: Skip specified number of 1GB huge pages when do physical randomization Date: Wed, 16 May 2018 18:05:30 +0800 Message-Id: <20180516100532.14083-1-bhe@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 16 May 2018 10:05:41 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 16 May 2018 10:05:41 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'bhe@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. I ever thought to solve this by specifying available memory regions which kernel KASLR can be randomized into to avoid those good 1GB huge pages. Chao's patches can be used to fix it: https://lkml.org/lkml/2018/2/28/217 Later, Ingo suggested avoiding them in boot KASLR code. https://lkml.org/lkml/2018/3/12/312 So I made this patchset to handle the conflict between 1GB huge pages allocation and KASLR. Any idea or suggestion about the handling, function naming is appreciated. 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 | 84 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 79 insertions(+), 5 deletions(-) -- 2.13.6