From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751962AbbCPDG0 (ORCPT ); Sun, 15 Mar 2015 23:06:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45779 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751026AbbCPDGY (ORCPT ); Sun, 15 Mar 2015 23:06:24 -0400 Date: Mon, 16 Mar 2015 11:08:18 +0800 From: Minfei Huang To: Yinghai Lu Cc: "H. Peter Anvin" , Ingo Molnar , Kees Cook , Borislav Petkov , Baoquan He , Thomas Gleixner , Jiri Kosina , Andrew Morton , Linus Torvalds , Linux Kernel Mailing List , Matt Fleming Subject: Re: [PATCH v4] x86, kaslr: Access the correct kaslr_enabled variable Message-ID: <20150316030818.GA14862@dhcp-128-1.nay.redhat.com> References: <1426405767-21100-1-git-send-email-yinghai@kernel.org> <20150315121845.GA22920@dhcp-128-1.nay.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) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/15/15 at 10:02am, Yinghai Lu wrote: > On Sun, Mar 15, 2015 at 5:18 AM, Minfei Huang wrote: > > On 03/15/15 at 12:49am, Yinghai Lu wrote: > > It confuses me with the virtual address in function parse_kaslr_setup. > > When we are in here(parse_kaslr_setup), we already use the virtual > > address, instead of physical address. Is it all right? > > setup_data is using physical address to have linked list. > > we have setup_arch==>parse_setup_data(), that is way before > init_mem_mapping() to have final kernel mapping setup yet. > > For 64bit, we may use virtual address with help of early mapping with > #PF handler. > But 32bit, we don't have that. > > So just use early_memmap to get virtual address to access the value. > Hi, Yinghai! Thank you for your reply. I find that the variate kaslr_setup_data is a global variate. Always we can use physical address to access the value. But it is more comfortable that we use the early_memmap to access the value. Thanks Minfei > > > > In the other words, using physical address in parse_kaslr_setup is > > always a mistake, whatever the kaslr is on or off. > > > > The problem is: old code just use physical address as value. > > Thanks > > Yinghai