From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759804AbcLUJza (ORCPT ); Wed, 21 Dec 2016 04:55:30 -0500 Received: from terminus.zytor.com ([198.137.202.10]:58542 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751219AbcLUJz1 (ORCPT ); Wed, 21 Dec 2016 04:55:27 -0500 Date: Wed, 21 Dec 2016 01:55:07 -0800 From: tip-bot for Borislav Petkov Message-ID: Cc: mingo@kernel.org, hpa@zytor.com, boris.ostrovsky@oracle.com, bp@suse.de, linux-kernel@vger.kernel.org, tglx@linutronix.de Reply-To: bp@suse.de, linux-kernel@vger.kernel.org, tglx@linutronix.de, mingo@kernel.org, hpa@zytor.com, boris.ostrovsky@oracle.com In-Reply-To: <20161220144012.lc4cwrg6dphqbyqu@pd.tnic> References: <20161220144012.lc4cwrg6dphqbyqu@pd.tnic> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/urgent] x86/microcode/AMD: Reload proper initrd start address Git-Commit-ID: 8877ebdd3f9a3ffc84c4b67562d257c5f553bc49 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 8877ebdd3f9a3ffc84c4b67562d257c5f553bc49 Gitweb: http://git.kernel.org/tip/8877ebdd3f9a3ffc84c4b67562d257c5f553bc49 Author: Borislav Petkov AuthorDate: Tue, 20 Dec 2016 11:54:30 +0100 Committer: Thomas Gleixner CommitDate: Wed, 21 Dec 2016 10:50:04 +0100 x86/microcode/AMD: Reload proper initrd start address When we switch to virtual addresses and, especially after reserve_initrd()->relocate_initrd() have run, we have the updated initrd address in initrd_start. Use initrd_start then instead of the address which has been passed to us through boot params. (That still gets used when we're running the very early routines on the BSP). Reported-and-tested-by: Boris Ostrovsky Signed-off-by: Borislav Petkov Link: http://lkml.kernel.org/r/20161220144012.lc4cwrg6dphqbyqu@pd.tnic Signed-off-by: Thomas Gleixner --- arch/x86/kernel/cpu/microcode/core.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c index c4bb2f7..2af69d2 100644 --- a/arch/x86/kernel/cpu/microcode/core.c +++ b/arch/x86/kernel/cpu/microcode/core.c @@ -243,14 +243,12 @@ struct cpio_data find_microcode_in_initrd(const char *path, bool use_pa) # endif /* - * Did we relocate the ramdisk? - * - * So we possibly relocate the ramdisk *after* applying microcode on the - * BSP so we rely on use_pa (use physical addresses) - even if it is not - * absolutely correct - to determine whether we've done the ramdisk - * relocation already. + * Fixup the start address: after reserve_initrd() runs, initrd_start + * has the virtual address of the beginning of the initrd. It also + * possibly relocates the ramdisk. In either case, initrd_start contains + * the updated address so use that instead. */ - if (!use_pa && relocated_ramdisk) + if (!use_pa && initrd_start) start = initrd_start; return find_cpio_data(path, (void *)start, size, NULL);