xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Tim Deegan <tim@xen.org>
To: Antony Saba <Antony.Saba@mandiant.com>
Cc: George Dunlap <George.Dunlap@eu.citrix.com>,
	Keir Fraser <keir@xen.org>, Steven Maresca <steve@zentific.com>,
	Jan Beulich <JBeulich@suse.com>,
	xen-devel@lists.xen.org
Subject: Re: [Xen-users] xc_hvm_inject_trap() failing for int3 traps under Xen 4.2.2
Date: Thu, 20 Jun 2013 11:33:12 +0100	[thread overview]
Message-ID: <20130620103312.GA44917@ocelot.phlegethon.org> (raw)
In-Reply-To: <51BC7F65.9090308@mandiant.com>

(Cc-ing a few more people, moving xen-users to Bcc)

At 14:51 +0000 on 15 Jun (1371307878), Antony Saba wrote:
> >> 2) xc_hvm_inject_trap() always returns a negative value, even when there
> >> is not a problem and the guest receives the trap as expected.  There
> >> hasn't been a clarification as to whether it's supposed to return
> >> non-negative, but one would assume that it should because of the way the
> >> xen-access.c example checks for it.
> > 
> > That looks like a hypervisor bug to me: does this (untested) patch fix
> > it for you?
> > 
> > commit 67b9272fcedcb5dc73cc77a2adf580f2572117d7
> > Author: Tim Deegan <tim@xen.org>
> > Date:   Mon Jun 10 19:35:34 2013 +0100
> > 
> >     x86/hvm: Fix HVMOP_inject_trap return value on success.
> >     
> >     Reported-by: Antony Saba <Antony.Saba@mandiant.com>
> >     Signed-off-by: Tim Deegan <tim@xen.org>
> > 
> > diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
> > index ce44bff..6c86fc2 100644
> > --- a/xen/arch/x86/hvm/hvm.c
> > +++ b/xen/arch/x86/hvm/hvm.c
> > @@ -4430,6 +4430,7 @@ long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg)
> >              v->arch.hvm_vcpu.inject_trap.error_code = tr.error_code;
> >              v->arch.hvm_vcpu.inject_trap.insn_len = tr.insn_len;
> >              v->arch.hvm_vcpu.inject_trap.cr2 = tr.cr2;
> > +            rc = 0;
> >          }
> >  
> >      param_fail8:
> > 
> > 
> > 
> 
> This works

Thanks.  I'll take that as a Tested-by:.

Keir, Jan, can I get an Ack?

George, this is a clean bug-fix for something seen in the field, in a
path that doesn't affect any other features.  OK before 4.3?

Jan, this is a candidate for backporting to 4.1.

> but the instruction size must be set to 1, at least on 4.2.2
> to work for me.  Here is the patch against RELEASE-4.2.2.

Sorry, I wasn't clear: setting it to 1 is certainly an improvement over
zero (which is always wrong), but if you're relying on this to be
correct you should also handle cases where prefixes make the instruction
longer than 1 byte.

In any case, this tools-side change needs to be acked/nacked by a tools
maintainer, and probably Aravindh too.

Cheers,

Tim.

> diff --git a/tools/tests/xen-access/xen-access.c
> b/tools/tests/xen-access/xen-access.c
> index 9ec7332..8bcd88b 100644
> --- a/tools/tests/xen-access/xen-access.c
> +++ b/tools/tests/xen-access/xen-access.c
> @@ -664,7 +664,7 @@ int main(int argc, char *argv[])
>                  /* Reinject */
>                  rc = xc_hvm_inject_trap(
>                      xch, domain_id, req.vcpu_id, 3,
> -                    HVMOP_TRAP_sw_exc, -1, 0, 0);
> +                    HVMOP_TRAP_sw_exc, -1, 1, 0);
>                  if (rc < 0)
>                  {
>                      ERROR("Error %d injecting int3\n", rc);

  reply	other threads:[~2013-06-20 10:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <51AE5D82.8090608@mandiant.com>
2013-06-07  0:16 ` [Xen-users] xc_hvm_inject_trap() failing for int3 traps under Xen 4.2.2 AP
2013-06-07 15:51   ` Steven Maresca
2013-06-07 17:43     ` Antony Saba
2013-06-10 11:29     ` George Dunlap
2013-06-10 16:57       ` Antony Saba
2013-06-10 18:36         ` Tim Deegan
2013-06-15 14:51           ` Antony Saba
2013-06-20 10:33             ` Tim Deegan [this message]
2013-06-20 11:19               ` Keir Fraser
2013-06-21 14:45                 ` George Dunlap
     [not found]               ` <CAGU+auvzXuN4QWzpnpBYt724EMd_FM4Wdx2nKcyEmroLvVKO_Q@mail.gmail.com>
2013-06-20 21:44                 ` Aravindh Puthiyaparambil (aravindp)
2013-06-27  9:49                   ` Tim Deegan

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=20130620103312.GA44917@ocelot.phlegethon.org \
    --to=tim@xen.org \
    --cc=Antony.Saba@mandiant.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=JBeulich@suse.com \
    --cc=keir@xen.org \
    --cc=steve@zentific.com \
    --cc=xen-devel@lists.xen.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).