public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Baoquan He <bhe@redhat.com>
To: Ye Xiaolong <xiaolong.ye@intel.com>
Cc: Kees Cook <keescook@chromium.org>,
	lkp@01.org, tipbuild@zytor.com, linux-kernel@vger.kernel.org,
	Yinghai Lu <yinghai@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	"H.J. Lu" <hjl.tools@gmail.com>, "H. Peter Anvin" <hpa@zytor.com>,
	Dmitry Vyukov <dvyukov@google.com>,
	Denys Vlasenko <dvlasenk@redhat.com>,
	Brian Gerst <brgerst@gmail.com>, Borislav Petkov <bp@alien8.de>,
	Andy Lutomirski <luto@kernel.org>,
	Andrey Ryabinin <aryabinin@virtuozzo.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Ingo Molnar <mingo@kernel.org>
Subject: Re: [x86/KASLR]  ed9f007ee6: -- System halted
Date: Fri, 1 Jul 2016 21:14:18 +0800	[thread overview]
Message-ID: <20160701131418.GA18214@x1.redhat.com> (raw)
In-Reply-To: <20160701121626.GA14984@yexl-desktop>

[-- Attachment #1: Type: text/plain, Size: 1849 bytes --]

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 <bhe@redhat.com>
> >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 <bhe@redhat.com>
> >---
> > 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
> >



[-- Attachment #2: e820_avoid_printing.patch --]
[-- Type: text/plain, Size: 1305 bytes --]

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; i<MEM_AVOID_MAX; i++)
+	debug_printf("      mem_avoid[%d]: [0x%010lx-0x%010lx] 0x%08lx: size\n",
+		 i,
+                 (unsigned long)mem_avoid[i].start,
+                 (unsigned long) mem_avoid[i].start + mem_avoid[i].size - 1,
+                 (unsigned long)mem_avoid[i].size);
 
 	/* We don't need to set a mapping for setup_data. */
 
@@ -376,6 +382,11 @@ static void process_e820_entry(struct e820entry *entry,
 	if (entry->type != 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;

  reply	other threads:[~2016-07-01 13:14 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <57712812.r6MdDSquaCRYkMnh%xiaolong.ye@intel.com>
2016-06-27 18:59 ` [x86/KASLR] ed9f007ee6: -- System halted Yinghai Lu
     [not found]   ` <20160628054354.GA9620@yexl-desktop>
     [not found]     ` <CAE9FiQV50UhjJDH89C_T7f2vxFDm7Hpjn78ZKtnfeygQcsf23w@mail.gmail.com>
2016-06-29 20:08       ` Yinghai Lu
2016-06-29 20:29         ` [LKP] " Huang, Ying
2016-06-30  4:49           ` Yinghai Lu
2016-06-30  6:58             ` Ye Xiaolong
2016-07-01  0:24               ` Yinghai Lu
2016-07-01  4:06                 ` Baoquan He
2016-07-01  4:46                   ` Baoquan He
2016-07-01  7:50 ` Baoquan He
2016-07-01 12:16   ` Ye Xiaolong
2016-07-01 13:14     ` Baoquan He [this message]
2016-07-01 13:25       ` Baoquan He

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160701131418.GA18214@x1.redhat.com \
    --to=bhe@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=aryabinin@virtuozzo.com \
    --cc=bp@alien8.de \
    --cc=brgerst@gmail.com \
    --cc=dvlasenk@redhat.com \
    --cc=dvyukov@google.com \
    --cc=hjl.tools@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jpoimboe@redhat.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@01.org \
    --cc=luto@kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=tipbuild@zytor.com \
    --cc=torvalds@linux-foundation.org \
    --cc=xiaolong.ye@intel.com \
    --cc=yinghai@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox