From: Tamas K Lengyel <tamas@tklengyel.com>
To: Razvan Cojocaru <rcojocaru@bitdefender.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Jan Beulich <jbeulich@suse.com>,
Xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH V2 2/2] x86/vm_event: fix race between __context_switch() and vm_event_resume()
Date: Wed, 3 May 2017 16:10:01 -0400 [thread overview]
Message-ID: <CABfawh=+Cyhsrw697YB69qRwvpdnfUOqSpHyjJi28BSftQBrjw@mail.gmail.com> (raw)
In-Reply-To: <1493802603-4978-3-git-send-email-rcojocaru@bitdefender.com>
On Wed, May 3, 2017 at 5:10 AM, Razvan Cojocaru
<rcojocaru@bitdefender.com> wrote:
>
> The introspection agent can reply to a vm_event faster than
> vmx_vmexit_handler() can complete in some cases, where it is then
> not safe for vm_event_set_registers() to modify v->arch.user_regs.
> In the test scenario, we were stepping over an INT3 breakpoint by
> setting RIP += 1. The quick reply tended to complete before the VCPU
> triggering the introspection event had properly paused and been
> descheduled. If the reply occurs before __context_switch() happens,
> __context_switch() clobbers the reply by overwriting
> v->arch.user_regs from the stack. If the reply occurs after
> __context_switch(), we don't pass through __context_switch() when
> transitioning to idle.
>
> This patch ensures that vm_event_resume() code only sets per-VCPU
> data to be used for the actual setting of registers later in
> hvm_do_resume() (similar to the model used to control setting of CRs
> and MSRs).
>
> The patch additionally removes the sync_vcpu_execstate(v) call from
> vm_event_resume(), which is no longer necessary, which removes the
> associated broadcast TLB flush (read: performance improvement).
>
> Signed-off-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Tamas K Lengyel <tamas@tklengyel.com>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
prev parent reply other threads:[~2017-05-03 20:10 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-03 9:10 [PATCH V2 0/2] Fix vm_event resume path race condition Razvan Cojocaru
2017-05-03 9:10 ` [PATCH V2 1/2] x86/vm_event: added hvm/vm_event.{h,c} Razvan Cojocaru
2017-05-03 9:51 ` [PATCH V2 1/2] x86/vm_event: added hvm/vm_event.{h, c} Jan Beulich
2017-05-03 10:37 ` Razvan Cojocaru
2017-05-03 10:48 ` Jan Beulich
2017-05-03 20:05 ` Tamas K Lengyel
2017-05-03 20:16 ` Razvan Cojocaru
2017-05-03 20:32 ` Tamas K Lengyel
2017-05-03 20:38 ` Razvan Cojocaru
2017-05-03 9:10 ` [PATCH V2 2/2] x86/vm_event: fix race between __context_switch() and vm_event_resume() Razvan Cojocaru
2017-05-03 10:01 ` Jan Beulich
2017-05-03 10:40 ` Razvan Cojocaru
2017-05-03 20:10 ` Tamas K Lengyel [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='CABfawh=+Cyhsrw697YB69qRwvpdnfUOqSpHyjJi28BSftQBrjw@mail.gmail.com' \
--to=tamas@tklengyel.com \
--cc=andrew.cooper3@citrix.com \
--cc=jbeulich@suse.com \
--cc=rcojocaru@bitdefender.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).