Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: amirmohammad.eftekhar@cispa.de
Cc: kvm@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com>,
	rossow@cispa.de
Subject: Re: [PATCH] KVM: SVM: use wrmsrq_safe() when writing the nested TSC ratio MSR
Date: Wed, 22 Jul 2026 06:51:35 -0700	[thread overview]
Message-ID: <amDK50Z9WhMQZwYD@google.com> (raw)
In-Reply-To: <20260722084702.1028983-2-amirmohammad.eftekhar@cispa.de>

On Wed, Jul 22, 2026, amirmohammad.eftekhar@cispa.de wrote:
> From: Amirmohammad Eftekhar <amirmohammad.eftekhar@cispa.de>
> 
> __svm_write_tsc_multiplier() writes vcpu->arch.tsc_scaling_ratio to the
> physical MSR_AMD64_TSC_RATIO with a plain wrmsrq().  Under nested TSC
> scaling the ratio is a composed value (see the companion x86.c change),
> and a composed value can set bits above the MSR's 40-bit width; those
> are reserved bits that architecturally fault (#GP) the WRMSR.  Today
> only the EX_TYPE_WRMSR extable stands between a guest-influenced ratio
> and a host #GP oops in ring 0 -- on a build or path without it the host
> faults.
> 
> Do not depend on the extable for a guest-influenced MSR write: use
> wrmsrq_safe(), and on failure keep the previous ratio (don't update the
> current_tsc_ratio cache) and warn.  Defense in depth alongside bounding
> the composed ratio at its source.

NAK.  As I said off-list, the EX_TYPE_WRMSR exception fixup _is_ the defense in
depth we want.  If KVM does have a bug, I want a WARN.

  parent reply	other threads:[~2026-07-22 13:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-22  8:47 [PATCH] KVM: x86: bound the composed nested TSC multiplier to the max ratio amirmohammad.eftekhar
2026-07-22  8:47 ` [PATCH] KVM: SVM: use wrmsrq_safe() when writing the nested TSC ratio MSR amirmohammad.eftekhar
2026-07-22  9:14   ` sashiko-bot
2026-07-22 13:51   ` Sean Christopherson [this message]
2026-07-22  9:16 ` [PATCH] KVM: x86: bound the composed nested TSC multiplier to the max ratio sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=amDK50Z9WhMQZwYD@google.com \
    --to=seanjc@google.com \
    --cc=amirmohammad.eftekhar@cispa.de \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=rossow@cispa.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox