Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1451114
| From | Borislav Petkov <bp@suse.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH -v2 2/2] x86/microcode/intel: Fix initrd loading with CONFIG_RANDOMIZE_MEMORY |
| Date | 2016-07-27 10:20 +0200 |
| Message-ID | <rZsel-5j9-11@gated-at.bofh.it> (permalink) |
| References | <rZ7jz-lC-11@gated-at.bofh.it> <rZeuK-4Z7-29@gated-at.bofh.it> <rZhiW-6Jx-13@gated-at.bofh.it> <rZpTb-3KT-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Borislav Petkov <bp@suse.de>
CONFIG_RANDOMIZE_MEMORY 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>
---
arch/x86/kernel/cpu/microcode/intel.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c
index 6515c802346a..2a542b71d910 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,18 @@ void load_ucode_intel_ap(void)
if (!mcs->num_saved)
return;
+ if (blobs_p->valid) {
+ start = blobs_p->start;
+
+ /*
+ * Pay attention to CONFIG_RANDOMIZE_MEMORY as it shuffles
+ * physmem mapping too and there we have the initrd.
+ */
+ start += (PAGE_OFFSET - __PAGE_OFFSET_BASE);
+ }
+
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;
--
2.8.4
--
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] x86/microcode/intel: Fix initrd loading with CONFIG_RANDOMIZE_MEMORY Borislav Petkov <bp@alien8.de> - 2016-07-26 12:00 +0200
[tip:x86/microcode] x86/microcode/intel: Fix initrd loading with CONFIG_RANDOMIZE_MEMORY=y tip-bot for Borislav Petkov <tipbot@zytor.com> - 2016-07-26 19:40 +0200
Re: [tip:x86/microcode] x86/microcode/intel: Fix initrd loading with CONFIG_RANDOMIZE_MEMORY=y Kees Cook <keescook@chromium.org> - 2016-07-26 22:40 +0200
Re: [tip:x86/microcode] x86/microcode/intel: Fix initrd loading with CONFIG_RANDOMIZE_MEMORY=y Borislav Petkov <bp@suse.de> - 2016-07-27 07:50 +0200
[PATCH -v2 2/2] x86/microcode/intel: Fix initrd loading with CONFIG_RANDOMIZE_MEMORY Borislav Petkov <bp@suse.de> - 2016-07-27 10:20 +0200
[PATCH -v2 1/2] x86/asm: Add __PAGE_OFFSET_BASE define on 32-bit Borislav Petkov <bp@suse.de> - 2016-07-27 10:20 +0200
Re: [PATCH -v2 1/2] x86/asm: Add __PAGE_OFFSET_BASE define on 32-bit Ingo Molnar <mingo@kernel.org> - 2016-07-27 11:10 +0200
Re: [PATCH -v2 1/2] x86/asm: Add __PAGE_OFFSET_BASE define on 32-bit Borislav Petkov <bp@suse.de> - 2016-07-27 11:20 +0200
Re: [PATCH -v2 1/2] x86/asm: Add __PAGE_OFFSET_BASE define on 32-bit Ingo Molnar <mingo@kernel.org> - 2016-07-27 12:40 +0200
[PATCH] x86/asm, microcode: Add __PAGE_OFFSET_BASE define on 32-bit Borislav Petkov <bp@suse.de> - 2016-07-27 14:10 +0200
[tip:x86/microcode] x86/asm, x86/microcode: Add __PAGE_OFFSET_BASE define on 32-bit tip-bot for Borislav Petkov <tipbot@zytor.com> - 2016-07-27 19:20 +0200
csiph-web