Rather than deferring the detection of these to the point where they
get actually used (the fix for XSA-7, 25480:
76eaf5966c05, causing a #GP
to be raised by IRET, which invokes the guest's [fragile] fail-safe
callback), don't even allow such to be set.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
{
if ( !compat )
{
+#ifdef __x86_64__
+ if ( !is_canonical_address(c.nat->user_regs.eip) ||
+ !is_canonical_address(c.nat->event_callback_eip) ||
+ !is_canonical_address(c.nat->syscall_callback_eip) ||
+ !is_canonical_address(c.nat->failsafe_callback_eip) )
+ return -EINVAL;
+#endif
+
fixup_guest_stack_selector(d, c.nat->user_regs.ss);
fixup_guest_stack_selector(d, c.nat->kernel_ss);
fixup_guest_code_selector(d, c.nat->user_regs.cs);
#endif
for ( i = 0; i < 256; i++ )
+ {
+ if ( !is_canonical_address(c.nat->trap_ctxt[i].address) )
+ return -EINVAL;
fixup_guest_code_selector(d, c.nat->trap_ctxt[i].cs);
+ }
/* LDT safety checks. */
if ( ((c.nat->ldt_base & (PAGE_SIZE-1)) != 0) ||
#ifdef __x86_64__
if ( !is_hvm_domain(d) )
{
+ if ( !is_canonical_address(evc->sysenter_callback_eip) ||
+ !is_canonical_address(evc->syscall32_callback_eip) )
+ goto ext_vcpucontext_out;
fixup_guest_code_selector(d, evc->sysenter_callback_cs);
v->arch.pv_vcpu.sysenter_callback_cs =
evc->sysenter_callback_cs;
struct domain *d = v->domain;
struct trap_info *t = &v->arch.pv_vcpu.trap_ctxt[TRAP_nmi];
+ if ( !is_canonical_address(address) )
+ return -EINVAL;
+
t->vector = TRAP_nmi;
t->flags = 0;
t->cs = (is_pv_32on64_domain(d) ?
if ( cur.address == 0 )
break;
+ if ( !is_canonical_address(cur.address) )
+ return -EINVAL;
+
fixup_guest_code_selector(curr->domain, cur.cs);
memcpy(&dst[cur.vector], &cur, sizeof(cur));