From: Baoquan He <bhe@redhat.com>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org,
Thomas Gleixner <tglx@linutronix.de>,
"H. Peter Anvin" <hpa@zytor.com>
Subject: Re: [PATCH] x86/boot/KASLR: Skip relocation handling in no kaslr case
Date: Tue, 27 Jun 2017 16:55:22 +0800 [thread overview]
Message-ID: <20170627085522.GB26238@x1> (raw)
In-Reply-To: <20170627083458.6xn3udgympkb2y3n@gmail.com>
On 06/27/17 at 10:34am, Ingo Molnar wrote:
>
> * Baoquan He <bhe@redhat.com> wrote:
>
> > As you suggested, we can add a checking to see if the virt_addr is
> > bigger than 1G, and print warning if exceed or hang there with error
> > message.
>
> Could you try a patch for that, and see whether it catches this particular bug?
> (before the fix is applied.)
Sure, below code change should catch it. Just I am struggling to decide
if I should add a new local variable and assign
max(output_len, kernel_total_size) to it, and the name of the new local
variable is really hard to choose. Let me run a test on below code.
diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
index c945acd8fa33..00241c815524 100644
--- a/arch/x86/boot/compressed/misc.c
+++ b/arch/x86/boot/compressed/misc.c
@@ -390,6 +390,8 @@ asmlinkage __visible void *extract_kernel(void *rmode, memptr heap,
#ifdef CONFIG_X86_64
if (heap > 0x3fffffffffffUL)
error("Destination address too large");
+ if (virt_addr + max(output_len, kernel_total_size) > KERNEL_IMAGE_SIZE)
+ error("Destination virtual address is beyond the kernel mapping area");
#else
if (heap > ((-__PAGE_OFFSET-(128<<20)-1) & 0x7fffffff))
error("Destination address too large");
next prev parent reply other threads:[~2017-06-27 8:56 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1498314309-18502-1-git-send-email-bhe@redhat.com>
2017-06-26 9:47 ` [PATCH] x86/boot/KASLR: Skip relocation handling in no kaslr case Ingo Molnar
2017-06-26 10:43 ` Baoquan He
2017-06-27 8:34 ` Ingo Molnar
2017-06-27 8:55 ` Baoquan He [this message]
2017-06-27 22:42 ` Kees Cook
2017-06-27 23:24 ` Baoquan He
2017-06-27 23:33 ` Baoquan He
2017-07-05 19:06 ` Kees Cook
2017-07-06 13:28 ` Baoquan He
2017-07-06 13:54 ` Baoquan He
2017-06-24 14:16 Baoquan He
2017-06-24 14:23 ` 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=20170627085522.GB26238@x1 \
--to=bhe@redhat.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=tglx@linutronix.de \
/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