[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 4/4] x86/hvm: add stricter permissions checks to ioreq server control plane
There has always been an intention in the ioreq server API that only the domain that creates an ioreq server should be able to manipulate it. However, so far, nothing has enforced this. This means that two domains with DM_PRIV over a target domain can currently manipulate each others ioreq servers. A previous patch added code to take a reference and store a pointer to the domain that creates an ioreq server. This patch now adds checks to the functions that manipulate the ioreq server to make sure they are being called by the same domain. Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx> --- Cc: Jan Beulich <jbeulich@xxxxxxxx> Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- xen/arch/x86/hvm/ioreq.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/xen/arch/x86/hvm/ioreq.c b/xen/arch/x86/hvm/ioreq.c index 712c75ff35..094a4fcdf5 100644 --- a/xen/arch/x86/hvm/ioreq.c +++ b/xen/arch/x86/hvm/ioreq.c @@ -784,6 +784,10 @@ int hvm_destroy_ioreq_server(struct domain *d, ioservid_t id) if ( s->id != id ) continue; + rc = -EPERM; + if ( s->emulator != current->domain ) + break; + domain_pause(d); p2m_set_ioreq_server(d, 0, s); @@ -828,6 +832,10 @@ int hvm_get_ioreq_server_info(struct domain *d, ioservid_t id, if ( s->id != id ) continue; + rc = -EPERM; + if ( s->emulator != current->domain ) + break; + *ioreq_gfn = s->ioreq.gfn; if ( s->bufioreq.va != NULL ) @@ -870,6 +878,10 @@ int hvm_map_io_range_to_ioreq_server(struct domain *d, ioservid_t id, if ( s->id != id ) continue; + rc = -EPERM; + if ( s->emulator != current->domain ) + break; + switch ( type ) { case XEN_DMOP_IO_RANGE_PORT: @@ -925,6 +937,10 @@ int hvm_unmap_io_range_from_ioreq_server(struct domain *d, ioservid_t id, if ( s->id != id ) continue; + rc = -EPERM; + if ( s->emulator != current->domain ) + break; + switch ( type ) { case XEN_DMOP_IO_RANGE_PORT: @@ -988,6 +1004,10 @@ int hvm_map_mem_type_to_ioreq_server(struct domain *d, ioservid_t id, if ( s->id != id ) continue; + rc = -EPERM; + if ( s->emulator != current->domain ) + break; + rc = p2m_set_ioreq_server(d, flags, s); break; } @@ -1027,6 +1047,10 @@ int hvm_set_ioreq_server_state(struct domain *d, ioservid_t id, if ( s->id != id ) continue; + rc = -EPERM; + if ( s->emulator != current->domain ) + break; + domain_pause(d); if ( enabled ) -- 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |