From: tip-bot for Borislav Petkov <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: bp@suse.de, mingo@kernel.org, keescook@chromium.org,
peterz@infradead.org, torvalds@linux-foundation.org,
tglx@linutronix.de, hpa@zytor.com, nicstange@gmail.com,
linux-kernel@vger.kernel.org
Subject: [tip:x86/microcode] x86/microcode/intel: Fix initrd loading with CONFIG_RANDOMIZE_MEMORY=y
Date: Tue, 26 Jul 2016 10:37:01 -0700 [thread overview]
Message-ID: <tip-efaad554b4ffae1840a2759e09e21325ddbc8b05@git.kernel.org> (raw)
In-Reply-To: <20160726095138.3470-1-bp@alien8.de>
Commit-ID: efaad554b4ffae1840a2759e09e21325ddbc8b05
Gitweb: http://git.kernel.org/tip/efaad554b4ffae1840a2759e09e21325ddbc8b05
Author: Borislav Petkov <bp@suse.de>
AuthorDate: Tue, 26 Jul 2016 11:51:38 +0200
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 26 Jul 2016 19:32:57 +0200
x86/microcode/intel: Fix initrd loading with CONFIG_RANDOMIZE_MEMORY=y
CONFIG_RANDOMIZE_MEMORY=y randomizes the physical memmap and thus the
address where the initrd is located. Therefore, we need to add the
offset KASLR put us to in order to find the initrd again on the AP path.
In the future, we will get rid of the initrd address caching and query
the address on both the BSP and AP paths but that would need more work.
Thanks to Nicolai Stange for the good bisection and debugging work.
Reported-and-tested-by: Nicolai Stange <nicstange@gmail.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Kees Cook <keescook@chromium.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20160726095138.3470-1-bp@alien8.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/kernel/cpu/microcode/intel.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c
index 6515c80..0f97ae9 100644
--- a/arch/x86/kernel/cpu/microcode/intel.c
+++ b/arch/x86/kernel/cpu/microcode/intel.c
@@ -793,10 +793,10 @@ void __init load_ucode_intel_bsp(void)
void load_ucode_intel_ap(void)
{
struct ucode_blobs *blobs_p;
+ unsigned long *ptrs, start = 0;
struct mc_saved_data *mcs;
struct ucode_cpu_info uci;
enum ucode_state ret;
- unsigned long *ptrs;
#ifdef CONFIG_X86_32
mcs = (struct mc_saved_data *)__pa_nodebug(&mc_saved_data);
@@ -815,8 +815,20 @@ void load_ucode_intel_ap(void)
if (!mcs->num_saved)
return;
+ if (blobs_p->valid) {
+ start = blobs_p->start;
+
+#ifdef CONFIG_RANDOMIZE_MEMORY
+ /*
+ * Pay attention to CONFIG_RANDOMIZE_MEMORY=y as it shuffles
+ * physmem mapping too and there we have the initrd.
+ */
+ start += PAGE_OFFSET - __PAGE_OFFSET_BASE;
+#endif
+ }
+
collect_cpu_info_early(&uci);
- ret = load_microcode(mcs, ptrs, blobs_p->start, &uci);
+ ret = load_microcode(mcs, ptrs, start, &uci);
if (ret != UCODE_OK)
return;
next prev parent reply other threads:[~2016-07-26 17:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-26 9:51 [PATCH] x86/microcode/intel: Fix initrd loading with CONFIG_RANDOMIZE_MEMORY Borislav Petkov
2016-07-26 17:37 ` tip-bot for Borislav Petkov [this message]
2016-07-26 20:37 ` [tip:x86/microcode] x86/microcode/intel: Fix initrd loading with CONFIG_RANDOMIZE_MEMORY=y Kees Cook
2016-07-27 5:45 ` Borislav Petkov
2016-07-27 8:09 ` [PATCH -v2 1/2] x86/asm: Add __PAGE_OFFSET_BASE define on 32-bit Borislav Petkov
2016-07-27 9:05 ` Ingo Molnar
2016-07-27 9:10 ` Borislav Petkov
2016-07-27 10:36 ` Ingo Molnar
2016-07-27 12:09 ` [PATCH] x86/asm, microcode: " Borislav Petkov
2016-07-27 17:10 ` [tip:x86/microcode] x86/asm, x86/microcode: " tip-bot for Borislav Petkov
2016-07-27 8:11 ` [PATCH -v2 2/2] x86/microcode/intel: Fix initrd loading with CONFIG_RANDOMIZE_MEMORY Borislav Petkov
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=tip-efaad554b4ffae1840a2759e09e21325ddbc8b05@git.kernel.org \
--to=tipbot@zytor.com \
--cc=bp@suse.de \
--cc=hpa@zytor.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=nicstange@gmail.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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