Skip to contentSkip to conversation

x86/evtchn: Restrict the ops usable in do_event_channel_op_compat()

PATCH In review Andrew Cooper 2 participants 2 messages Jul 18, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/evtchn: Restrict the ops usable in do_event_channel_op_compat()

This hypercall is unused by guests these days, but there was no prevention of usable subops. The following ops have been restricted, as there is no suitable structure in the evntchn_op union.

EVTCHNOP_reset
EVTCHNOP_init_control
EVTCHNOP_expand_array
EVTCHNOP_set_priority

---
CC: George Dunlap <[email protected]>
CC: Ian Jackson <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Konrad Rzeszutek Wilk <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Tim Deegan <[email protected]>
CC: Wei Liu <[email protected]>

---
 xen/arch/x86/compat.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
xen/arch/x86/compat.c +18 -1
index 2d4be2e..f417cd5 100644
@@ -57,7 +57,24 @@ long do_event_channel_op_compat(XEN_GUEST_HANDLE_PARAM(evtchn_op_t) uop)
     if ( unlikely(copy_from_guest(&op, uop, 1) != 0) )
         return -EFAULT;
 
-    return do_event_channel_op(op.cmd, guest_handle_from_ptr(&uop.p->u, void));
+    switch ( op.cmd )
+    {
+    case EVTCHNOP_bind_interdomain:
+    case EVTCHNOP_bind_virq:
+    case EVTCHNOP_bind_pirq:
+    case EVTCHNOP_close:
+    case EVTCHNOP_send:
+    case EVTCHNOP_status:
+    case EVTCHNOP_alloc_unbound:
+    case EVTCHNOP_bind_ipi:
+    case EVTCHNOP_bind_vcpu:
+    case EVTCHNOP_unmask:
+        return do_event_channel_op(op.cmd,
+                                   guest_handle_from_ptr(&uop.p->u, void));
+
+    default:
+        return -ENOSYS;
+    }
 }
 
 #endif
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Andrew Cooper

This hypercall is unused by guests these days, but there was no prevention of usable subops. The following ops have been restricted, as there is no suitable structure in the evntchn_op union.

EVTCHNOP_reset
EVTCHNOP_init_control
EVTCHNOP_expand_array
EVTCHNOP_set_priority

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel