All of lore.kernel.org
 help / color / mirror / Atom feed
From: Keir Fraser <keir.fraser@eu.citrix.com>
To: "Xu, Dongxiao" <dongxiao.xu@intel.com>, xen-devel@lists.xensource.com
Subject: Re: [PATCH]Fix the bug of guest os installation failure and win2k boot failure
Date: Mon, 17 Mar 2008 10:32:31 +0000	[thread overview]
Message-ID: <C403F93F.1E014%keir.fraser@eu.citrix.com> (raw)
In-Reply-To: <FF386CB4AE0E4648B0A96060EC00F36C8AFBD5@pdsmsx412.ccr.corp.intel.com>

On 17/3/08 10:06, "Xu, Dongxiao" <dongxiao.xu@intel.com> wrote:

>     Realmode emulation code path for I/O is fine. I just think that realmode
> I/O doesn't need that line of check code.

Okay, understood and I agree.

>     For vmexit code path: When I debug this issue, I found that for some I/O
> vmexits which happened when /sbin/loader is executed, the cpl is 3, the iopl
> is 0, so when "generate_exception_if(!mode_iopl(), EXC_GP)" checks cpl and
> iopl relationship, it push out a GP fault and makes the guest installation
> fail. Actually before the code enters vmx_vmexit_handler(), the processor has
> already checked the I/O permission. So here I think that line of check code is
> not needed.

Ah, and so we assume that the I/O access is actually permitted by the TSS
I/O bitmap? Seems reasonable, and so we could add that check or just remove
the CPL-IOPL check. I agree again.

>     Also we haven't found any bug caused by the 4-instruction emulation till
> now. Adding the change in the shadow code path is because: There may be I/O
> instructions among the 4 instructions in theory. In this case, I think a full
> check of cpl, iopl, and the I/O bitmap is needed. So we may either add the I/O
> permission check in software, or break the 4-instruction emulate and let
> processor do the I/O permission check, then emulate it by
> vmx_vmexit_handler()->handle_mmio() code path. Here the patch uses the second
> way. 

I think you misunderstand. The shadow emulator *never* emulates I/O port
accesses or exception deliveries. Those callback functions are simply not
implemented and are left as NULL. Hence we will fail the IOPL check, but we
will also fail to deliver EXC_GP, and so we will simply return
X86EMUL_UNHANDLEABLE, which is the right thing to do. So, no bug here and
your changes to the shadow emulator are not required.

I will try out a version of your patch which is basically just your
x86_emulate.c changes, and see how that works out for me.

 Thanks!
 Keir

  reply	other threads:[~2008-03-17 10:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-17  8:08 [PATCH]Fix the bug of guest os installation failure and win2k boot failure Xu, Dongxiao
2008-03-17  8:32 ` Keir Fraser
2008-03-17 10:06   ` Xu, Dongxiao
2008-03-17 10:32     ` Keir Fraser [this message]
2008-03-17 11:16       ` [PATCH]Fix the bug of guest os installationfailure " Cui, Dexuan
2008-03-17 11:20         ` Keir Fraser
2008-03-18  1:49           ` Xu, Dongxiao
2008-03-18  8:46             ` Keir Fraser
2008-03-18  9:35               ` Xu, Dongxiao
2008-03-18 10:02                 ` Keir Fraser
2008-03-18 10:31                   ` Xu, Dongxiao
2008-03-18 10:47                     ` Keir Fraser
2008-03-18 16:32                   ` Keir Fraser

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=C403F93F.1E014%keir.fraser@eu.citrix.com \
    --to=keir.fraser@eu.citrix.com \
    --cc=dongxiao.xu@intel.com \
    --cc=xen-devel@lists.xensource.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.