From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932693AbcCINk2 (ORCPT ); Wed, 9 Mar 2016 08:40:28 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59345 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753536AbcCINkU (ORCPT ); Wed, 9 Mar 2016 08:40:20 -0500 Date: Wed, 9 Mar 2016 21:40:09 +0800 From: Baoquan He To: Kees Cook Cc: LKML , Yinghai Lu , "H. Peter Anvin" , Vivek Goyal , Ingo Molnar , Borislav Petkov , Andy Lutomirski , lasse.collin@tukaani.org, Andrew Morton , Dave Young Subject: Re: [PATCH v3 16/19] x86, kaslr: Randomize physical and virtual address of kernel separately Message-ID: <20160309134009.GC2555@x1.redhat.com> References: <1457108717-12191-1-git-send-email-bhe@redhat.com> <1457108717-12191-17-git-send-email-bhe@redhat.com> <20160308053442.GI2481@x1.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 09 Mar 2016 13:40:20 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/08/16 at 10:24am, Kees Cook wrote: > On Mon, Mar 7, 2016 at 9:34 PM, Baoquan He wrote: > >> It seems like CONFIG_RANDOMIZE_BASE_MAX_OFFSET should have been > >> eliminated when the on-demand page table code was added. Once that was > >> added, there's no physical max any more. And virtual randomization > >> should have no max at all. > > For physically random, yes, CONFIG_RANDOMIZE_BASE_MAX_OFFSET is not > > needed anymore. But for virtually random, > > CONFIG_RANDOMIZE_BASE_MAX_OFFSET is still mandatory since kernel text > > mapping and kernel module mapping share the 2G virtual address space as > > follows. Though kaslr increase kernel text mapping from 512M to 1G, it's > > still limited, can't exceed CONFIG_RANDOMIZE_BASE_MAX_OFFSET. > > > > [0xffffffff80000000, 0xffffffffffffffff] > > > > But now as you suggested, I would like to change > > CONFIG_RANDOMIZE_BASE_MAX_OFFSET to another name because it's only > > valid for virtual randomization. A more specific name is better. > > Yes, right, the virtual has a 1G max, but I meant that it doesn't need > to be a CONFIG item any more. Physical can use physical memory max as > its max, and virtual max can now be calculated from the existing text > mapping size. Got it, it should be KERNEL_IMAGE_SIZE instead, right?