From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933554AbcLIOmJ (ORCPT ); Fri, 9 Dec 2016 09:42:09 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47142 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932594AbcLIOmI (ORCPT ); Fri, 9 Dec 2016 09:42:08 -0500 From: Baoquan He To: linux-kernel@vger.kernel.org Cc: tglx@linutronix.de, hpa@zytor.com, mingo@redhat.com, x86@kernel.org, keescook@chromium.org, yinghai@kernel.org, bp@suse.de, thgarnie@google.com, kuleshovmail@gmail.com, luto@kernel.org, mcgrof@kernel.org, anderson@redhat.com, dyoung@redhat.com, xlpang@redhat.com, Baoquan He Subject: [PATCH v2 0/2] Determine kernel text mapping size at runtime for x86_64 Date: Fri, 9 Dec 2016 22:41:56 +0800 Message-Id: <1481294518-29595-1-git-send-email-bhe@redhat.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 09 Dec 2016 14:42:07 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The current kernel sets KERNEL_IMAGE_SIZE as 1G as long as CONFIG_RANDOMIZE_BASE is enabled, though people specify "nokaslr" into cmdline to disable kaslr explicitly. This could be a wrong behaviour. CONFIG_RANDOMIZE_BASE should only decide if KASLR code need be compiled in. If user specify "nokaslr", kernel should should behave as no KASLR code compiled in at all. So in this patchset, made changes to determine the size of kernel text mapping area at runtime. If "nokaslr" specified, kernel mapping size is 512M though CONFIG_RANDOMIZE_BASE is enabled. Baoquan He (2): x86/64: Make kernel text mapping always take one whole page table in early boot code x86/KASLR/64: Determine kernel text mapping size at runtime arch/x86/boot/compressed/kaslr.c | 20 +++++++++++++++----- arch/x86/include/asm/kaslr.h | 1 + arch/x86/include/asm/page_64_types.h | 20 ++++++++++++-------- arch/x86/include/asm/pgtable_64_types.h | 2 +- arch/x86/kernel/head64.c | 11 ++++++----- arch/x86/kernel/head_64.S | 16 +++++++++------- arch/x86/mm/dump_pagetables.c | 3 ++- arch/x86/mm/init_64.c | 2 +- arch/x86/mm/physaddr.c | 6 +++--- 9 files changed, 50 insertions(+), 31 deletions(-) -- 2.5.5