[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4841c40b-47b0-4b1b-985f-d1a16cbe81fa@intel.com>
Date: Tue, 21 Oct 2025 19:36:19 +0300
From: Adrian Hunter <adrian.hunter@...el.com>
To: Sean Christopherson <seanjc@...gle.com>
CC: Rick P Edgecombe <rick.p.edgecombe@...el.com>, "pbonzini@...hat.com"
<pbonzini@...hat.com>, "kas@...nel.org" <kas@...nel.org>, Xiaoyao Li
<xiaoyao.li@...el.com>, "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"linux-coco@...ts.linux.dev" <linux-coco@...ts.linux.dev>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, Yan Y Zhao
<yan.y.zhao@...el.com>, "x86@...nel.org" <x86@...nel.org>, wenlong hou
<houwenlong.hwl@...group.com>
Subject: Re: [PATCH v4 1/4] KVM: TDX: Synchronize user-return MSRs immediately
after VP.ENTER
On 21/10/2025 18:06, Sean Christopherson wrote:
> On Tue, Oct 21, 2025, Adrian Hunter wrote:
>> On 21/10/2025 01:55, Edgecombe, Rick P wrote:
>>>> + * Several of KVM's user-return MSRs are clobbered by the TDX-Module if
>>>> + * VP.ENTER succeeds, i.e. on TD-Exit. Mark those MSRs as needing an
>>>> + * update to synchronize the "current" value in KVM's cache with the
>>>> + * value in hardware (loaded by the TDX-Module).
>>>> + */
>>>
>>> I think we should be synchronizing only after a successful VP.ENTER with a real
>>> TD exit, but today instead we synchronize after any attempt to VP.ENTER.
>
> Well this is all completely @#($*#. Looking at the TDX-Module source, if the
> TDX-Module synthesizes an exit, e.g. because it suspects a zero-step attack, it
> will signal a "normal" exit but not "restore" VMM state.
>
>> If the MSR's do not get clobbered, does it matter whether or not they get
>> restored.
>
> It matters because KVM needs to know the actual value in hardware. If KVM thinks
> an MSR is 'X', but it's actually 'Y', then KVM could fail to write the correct
> value into hardware when returning to userspace and/or when running a different
> vCPU.
I don't quite follow: if an MSR does not get clobbered, where does the
incorrect value come from?
Powered by blists - more mailing lists