From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752288AbcGANOt (ORCPT ); Fri, 1 Jul 2016 09:14:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59343 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751932AbcGANOs (ORCPT ); Fri, 1 Jul 2016 09:14:48 -0400 Date: Fri, 1 Jul 2016 21:14:18 +0800 From: Baoquan He To: Ye Xiaolong Cc: Kees Cook , lkp@01.org, tipbuild@zytor.com, linux-kernel@vger.kernel.org, Yinghai Lu , Thomas Gleixner , Peter Zijlstra , Linus Torvalds , Josh Poimboeuf , "H.J. Lu" , "H. Peter Anvin" , Dmitry Vyukov , Denys Vlasenko , Brian Gerst , Borislav Petkov , Andy Lutomirski , Andrey Ryabinin , Andrew Morton , Ingo Molnar Subject: Re: [x86/KASLR] ed9f007ee6: -- System halted Message-ID: <20160701131418.GA18214@x1.redhat.com> References: <57712812.r6MdDSquaCRYkMnh%xiaolong.ye@intel.com> <20160701075032.GC10467@x1.redhat.com> <20160701121626.GA14984@yexl-desktop> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="C7zPtVaVf+AK4Oqc" Content-Disposition: inline In-Reply-To: <20160701121626.GA14984@yexl-desktop> 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.28]); Fri, 01 Jul 2016 13:14:22 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --C7zPtVaVf+AK4Oqc Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On 07/01/16 at 08:16pm, Ye Xiaolong wrote: > On Fri, Jul 01, 2016 at 03:50:32PM +0800, Baoquan He wrote: > >Hi Xiaolong, > > > >Could you please apply below patch and see if it works for you? > > Hi, Baoquan, > > Please check enclosed dmesg after apply your fix patch, does it meet > your expectation? It works, but didn't get a random phy addr. I am a little worried. I guess your system has a very small physical memory space. Could you apply attached patch on top of fix patch and Yinghai's debug patch and paste the result? I want to check the physical memory and mem_avoid region to make sure it. Or if you can paste /proc/iomem I can have a quick check, then you don't need to run the patch. > > Thanks, > Xiaolong > > > > >From 46c2a9ecd11f61d952253e005bbd7dcbffa652fb Mon Sep 17 00:00:00 2001 > >From: Baoquan He > >Date: Fri, 1 Jul 2016 15:34:40 +0800 > >Subject: [PATCH] x86/KASLR: Fix code bug of finding earliest overlap > > > >Signed-off-by: Baoquan He > >--- > > arch/x86/boot/compressed/kaslr.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > >diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c > >index 304c5c3..8e1fdf7 100644 > >--- a/arch/x86/boot/compressed/kaslr.c > >+++ b/arch/x86/boot/compressed/kaslr.c > >@@ -285,6 +285,7 @@ static bool mem_avoid_overlap(struct mem_vector *img, > > if (mem_overlaps(img, &mem_avoid[i]) && > > mem_avoid[i].start < earliest) { > > *overlap = mem_avoid[i]; > >+ earliest = overlap->start; > > is_overlapping = true; > > } > > } > >@@ -299,6 +300,7 @@ static bool mem_avoid_overlap(struct mem_vector *img, > > > > if (mem_overlaps(img, &avoid) && (avoid.start < earliest)) { > > *overlap = avoid; > >+ earliest = overlap->start; > > is_overlapping = true; > > } > > > >-- > >2.5.5 > > --C7zPtVaVf+AK4Oqc Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="e820_avoid_printing.patch" diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c index 8e1fdf7..f2bd558 100644 --- a/arch/x86/boot/compressed/kaslr.c +++ b/arch/x86/boot/compressed/kaslr.c @@ -260,6 +260,12 @@ static void mem_avoid_init(unsigned long input, unsigned long input_size, mem_avoid[MEM_AVOID_BOOTPARAMS].size = sizeof(*boot_params); add_identity_map(mem_avoid[MEM_AVOID_BOOTPARAMS].start, mem_avoid[MEM_AVOID_BOOTPARAMS].size); + for(int i=0; itype != E820_RAM) return; + debug_printf(" e820 entry: [0x%010lx-0x%010lx] 0x%08lx: size\n", + (unsigned long)entry->addr, + (unsigned long)entry->addr + entry->size - 1, + (unsigned long)entry->size); + /* On 32-bit, ignore entries entirely above our maximum. */ if (IS_ENABLED(CONFIG_X86_32) && entry->addr >= KERNEL_IMAGE_SIZE) return; --C7zPtVaVf+AK4Oqc--