Re: [PATCH 1/3] x86/microcode/intel: Refactor Intel microcode blob loading

From: Thomas Gleixner
Date: Fri Apr 05 2019 - 17:59:59 EST


On Fri, 5 Apr 2019, Borislav Petkov wrote:

> From: Jann Horn <jannh@xxxxxxxxxx>
>
> Change generic_load_microcode() to use the iov_iter API instead of a
> clumsy open-coded version which has to pay attention to __user data
> or kernel data, depending on the loading method. This allows to avoid
> explicit casting between user and kernel pointers.
>
> Because the iov_iter API makes it hard to read the same location twice,
> as a side effect, also fix a double-read of the microcode header (which
> could e.g. lead to out-of-bounds reads in microcode_sanity_check()).
>
> Not that it matters much, only root is allowed to load microcode
> anyway...

Nice!

Reviewed-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>