lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <76e0988d-279f-be58-51d9-621806dbb453@amd.com>
Date: Mon, 14 Jul 2025 09:59:05 -0500
From: Tom Lendacky <thomas.lendacky@....com>
To: Sean Christopherson <seanjc@...gle.com>, Borislav Petkov <bp@...en8.de>
Cc: Nikunj A Dadhania <nikunj@....com>, linux-kernel@...r.kernel.org,
 x86@...nel.org, tglx@...utronix.de, mingo@...hat.com,
 dave.hansen@...ux.intel.com, santosh.shukla@....com
Subject: Re: [PATCH] x86/sev: Improve handling of writes to intercepted
 GUEST_TSC_FREQ

On 7/14/25 09:24, Sean Christopherson wrote:
> On Mon, Jul 14, 2025, Borislav Petkov wrote:
>> On Fri, Jul 11, 2025 at 09:42:00AM +0530, Nikunj A Dadhania wrote:
>>> From: Sean Christopherson <seanjc@...gle.com>
>>>
>>> For Secure TSC enabled guests, don't panic when a guest writes to
>>> intercepted GUEST_TSC_FREQ MSR. Instead, ignore writes to GUEST_TSC_FREQ,
>>> similar to MSR_IA32_TSC, and log a warning instead.
>>
>> Why?
>>
>> Nothing should poke at the TSC MSR and those who do, deserve what they get.
>>
>>> Only terminate the guest when reading from intercepted GUEST_TSC_FREQ MSR
>>> with Secure TSC enabled, as this indicates an unexpected hypervisor
>>> configuration.
>>
>> Huh, this sounds weird.
>>
>> What are we "fixing" here?
> 
> Returning ES_VMM_ERROR is misleading/wrong, and panicking doesn't match how the
> kernel handles every other "bad" WRMSR.  How's this for a changelog?
> 
>   For Secure TSC enabled guests, don't panic if the kernel hits a #VC due
>   to attempting to write to GUEST_TSC_FREQ, and instead WARN and drop the
>   write.  The kernel should never write GUEST_TSC_FREQ as it's read-only,
>   but panicking with ES_VMM_ERROR is both misleading (it's entirely
>   reasonable for a VMM to intercept writes to a read-only MSR), and
>   unnecessary, e.g. the kernel eats #GPs with a WARN on every other "bad"
>   WRMSR.

Maybe it should be returning ES_EXCEPTION then instead of ES_VMM_ERROR
and forward a #GP, which is what would have happened if the guest tried
to write to the read-only MSR if it wasn't being intercepted.

I'm still not a fan of intercepting writes to read-only MSRs that are
passed into the guest. If we're trying to replicate bare-metal behavior,
then allowing the write to fail with a #GP seems appropriate.

Thanks,
Tom

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ