From: Jan Kiszka <jan.kiszka@web.de>
To: Bernhard Kohl <bernhard.kohl@nsn.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH] kvm-kmod: x86: make sure kvm_get_desc_base() doesn't sign extend
Date: Tue, 12 Oct 2010 19:43:23 +0200 [thread overview]
Message-ID: <4CB49E3B.7050804@web.de> (raw)
In-Reply-To: <1286897317-312-1-git-send-email-bernhard.kohl@nsn.com>
[-- Attachment #1: Type: text/plain, Size: 1717 bytes --]
Am 12.10.2010 17:28, Bernhard Kohl wrote:
> The current implementation of kvm_get_desc_base() sign extends the
> return value because of integer promotion rules when compiled for
> x86_64 kernels. For the most part, this doesn't matter, because
> the top bit of base2 is usually 0. If, however, that bit is 1, then
> the entire value will be 0xffff... which is probably not what the
> caller intended.
>
> We have a legacy OS which runs into errors in certain situations
> (task switches) because of this bug, i.e. error on vm_entry followed
> by unhandled vm_exit.
>
> dmesg says:
> vmx_handle_exit: unexpected, valid vectoring info (0x80000b0d)
> and exit reason is 0x80000021
> or
> vmx_handle_exit: unexpected, valid vectoring info (0x80000300)
> and exit reason is 0x80000021
>
> qemu-kvm says:
> kvm: unhandled exit 80000021
> kvm_run returned -22
>
> This fix was originally applied as patch 2c75910 in kvm.git:
> "x86: Make sure get_user_desc() doesn't sign extend."
>
> Signed-off-by: Bernhard Kohl <bernhard.kohl@nsn.com>
> ---
> x86/external-module-compat.h | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/x86/external-module-compat.h b/x86/external-module-compat.h
> index 15b0280..a2af776 100644
> --- a/x86/external-module-compat.h
> +++ b/x86/external-module-compat.h
> @@ -435,7 +435,7 @@ struct kvm_desc_ptr {
> static inline unsigned long
> kvm_get_desc_base(const struct kvm_desc_struct *desc)
> {
> - return desc->base0 | ((desc->base1) << 16) | ((desc->base2) << 24);
> + return (unsigned)(desc->base0 | ((desc->base1) << 16) | ((desc->base2) << 24));
> }
>
> static inline void
Merged, thanks!
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 259 bytes --]
prev parent reply other threads:[~2010-10-12 17:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-12 15:28 [PATCH] kvm-kmod: x86: make sure kvm_get_desc_base() doesn't sign extend Bernhard Kohl
2010-10-12 17:43 ` Jan Kiszka [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=4CB49E3B.7050804@web.de \
--to=jan.kiszka@web.de \
--cc=bernhard.kohl@nsn.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 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.