From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH v4 18/24] x86/shadow: Avoid raising faults behind the emulators back
Date: Fri, 2 Dec 2016 11:48:31 +0000 [thread overview]
Message-ID: <d0acf007-f503-056d-e9aa-d29b2c7cefe0@citrix.com> (raw)
In-Reply-To: <58416AFC0200007800124800@prv-mh.provo.novell.com>
On 02/12/16 11:37, Jan Beulich wrote:
>> --- a/xen/arch/x86/mm/shadow/multi.c
>> +++ b/xen/arch/x86/mm/shadow/multi.c
>> @@ -3373,18 +3373,36 @@ static int sh_page_fault(struct vcpu *v,
>>
>> r = x86_emulate(&emul_ctxt.ctxt, emul_ops);
>>
>> - /*
>> - * The previous lack of inject_{sw,hw}*() hooks caused exceptions raised
>> - * by the emulator itself to become X86EMUL_UNHANDLEABLE. Such exceptions
>> - * now set event_pending instead. Exceptions raised behind the back of
>> - * the emulator don't yet set event_pending.
>> - *
>> - * For now, cause such cases to return to the X86EMUL_UNHANDLEABLE path,
>> - * for no functional change from before. Future patches will fix this
>> - * properly.
>> - */
>> if ( r == X86EMUL_EXCEPTION && emul_ctxt.ctxt.event_pending )
>> - r = X86EMUL_UNHANDLEABLE;
>> + {
>> + /*
>> + * This emulation covers writes to shadow pagetables. We tolerate #PF
>> + * (from accesses spanning pages, concurrent paging updated from
>> + * vcpus, etc) and #GP[0]/#SS[0] (from segmentation errors). Anything
>> + * else is an emulation bug, or a guest playing with the instruction
>> + * stream under Xen's feet.
>> + */
>> + if ( emul_ctxt.ctxt.event.type == X86_EVENTTYPE_HW_EXCEPTION &&
>> + ((emul_ctxt.ctxt.event.vector == TRAP_page_fault) ||
>> + (((emul_ctxt.ctxt.event.vector == TRAP_gp_fault) ||
>> + (emul_ctxt.ctxt.event.vector == TRAP_stack_error)) &&
>> + emul_ctxt.ctxt.event.error_code == 0)) )
>> + {
>> + if ( has_hvm_container_domain(d) )
>> + hvm_inject_event(&emul_ctxt.ctxt.event);
>> + else
>> + pv_inject_event(&emul_ctxt.ctxt.event);
>> +
>> + goto emulate_done;
>> + }
>> + else
> ... the else following a goto is kind of pointless and imo makes the
> code slightly harder to follow.
Oh - good point. This is actually a slight behavioural change, as it
skips the trace. I will drop the goto.
~Andrew
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
prev parent reply other threads:[~2016-12-02 11:48 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-01 16:55 [PATCH v4 for-4.9 00/24] [SUBSET] XSA-191 followup Andrew Cooper
2016-12-01 16:55 ` [PATCH v4 09/24] x86/emul: Provide a wrapper to x86_emulate() to ASSERT() certain behaviour Andrew Cooper
2016-12-02 11:26 ` Jan Beulich
2016-12-01 16:55 ` [PATCH v4 10/24] x86/emul: Always use fault semantics for software events Andrew Cooper
2016-12-01 19:07 ` Boris Ostrovsky
2016-12-02 11:28 ` Jan Beulich
2016-12-01 16:55 ` [PATCH v4 11/24] x86/emul: Implement singlestep as a retire flag Andrew Cooper
2016-12-02 11:32 ` Jan Beulich
2016-12-01 16:56 ` [PATCH v4 17/24] x86/pv: Avoid raising faults behind the emulators back Andrew Cooper
2016-12-01 16:56 ` [PATCH v4 18/24] x86/shadow: " Andrew Cooper
2016-12-02 11:37 ` Jan Beulich
2016-12-02 11:48 ` Andrew Cooper [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=d0acf007-f503-056d-e9aa-d29b2c7cefe0@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.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).