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: <769c1232-f56f-12b0-9bfa-6c203889fbc7@amd.com>
Date: Mon, 14 Oct 2024 09:07:43 +0530
From: "Nikunj A. Dadhania" <nikunj@....com>
To: Tom Lendacky <thomas.lendacky@....com>, linux-kernel@...r.kernel.org,
 bp@...en8.de, x86@...nel.org, kvm@...r.kernel.org
Cc: mingo@...hat.com, tglx@...utronix.de, dave.hansen@...ux.intel.com,
 pgonda@...gle.com, seanjc@...gle.com, pbonzini@...hat.com
Subject: Re: [PATCH v12 17/19] x86/kvmclock: Abort SecureTSC enabled guest
 when kvmclock is selected



On 10/11/2024 1:19 AM, Tom Lendacky wrote:
> On 10/9/24 04:28, Nikunj A Dadhania wrote:
>> SecureTSC enabled guests should use TSC as the only clock source, abort
>> the guest when clock source switches to hypervisor controlled kvmclock.
>>
>> Signed-off-by: Nikunj A Dadhania <nikunj@....com>
>> ---
>>  arch/x86/kernel/kvmclock.c | 8 ++++++++
>>  1 file changed, 8 insertions(+)
>>
>> diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c
>> index 5cd3717e103b..552c28cda874 100644
>> --- a/arch/x86/kernel/kvmclock.c
>> +++ b/arch/x86/kernel/kvmclock.c
>> @@ -22,6 +22,7 @@
>>  #include <asm/x86_init.h>
>>  #include <asm/kvmclock.h>
>>  #include <asm/timer.h>
>> +#include <asm/sev.h>
>>  
>>  static int kvmclock __initdata = 1;
>>  static int kvmclock_vsyscall __initdata = 1;
>> @@ -155,6 +156,13 @@ static void enable_kvm_sc_work(struct work_struct *work)
>>  {
>>  	u8 flags;
>>  
>> +	/*
>> +	 * For guest with SecureTSC enabled, TSC should be the only clock source.
> 
> s/For guest/For a guest/
> s/TSC should/The TSC should/

Ok

> 
>> +	 * Abort the guest when kvmclock is selected as the clock source.
>> +	 */
>> +	if (cc_platform_has(CC_ATTR_GUEST_SNP_SECURE_TSC))
>> +		snp_abort();
> 
> Can a message be issued here?
> 
> Also, you could use sev_es_terminate() to provide a specific Linux
> reason code, e.g.:
> 
>   sev_terminate(SEV_TERM_SET_LINUX, GHCB_TERM_SECURE_TSC_KVMCLOCK);
> 
> or whatever name you want to use for this situation.

Sure, will add.

Regards
Nikunj

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ