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: <20150224162151.GE4565@chrystal.uk.oracle.com>
Date:	Tue, 24 Feb 2015 17:21:51 +0100
From:	Quentin Casasnovas <quentin.casasnovas@...cle.com>
To:	Borislav Petkov <bp@...en8.de>
Cc:	X86 ML <x86@...nel.org>, LKML <linux-kernel@...r.kernel.org>,
	Quentin Casasnovas <quentin.casasnovas@...cle.com>
Subject: Re: [PATCH 04/13] x86/microcode/intel: Simplify
 load_ucode_intel_bsp()

On Tue, Feb 24, 2015 at 11:37:03AM +0100, Borislav Petkov wrote:
> From: Borislav Petkov <bp@...e.de>
> 
> Don't compute start and end from start and size in order to compute size
> again down the path in scan_microcode(). So pass size directly instead
> and simplify a bunch. Shorten variable names and remove useless ones.
> 
> No functionality change.
>

Unless I can't read, which is likely to be true, I think I might have
spotted one.

> @@ -555,12 +555,10 @@ EXPORT_SYMBOL_GPL(save_mc_for_early);
>  
>  static __initdata char ucode_name[] = "kernel/x86/microcode/GenuineIntel.bin";
>  static __init enum ucode_state
> -scan_microcode(unsigned long start, unsigned long end,
> -		struct mc_saved_data *mc_saved_data,
> -		unsigned long *mc_saved_in_initrd,
> -		struct ucode_cpu_info *uci)
> +scan_microcode(unsigned long start, unsigned long size,
> +	       struct mc_saved_data *mc_saved_data,
> +	       unsigned long *mc_saved_in_initrd, struct ucode_cpu_info *uci)
>  {
> -	unsigned int size = end - start + 1;

... here `size = end - start + 1`, so basically the original size in
`hdr.ramdisk_image` *plus one*, whereas the `size` you're passing around
does not include it.  I'm not saying it's wrong, quite the opposite I think
you're fixing an off-by-one error present in the original code at the same
time :)

> +	u64 start, size;
>  #ifdef CONFIG_X86_32
> -	struct boot_params *boot_params_p;
> +	struct boot_params *p;
>  
> -	boot_params_p = (struct boot_params *)__pa_nodebug(&boot_params);
> -	ramdisk_image = boot_params_p->hdr.ramdisk_image;
> -	ramdisk_size  = boot_params_p->hdr.ramdisk_size;
> -	initrd_start_early = ramdisk_image;
> -	initrd_end_early = initrd_start_early + ramdisk_size;
> +	p	= (struct boot_params *)__pa_nodebug(&boot_params);
> +	start	= p->hdr.ramdisk_image;
> +	size	= p->hdr.ramdisk_size;

Here is your size.

Quentin
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ