lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170125172321.fpy6cswq3ibqvfgo@pd.tnic>
Date:   Wed, 25 Jan 2017 18:23:21 +0100
From:   Borislav Petkov <bp@...en8.de>
To:     Andrey Ryabinin <aryabinin@...tuozzo.com>
Cc:     Thomas Gleixner <tglx@...utronix.de>,
        LKML <linux-kernel@...r.kernel.org>,
        "H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...nel.org>
Subject: Re: x86/microcode: use-after-free after cpu offline/online

On Wed, Jan 25, 2017 at 07:58:39PM +0300, Andrey Ryabinin wrote:
> On 4.10-rc5 
>    # echo 0 > /sys/devices/system/cpu/cpu1/online
>    # echo 1 > /sys/devices/system/cpu/cpu1/online
> 
> triggers use-after-free (probably caused by 06b8534cb72 "x86/microcode: Rework microcode loading").
> 
>  __load_ucode_intel() accesses initrd which is obviously gone at this point:

Does that help?

---
diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
index 2af69d27da62..fdbf8d29ffcf 100644
--- a/arch/x86/kernel/cpu/microcode/core.c
+++ b/arch/x86/kernel/cpu/microcode/core.c
@@ -248,8 +248,12 @@ struct cpio_data find_microcode_in_initrd(const char *path, bool use_pa)
 	 * possibly relocates the ramdisk. In either case, initrd_start contains
 	 * the updated address so use that instead.
 	 */
-	if (!use_pa && initrd_start)
-		start = initrd_start;
+	if (!use_pa) {
+		if (initrd_start)
+			start = initrd_start;
+		else
+			return (struct cpio_data){ NULL, 0, "" };
+	}
 
 	return find_cpio_data(path, (void *)start, size, NULL);
 #else /* !CONFIG_BLK_DEV_INITRD */

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ