x86emul: catch exceptions occurring in stubs
authorJan Beulich <jbeulich@suse.com>
Thu, 16 Feb 2017 17:11:42 +0000 (18:11 +0100)
committerJan Beulich <jbeulich@suse.com>
Thu, 16 Feb 2017 17:11:42 +0000 (18:11 +0100)
commit79903e50dba9e7442c9b7ca424661bb020e9dbf2
tree2dcba3e9f84b84435315ed2524c62816de97518c
parent8c935f5ff1cac422b4de21cbab69e13d2ebb25be
x86emul: catch exceptions occurring in stubs

Before adding more use of stubs cloned from decoded guest insns, guard
ourselves against mistakes there: Should an exception (with the
noteworthy exception of #PF) occur inside the stub, forward it to the
guest.

Since the exception fixup table entry can't encode the address of the
faulting insn itself, attach it to the return address instead. This at
once provides a convenient place to hand the exception information
back: The return address is being overwritten by it before branching to
the recovery code.

Take the opportunity and (finally!) add symbol resolution to the
respective log messages (the new one is intentionally not being coded
that way, as it covers stub addresses only, which don't have symbols
associated).

Also take the opportunity and make search_one_extable() static again.

Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/extable.c
xen/arch/x86/traps.c
xen/arch/x86/x86_emulate/x86_emulate.c
xen/include/asm-x86/uaccess.h