From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751476AbbCPFVp (ORCPT ); Mon, 16 Mar 2015 01:21:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52331 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750736AbbCPFVn (ORCPT ); Mon, 16 Mar 2015 01:21:43 -0400 Date: Mon, 16 Mar 2015 13:19:35 +0800 From: Baoquan He To: Yinghai Lu Cc: "H. Peter Anvin" , Ingo Molnar , Kees Cook , Borislav Petkov , 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: <20150316051935.GF26587@dhcp-16-105.nay.redhat.com> References: <1426405767-21100-1-git-send-email-yinghai@kernel.org> <20150316032810.GD26587@dhcp-16-105.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:04pm, Yinghai Lu wrote: > On Sun, Mar 15, 2015 at 8:28 PM, Baoquan He wrote: > > On 03/15/15 at 12:49am, Yinghai Lu wrote: > > > > It's good to check the ret value as Boris suggested. However it could > > fail since early_memremap self fail, e.g slot not found. In this case > > making kaslr_enabled true may not be good. > > It should not fail. we always follow map/access/unmap. and sometime > would have two for copying between them. Well, then I would say if add checking too in other places for setup_data handling, e.g parse_setup_data you mentioned. Or don't check at all place to make them consistent. > > > > > As Minfei talked with you kaslr_setup_data is a global variable inside > > kernel code, it has been ident mapped. Just derefencing the physical > > address which is virtual address too and getting the real stored value > > may be safer. > > No. > That ident mapping is set in arch/x86/kernel/head_64.S and it > is only for switchover. and it is gone when > arch/x86/kernel/head64.c::x86_64_start_kernel/reset_early_page_tables > is called. > > That reset_early_page_tables will only keep kernel high mapping > and clear all other. Ah, yes. You are right. I didn't get this clearly, Thanks for telling. Thanks Baoquan > > Thanks > > Yinghai