Re: [PATCH -v2] x86, microcode, AMD: Sanity-check initrd image

From: Boris Ostrovsky
Date: Mon Feb 03 2014 - 14:36:45 EST


On 02/03/2014 02:30 PM, Borislav Petkov wrote:
On Mon, Feb 03, 2014 at 02:13:27PM -0500, Boris Ostrovsky wrote:
I thought that it may be sufficient to check for !container in
save_microcode_in_initrd_amd() before performing relocation. If the
signature was wrong, we would have found out about it in
load_ucode_bsp() -> apply_ucode_in_initrd() and returned right away,
Your original test case which exploded had exactly that scenario - it
was pointing to Intel ucode so container wasn't NULL. Thus we need to
check the sig in find_ucode_in_initrd().


It exploded when 'if (!container)' check was done *after* relocation, which made container non-zero. If you do the check *before* then I think you will catch the fact that container is empty.

load_ucode_bsp() -> apply_ucode_in_initrd() path does not include save_microcode_in_initrd_amd() and (if I understand the code correctly) we already verify signature in apply_ucode_in_initrd().

I am pretty sure I tested this scenario but I can verify it again.

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