Re: [PATCH 1/5] x86/ibrs: Introduce native_rdmsrl, and native_wrmsrl

From: Andy Lutomirski
Date: Sat Jan 13 2018 - 10:20:36 EST




> On Jan 13, 2018, at 5:52 AM, Van De Ven, Arjan <arjan.van.de.ven@xxxxxxxxx> wrote:
>
>
>>> We were also worried about the indirect calls that are part of the
>>> paravirt interfaces when retpolines are not in place.
>>>
>>
>> How could those possibly be any worse than any other indirect call in
>> the kernel?
>
> they're worse if they happen before you write the MSR that then protects them?

I haven't looked at the latest IBRS code, but I can see only two ways to do it:

1. Write the MSRs from asm. Get exactly what you expect.

2. Write them from C. Trust the compiler to be sane. Failure to optimize asm goto correctly or failure of the paravirt code to patch correctly is very low on the list of things to worry about.