From: Avi Kivity <avi@redhat.com>
To: "Roedel, Joerg" <Joerg.Roedel@amd.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: Re: [PATCH] KVM: Sanitize cpuid
Date: Wed, 18 May 2011 11:34:44 +0300 [thread overview]
Message-ID: <4DD384A4.7030701@redhat.com> (raw)
In-Reply-To: <20110518071910.GJ31309@amd.com>
On 05/18/2011 10:19 AM, Roedel, Joerg wrote:
> > break;
> > + case 0x80000008: {
> > + u8 g_phys_as = entry->eax>> 16;
> > + u8 virt_as = max(entry->eax>> 8, 48U);
>
> Shouldn't that be 'max((entry->eax>> 8)& 0xff, 48U)'? Seems safer when
> the entry->eax contains a non-zero g_phys value.
Yes, this is a bug. I originally had 'u8 virt_as = entry->eax >> 8',
relying on the cast to u8, but missed it when updating. Moral: don't be
subtle.
> > + u8 phys_as = entry->eax;
> > +
> > + if (!g_phys_as)
> > + g_phys_as = phys_as;
> > + entry->eax = g_phys_as | (virt_as<< 8);
>
> It is optional, but since we support nesting we can also encode
> g_phys_as in bits 23:16.
I'm relying on a zero value in 23:16 indicating you should use 7:0.
Thanks for the review, will post an updated patch.
--
error compiling committee.c: too many arguments to function
prev parent reply other threads:[~2011-05-18 8:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-12 13:23 [PATCH] KVM: Sanitize cpuid Avi Kivity
2011-05-18 7:19 ` Roedel, Joerg
2011-05-18 8:34 ` Avi Kivity [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=4DD384A4.7030701@redhat.com \
--to=avi@redhat.com \
--cc=Joerg.Roedel@amd.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
/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.