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: <16165aad-5990-51f9-4dc7-c4b68597a4d5@virtuozzo.com>
Date:   Wed, 25 Jan 2017 22:14:50 +0300
From:   Andrey Ryabinin <aryabinin@...tuozzo.com>
To:     Borislav Petkov <bp@...en8.de>
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 01/25/2017 08:23 PM, Borislav Petkov wrote:
> 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?

Yup.
Tested-by: Andrey Ryabinin <aryabinin@...tuozzo.com>

> 
> ---
> 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 */
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ