libxl: Do not trust backend for vusb

Read the type from /libxl, rather than the backend.  (We still trust
the backend for details such as the number of ports, etc.; these are
not a security problem.)

In getinfo, use the computed frontend path, and the incoming domid,
rather than needlessly reading these values from the backend.

This is part of XSA-178.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
---
v2: New patch following rebase.
This commit is contained in:
Ian Jackson authored and Ian Jackson committed 2016-06-02 15:53:29 +01:00
1 parent 4f79473898
commit 2538aaa238
1 file changed
+4 -5
+4 -5
View File
@@ -401,7 +401,7 @@ libxl_device_usbctrl_list(libxl_ctx *ctx, uint32_t domid, int *num)
if (ret) goto out;
usbctrl->version = READ_SUBPATH_INT(be_path, "usb-ver");
usbctrl->ports = READ_SUBPATH_INT(be_path, "num-ports");
libxl_usbctrl_type_from_string(READ_SUBPATH(be_path, "type"),
libxl_usbctrl_type_from_string(READ_SUBPATH(libxl_path, "type"),
&usbctrl->type);
#undef READ_SUBPATH
@@ -459,12 +459,11 @@ int libxl_device_usbctrl_getinfo(libxl_ctx *ctx, uint32_t domid,
usbctrlinfo->evtch = READ_SUBPATH_INT(fe_path, "event-channel");
usbctrlinfo->ref_urb = READ_SUBPATH_INT(fe_path, "urb-ring-ref");
usbctrlinfo->ref_conn = READ_SUBPATH_INT(fe_path, "urb-ring-ref");
tmp = READ_SUBPATH(be_path, "frontend");
usbctrlinfo->frontend = libxl__strdup(NOGC, tmp);
usbctrlinfo->frontend_id = READ_SUBPATH_INT(be_path, "frontend-id");
usbctrlinfo->frontend = libxl__strdup(NOGC, fe_path);
usbctrlinfo->frontend_id = domid;
usbctrlinfo->ports = READ_SUBPATH_INT(be_path, "num-ports");
usbctrlinfo->version = READ_SUBPATH_INT(be_path, "usb-ver");;
tmp = READ_SUBPATH(be_path, "type");
tmp = READ_SUBPATH(libxl_path, "type");
libxl_usbctrl_type_from_string(tmp, &usbctrlinfo->type);
#undef READ_SUBPATH
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.