x86, microcode, AMD: Unify valid container checks
authorBorislav Petkov <bp@suse.de>
Mon, 3 Feb 2014 20:41:44 +0000 (21:41 +0100)
committerH. Peter Anvin <hpa@zytor.com>
Thu, 6 Feb 2014 19:11:19 +0000 (11:11 -0800)
commit75a1ba5b2c529db60ca49626bcaf0bddf4548438
tree3b29eb108807f6e86d67d80f37052c4e7cd1a056
parent6583327c4dd55acbbf2a6f25e775b28b3abf9a42
x86, microcode, AMD: Unify valid container checks

For additional coverage, BorisO and friends unknowlingly did swap AMD
microcode with Intel microcode blobs in order to see what happens. What
did happen on 32-bit was

[    5.722656] BUG: unable to handle kernel paging request at be3a6008
[    5.722693] IP: [<c106d6b4>] load_microcode_amd+0x24/0x3f0
[    5.722716] *pdpt = 0000000000000000 *pde = 0000000000000000

because there was a valid initrd there but without valid microcode in it
and the container check happened *after* the relocated ramdisk handling
on 32-bit, which was clearly wrong.

While at it, take care of the ramdisk relocation on both 32- and 64-bit
as it is done on both. Also, comment what we're doing because this code
is a bit tricky.

Reported-and-tested-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: http://lkml.kernel.org/r/1391460104-7261-1-git-send-email-bp@alien8.de
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
arch/x86/kernel/cpu/microcode/amd_early.c