From: Baoquan He <bhe@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: x86@kernel.org, hpa@zytor.com, tglx@linutronix.de,
mingo@kernel.org, keescook@chromium.org, thgarnie@google.com,
caoj.fnst@cn.fujitsu.com, izumi.taku@jp.fujitsu.com,
Baoquan He <bhe@redhat.com>
Subject: [PATCH v2 0/2] x86/boot/KASLR: Restrict kernel to be randomized in mirror regions
Date: Tue, 4 Jul 2017 16:04:00 +0800 [thread overview]
Message-ID: <1499155442-17467-1-git-send-email-bhe@redhat.com> (raw)
Our customer reported that Kernel text may be located on non-mirror
region (movable zone) when both address range mirroring feature and
KASLR are enabled.
The functions of address range mirroring feature are as follows.
- The physical memory region whose descriptors in EFI memory map have
EFI_MEMORY_MORE_RELIABLE attribute (bit: 16) are mirrored
- The function arranges such mirror region into normal zone and other region
into movable zone in order to locate kernel code and data on mirror region
So we need restrict kernel to be located inside mirror regions if it
is existed.
The method is very simple. If efi is enabled, just iterate all efi
memory map and pick mirror region to process for adding candidate
of slot. If efi disabled or no mirror region existed, still process
e820 memory map. This won't bring much efficiency loss, at worst we
just go through all efi memory maps and found no mirror.
v1->v2:
Removed debug code.
Taku suggested that we should put kernel to mirrored region always
whether or not "kernelcore=mirror" is specified since kernel text is
important and mirrored region is reliable.
Change code according to kbuild report and Chao Fan's comment.
Test:
Chao has tested the v1 (RFC patchset) 100 times. And he said in the 100
times, 50 times are with this patchset applied, 50 times are without it.
The test result showed the v1 patchset works very well.
Baoquan He (2):
x86/boot/KASLR: Adapt process_e820_entry for any type of memory entry
x86/boot/KASLR: Restrict kernel to be randomized in mirror regions
arch/x86/boot/compressed/kaslr.c | 108 +++++++++++++++++++++++++++++----------
1 file changed, 82 insertions(+), 26 deletions(-)
--
2.5.5
next reply other threads:[~2017-07-04 8:04 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-04 8:04 Baoquan He [this message]
2017-07-04 8:04 ` [PATCH v2 1/2] x86/boot/KASLR: Adapt process_e820_entry for any type of memory entry Baoquan He
2017-07-05 22:06 ` Kees Cook
2017-07-06 1:21 ` Baoquan He
2017-07-04 8:04 ` [PATCH v2 2/2] x86/boot/KASLR: Restrict kernel to be randomized in mirror regions Baoquan He
2017-07-04 14:00 ` Thomas Gleixner
2017-07-04 14:30 ` Baoquan He
2017-07-04 14:46 ` Thomas Gleixner
2017-07-04 15:36 ` Matt Fleming
2017-07-04 15:46 ` Thomas Gleixner
2017-07-04 23:16 ` 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=1499155442-17467-1-git-send-email-bhe@redhat.com \
--to=bhe@redhat.com \
--cc=caoj.fnst@cn.fujitsu.com \
--cc=hpa@zytor.com \
--cc=izumi.taku@jp.fujitsu.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=tglx@linutronix.de \
--cc=thgarnie@google.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.