From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: Ian Jackson <iwj@xenproject.org>, Wei Liu <wl@xen.org>,
Anthony PERARD <anthony.perard@citrix.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Jun Nakajima <jun.nakajima@intel.com>,
Kevin Tian <kevin.tian@intel.com>,
Boris Ostrovsky <boris.ostrovsky@oracle.com>,
<xen-devel@lists.xenproject.org>
Subject: Re: [PATCH v2 for-4.15] x86/msr: introduce an option for HVM relaxed rdmsr behavior
Date: Mon, 8 Mar 2021 15:30:58 +0100 [thread overview]
Message-ID: <YEY1IhUuo71xCGdH@Air-de-Roger> (raw)
In-Reply-To: <fc2e724b-bada-ded3-97b4-26e9a0f3ff4a@suse.com>
On Fri, Mar 05, 2021 at 11:56:33AM +0100, Jan Beulich wrote:
> On 04.03.2021 15:47, Roger Pau Monne wrote:
> > --- a/xen/arch/x86/hvm/svm/svm.c
> > +++ b/xen/arch/x86/hvm/svm/svm.c
> > @@ -1795,6 +1795,7 @@ static int svm_msr_read_intercept(unsigned int msr, uint64_t *msr_content)
> > const struct domain *d = v->domain;
> > struct vmcb_struct *vmcb = v->arch.hvm.svm.vmcb;
> > const struct nestedsvm *nsvm = &vcpu_nestedsvm(v);
> > + uint64_t tmp;
> >
> > switch ( msr )
> > {
> > @@ -1965,6 +1966,11 @@ static int svm_msr_read_intercept(unsigned int msr, uint64_t *msr_content)
> > break;
> >
> > default:
> > + if ( d->arch.hvm.rdmsr_relaxed && !rdmsr_safe(msr, tmp) )
> > + {
> > + *msr_content = 0;
> > + break;
> > + }
>
> You don't really need "tmp" here, do you? You could as well read
> into *msr_content, as you're zapping the value afterwards anyway.
I also thought about doing this, but felt unease. I fear the code
might be changed in the future and maybe msr_content is not zapped
anymore, thus leaking the content. I feel it's safer to use a
temporary variable that will never be returned to the guest. Maybe
I'm just too paranoid.
Thanks, Roger.
prev parent reply other threads:[~2021-03-08 14:31 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-04 14:47 [PATCH v2 for-4.15] x86/msr: introduce an option for HVM relaxed rdmsr behavior Roger Pau Monne
2021-03-04 14:59 ` Ian Jackson
2021-03-04 15:13 ` Roger Pau Monné
2021-03-04 15:20 ` Ian Jackson
2021-03-04 16:55 ` Roger Pau Monné
2021-03-04 17:13 ` Ian Jackson
2021-03-04 17:43 ` Roger Pau Monné
2021-03-04 18:21 ` Ian Jackson
2021-03-05 10:26 ` Jan Beulich
2021-03-04 23:09 ` Boris Ostrovsky
2021-03-04 23:28 ` Andrew Cooper
2021-03-05 8:26 ` Roger Pau Monné
2021-03-05 0:06 ` Andrew Cooper
2021-03-05 9:15 ` Roger Pau Monné
2021-03-05 10:35 ` Jan Beulich
2021-03-05 10:56 ` Jan Beulich
2021-03-05 11:06 ` Jan Beulich
2021-03-08 14:30 ` Roger Pau Monné [this message]
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=YEY1IhUuo71xCGdH@Air-de-Roger \
--to=roger.pau@citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=anthony.perard@citrix.com \
--cc=boris.ostrovsky@oracle.com \
--cc=iwj@xenproject.org \
--cc=jbeulich@suse.com \
--cc=jun.nakajima@intel.com \
--cc=kevin.tian@intel.com \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.