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: <87blcy8jdr.fsf@nanos.tec.linutronix.de>
Date:   Fri, 05 Feb 2021 19:22:24 +0100
From:   Thomas Gleixner <tglx@...utronix.de>
To:     Peter Zijlstra <peterz@...radead.org>,
        Zhimin Feng <fengzhimin@...edance.com>
Cc:     x86@...nel.org, kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
        pbonzini@...hat.com, seanjc@...gle.com, vkuznets@...hat.com,
        wanpengli@...cent.com, jmattson@...gle.com, joro@...tes.org,
        mingo@...hat.com, bp@...en8.de, hpa@...or.com, fweisbec@...il.com,
        zhouyibo@...edance.com, zhanghaozhong@...edance.com
Subject: Re: [RFC: timer passthrough 5/9] KVM: vmx: use tsc_adjust to enable tsc_offset timer passthrough

On Fri, Feb 05 2021 at 13:43, Peter Zijlstra wrote:
> On Fri, Feb 05, 2021 at 06:03:13PM +0800, Zhimin Feng wrote:
>> +static void vmx_adjust_tsc_offset(struct kvm_vcpu *vcpu, bool to_host)
>> +{
>> +	u64 tsc_adjust;
>> +	struct timer_passth_info *local_timer_info;
>> +
>> +	local_timer_info = &per_cpu(passth_info, smp_processor_id());
>> +
>> +	if (to_host) {
>> +		tsc_adjust = local_timer_info->host_tsc_adjust;
>> +		wrmsrl(MSR_IA32_TSC_ADJUST, tsc_adjust);
>> +		vmcs_write64(TSC_OFFSET, vcpu->arch.tsc_offset);
>> +	} else {
>> +		rdmsrl(MSR_IA32_TSC_ADJUST, tsc_adjust);
>> +		local_timer_info->host_tsc_adjust = tsc_adjust;
>> +
>> +		wrmsrl(MSR_IA32_TSC_ADJUST, tsc_adjust + vcpu->arch.tsc_offset);
>> +		vmcs_write64(TSC_OFFSET, 0);
>> +	}
>> +}
>
> NAK
>
> This wrecks the host TSC value, any host code between this and actually
> entering that VM will observe batshit time.

VMCS TSC offset is there for a reason...

Thanks,

        tglx

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ