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] [day] [month] [year] [list]
Message-ID: <10eb00d1-36d8-449e-90a6-a315544c53e1@zytor.com>
Date: Wed, 6 Aug 2025 08:59:23 -0700
From: Xin Li <xin@...or.com>
To: Sean Christopherson <seanjc@...gle.com>
Cc: linux-kernel@...r.kernel.org, kvm@...r.kernel.org, pbonzini@...hat.com,
        tglx@...utronix.de, mingo@...hat.com, bp@...en8.de,
        dave.hansen@...ux.intel.com, x86@...nel.org, hpa@...or.com,
        chao.gao@...el.com
Subject: Re: [PATCH v2 2/4] KVM: VMX: Handle the immediate form of MSR
 instructions

On 8/5/2025 1:03 PM, Sean Christopherson wrote:
> On Fri, Aug 01, 2025, Xin Li (Intel) wrote:
>> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
>> index f19a76d3ca0e..c5d0082cf0a5 100644
>> --- a/arch/x86/include/asm/kvm_host.h
>> +++ b/arch/x86/include/asm/kvm_host.h
>> @@ -978,6 +978,7 @@ struct kvm_vcpu_arch {
>>   	unsigned long guest_debug_dr7;
>>   	u64 msr_platform_info;
>>   	u64 msr_misc_features_enables;
>> +	u32 cui_rdmsr_imm_reg;
> 
> This should be an "int", mostly because that's how KVM tracks it throughout the
> various accessors, but also because it'd let us use "-1" for an "invalid" value,
> e.g. if we ever want to add sanity checks to the completion callback (I don't
> think that's worth doing).

Sigh, using u32 was a dumb move on my part.

>> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
>> index a1c49bc681c4..fe12aae7089c 100644
>> --- a/arch/x86/kvm/x86.c
>> +++ b/arch/x86/kvm/x86.c
>> @@ -1968,6 +1968,13 @@ static void complete_userspace_rdmsr(struct kvm_vcpu *vcpu)
>>   	}
>>   }
>>   
>> +static void complete_userspace_rdmsr_imm(struct kvm_vcpu *vcpu)
> 
> No need for this helper, the few lines can be open coded in complete_fast_rdmsr_imm().

Yes, the change in v3 is simpler.

> 
>> +{
>> +	if (!vcpu->run->msr.error)
>> +		kvm_register_write(vcpu, vcpu->arch.cui_rdmsr_imm_reg,
>> +				   vcpu->run->msr.data);
>> +}
>> +
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ