From: Cao jin <caoj.fnst@cn.fujitsu.com>
To: <linux-kernel@vger.kernel.org>, <x86@kernel.org>
Cc: <tglx@linutronix.de>, <mingo@redhat.com>, <bp@alien8.de>,
<hpa@zytor.com>, <bhe@redhat.com>, <keescook@chromium.org>,
<fanc.fnst@cn.fujitsu.com>
Subject: [PATCH] x86/boot: minor improvement in kaslr
Date: Fri, 1 Feb 2019 13:48:53 +0800 [thread overview]
Message-ID: <20190201054853.28541-1-caoj.fnst@cn.fujitsu.com> (raw)
comments fix: input_size is ZO image size which just don't count .bss
in, but has .text, .data, etc;
drop unecessary alignment: minimum is either 512M or output, both are
CONFIG_PHYSICAL_ALIGN aligned(output is aligned in head_32/64.S). But
mention it in earlier comments.
Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
---
arch/x86/boot/compressed/kaslr.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c
index 9ed9709d9947..a947c5aba34e 100644
--- a/arch/x86/boot/compressed/kaslr.c
+++ b/arch/x86/boot/compressed/kaslr.c
@@ -360,7 +360,7 @@ static void handle_mem_options(void)
* (i.e. it does not include its run size). This range must be avoided
* because it contains the data used for decompression.
*
- * [input+input_size, output+init_size) is [_text, _end) for ZO. This
+ * [input+input_size, output+init_size) is [_bss, _end) for ZO. This
* range includes ZO's heap and stack, and must be avoided since it
* performs the decompression.
*
@@ -763,9 +763,6 @@ static unsigned long find_random_phys_addr(unsigned long minimum,
return 0;
}
- /* Make sure minimum is aligned. */
- minimum = ALIGN(minimum, CONFIG_PHYSICAL_ALIGN);
-
if (process_efi_entries(minimum, image_size))
return slots_fetch_random();
@@ -831,8 +828,8 @@ void choose_random_location(unsigned long input,
/*
* Low end of the randomization range should be the
- * smaller of 512M or the initial kernel image
- * location:
+ * smaller of 512M or the initial kernel image location.
+ * Should be aligned to CONFIG_PHYSICAL_ALIGN.
*/
min_addr = min(*output, 512UL << 20);
--
2.17.0
next reply other threads:[~2019-02-01 5:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-01 5:48 Cao jin [this message]
2019-02-01 8:20 ` [PATCH] x86/boot: minor improvement in kaslr Kees Cook
2019-02-01 9:41 ` Cao jin
2019-02-13 3:10 ` Cao jin
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=20190201054853.28541-1-caoj.fnst@cn.fujitsu.com \
--to=caoj.fnst@cn.fujitsu.com \
--cc=bhe@redhat.com \
--cc=bp@alien8.de \
--cc=fanc.fnst@cn.fujitsu.com \
--cc=hpa@zytor.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@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;
as well as URLs for NNTP newsgroup(s).