kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: 'Jim Mattson' <jmattson@google.com>,
	'Paolo Bonzini' <pbonzini@redhat.com>
Cc: 'LKML' <linux-kernel@vger.kernel.org>,
	'kvm list' <kvm@vger.kernel.org>,
	'Sean Christopherson' <sean.j.christopherson@intel.com>,
	'Joerg Roedel' <joro@8bytes.org>,
	"'everdox@gmail.com'" <everdox@gmail.com>
Subject: RE: [PATCH] KVM: x86: handle wrap around 32-bit address space
Date: Wed, 29 Apr 2020 08:56:12 +0000	[thread overview]
Message-ID: <91c76eb0edcd4f1a9d5bc541d35f8ade@AcuMS.aculab.com> (raw)
In-Reply-To: <c3ac5f4c9e3a412cb57ea02df19dd2d2@AcuMS.aculab.com>

From: David Laight
> Sent: 29 April 2020 09:50
> From: Jim Mattson
> > Sent: 28 April 2020 01:29
> > On Mon, Apr 27, 2020 at 9:59 AM Paolo Bonzini <pbonzini@redhat.com> wrote:
> > >
> > > KVM is not handling the case where EIP wraps around the 32-bit address
> > > space (that is, outside long mode).  This is needed both in vmx.c
> > > and in emulate.c.  SVM with NRIPS is okay, but it can still print
> > > an error to dmesg due to integer overflow.
> ...
> > > +               if (unlikely(((rip ^ orig_rip) >> 31) == 3) && !is_64_bit_mode(vcpu))
> 
> Isn't the more obvious:
> 	if (((rip ^ orig_rip) & 1ull << 32) ...
> equivalent?

Actually not even being clever, how about:
	if (orig_rip < (1ull << 32) && unlikely(rip >= (1ull << 32)) && ...

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

  reply	other threads:[~2020-04-29  8:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-27 16:59 [PATCH] KVM: x86: handle wrap around 32-bit address space Paolo Bonzini
2020-04-28  0:28 ` Jim Mattson
2020-04-28  0:33   ` Sean Christopherson
2020-04-29  8:50   ` David Laight
2020-04-29  8:56     ` David Laight [this message]
2020-04-30 12:45       ` Paolo Bonzini
2020-04-30 13:18         ` David Laight

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=91c76eb0edcd4f1a9d5bc541d35f8ade@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=everdox@gmail.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=sean.j.christopherson@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).