From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752657AbdFLR7h (ORCPT ); Mon, 12 Jun 2017 13:59:37 -0400 Received: from mail.skyhub.de ([5.9.137.197]:38674 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752366AbdFLR7T (ORCPT ); Mon, 12 Jun 2017 13:59:19 -0400 From: Borislav Petkov To: Dominik Brodowski , Henrique de Moraes Holschuh Cc: LKML Subject: [PATCH 1/2] x86/microcode: Look for the initrd at the proper address on 32-bit Date: Mon, 12 Jun 2017 19:58:53 +0200 Message-Id: <20170612175854.14196-2-bp@alien8.de> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170612175854.14196-1-bp@alien8.de> References: <20170612175854.14196-1-bp@alien8.de> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Borislav Petkov Early during boot, the BSP finds the ramdisk's position from boot_params but by the time the APs get to boot, the BSP has continued in the mean time and has potentially managed to relocate that ramdisk. And in that case, the APs need to find the ramdisk at its new position, in *physical* memory as they're running before paging has been enabled. Thus, get the updated physical location of the ramdisk which is in the relocated_ramdisk variable. Signed-off-by: Borislav Petkov --- arch/x86/kernel/cpu/microcode/core.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c index e53d3c909840..053e5cd1dce0 100644 --- a/arch/x86/kernel/cpu/microcode/core.c +++ b/arch/x86/kernel/cpu/microcode/core.c @@ -290,6 +290,18 @@ struct cpio_data find_microcode_in_initrd(const char *path, bool use_pa) return (struct cpio_data){ NULL, 0, "" }; if (initrd_start) start = initrd_start; + } else { + /* + * The picture on 32-bit is a bit different: we need to get + * the *physical* address to which the ramdisk was relocated, + * i.e., relocated_ramdisk (not initrd_start) and since we're + * running from physical addresses, we need to access + * relocated_ramdisk through its *physical* address. + */ + u64 *rr = (u64 *)__pa_nodebug(&relocated_ramdisk); + + if (*rr) + start = *rr; } return find_cpio_data(path, (void *)start, size, NULL); -- 2.13.0