Re: [PATCH] x86/microcode: Adjust ramdisk address when accessing by virtual address

From: Boris Ostrovsky
Date: Mon Dec 19 2016 - 20:40:37 EST




On 12/19/2016 08:27 PM, Boris Ostrovsky wrote:


On 12/19/2016 06:32 PM, Borislav Petkov wrote:
On Mon, Dec 19, 2016 at 07:43:40PM +0100, Borislav Petkov wrote:
On Mon, Dec 19, 2016 at 01:12:25PM -0500, Boris Ostrovsky wrote:
IIUIC find_microcode_in_initrd() is called with paging on only on Intel
(which is where I observed it).

Ah, that was an important fact. Yes, I can repro it now.

Ok, questions:

* does your guest relocate the ramdisk?


This is not a guest. I crashed with baremetal kernel.



I.e., do you see something like this in dmesg before the splat:

[ 0.000000] RAMDISK: [mem 0x7f84c000-0x7ffcffff]
[ 0.000000] Allocated new RAMDISK: [mem 0x3647a000-0x36bfd9e6]
[ 0.000000] Move RAMDISK from [mem 0x7f84c000-0x7ffcf9e6] to [mem
0x3647a000-0x36bfd9e6]
^^^^^^^^^^^^^^


Sorry, forgot about this: I see the first line but not the other two (so the relocation did not occur).


-boris


If not, then I know what happens.

Also, does it work if you change these lines:

if (!use_pa && relocated_ramdisk)
start = initrd_start;

to:

if (!use_pa)
start = initrd_start;

Yes, it does.

I also thought it might be better but I haven't gone through the code to
make sure this would always work.

I can run more tests tomorrow if you want.

-boris



Because if that works, I can actually simplify that function radically.

But more tomorrow.

Thanks.