kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jim Mattson <jmattson@google.com>
To: kvm list <kvm@vger.kernel.org>
Subject: What's with all of the hardcoded instruction lengths in svm.c?
Date: Wed, 12 Jun 2019 13:17:33 -0700	[thread overview]
Message-ID: <CALMp9eQ4k71ox=0xQKM+CfOkFe6Vqp+0znJ3Ju4ZmyL9fgjm=w@mail.gmail.com> (raw)

Take the following code in rdmsr_interception, for example.

svm->next_rip = kvm_rip_read(&svm->vcpu) + 2;

Yes, the canonical rdmsr instruction is two bytes. However, there is
nothing in the architectural specification prohibiting useless or
redundant prefixes. So, for instance, 65 66 67 67 67 0f 32 is a
perfectly valid 7-byte rdmsr instruction.

It looks like this code was checked in with commit 6aa8b732ca01c
("kvm: userspace interface"), with nary a word of explanation.

             reply	other threads:[~2019-06-12 20:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-12 20:17 Jim Mattson [this message]
2019-06-13 13:55 ` What's with all of the hardcoded instruction lengths in svm.c? Vitaly Kuznetsov
2019-06-13 16:08   ` Jim Mattson
2019-06-14 17:01     ` Vitaly Kuznetsov

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='CALMp9eQ4k71ox=0xQKM+CfOkFe6Vqp+0znJ3Ju4ZmyL9fgjm=w@mail.gmail.com' \
    --to=jmattson@google.com \
    --cc=kvm@vger.kernel.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 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).