From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753093AbbCDXle (ORCPT ); Wed, 4 Mar 2015 18:41:34 -0500 Received: from mx1.redhat.com ([209.132.183.28]:50814 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753015AbbCDXlc (ORCPT ); Wed, 4 Mar 2015 18:41:32 -0500 Date: Thu, 5 Mar 2015 07:41:10 +0800 From: Baoquan He To: Yinghai Lu Cc: "H. Peter Anvin" , Kees Cook , Vivek Goyal , Andy Lutomirski , Andrew Morton , Thomas Gleixner , Ingo Molnar , Linux Kernel Mailing List Subject: Re: [PATCH v2 9/9] change the relocations behavior for kaslr on x86_64 Message-ID: <20150304234110.GA1610@dhcp-17-102.nay.redhat.com> References: <1425308310-2318-1-git-send-email-bhe@redhat.com> <1425308310-2318-10-git-send-email-bhe@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/04/15 at 03:16pm, Yinghai Lu wrote: > On Mon, Mar 2, 2015 at 6:58 AM, Baoquan He wrote: > > > @@ -455,17 +455,16 @@ unsigned char *choose_kernel_location(struct boot_params *params, > > output_size); > > you forgot to change > > /* Record the various known unsafe memory ranges. */ > mem_avoid_init((unsigned long)input, input_size, > (unsigned long)output, init_size); > > to > > /* Record the various known unsafe memory ranges. */ > mem_avoid_init((unsigned long)input, input_size, > (unsigned long)*output, init_size); No, I removed output in patch 1/9 since it's not used in mem_avoid_init(). It doesn't have this problem. But in next post it need be done like this. > > > > > /* Walk e820 and find a random address. */ > > - random = find_random_addr(choice, output_size); > > - if (!random) { > > + random = find_random_phy_addr((unsigned long)*output, output_size); > > + if (!random) > > debug_putstr("KASLR could not find suitable E820 region...\n"); > > - goto out; > > - } > > + else > > + *output = (unsigned char*)random;