libxl: Record backend/frontend paths in /libxl/$DOMID

This gives us a record of all the backends we have set up for a
domain, which is separate from the frontends in
  /local/domain/$DOMID/device.

In particular:

1. A guest has write permission for the frontend path:
  /local/domain/$DOMID/device/$KIND/$DEVID
which means that the guest can completely delete the frontend.
(They can't recreate it because they don't have write permission
on the containing directory.)

2. A guest has write permission for the backend path recorded in the
frontend, ie, it can write to
  /local/domain/$DOMID/device/$KIND/$DEVID/backend
which means that the guest can break the association between
frontend and backend.

So we can't rely on iterating over the frontends to find all the
backends, or examining a frontend to discover how a device is
configured.

So, have libxl__device_generic_add record the frontend and backend
paths in /libxl/$DOMID/device, and have libxl__device_destroy remove
them again.

Create the containing directory /libxl/GUEST/device in
libxl__domain_make.  The already existing xs_rm in devices_destroy_cb
will take care of removing it.

This is part of XSA-175.

Backport note: Backported over 7472ced, which fixes a bug in driver
domain teardown.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
This commit is contained in:
Ian Jackson authored and Ian Jackson committed 2016-06-06 15:54:26 +01:00
1 parent 01311b90ce
commit e9c81e9316
4 files changed
+51 -1

No files matched your search

+15
View File
@@ -381,6 +381,21 @@ The guest's virtual time offset from UTC in seconds.
### libxl Specific Paths
#### /libxl/$DOMID/device/$KIND/$DEVID
Created by libxl for every frontend/backend pair created for $DOMID.
Used by libxl for enumeration and management of the device.
#### /libxl/$DOMID/device/$KIND/$DEVID/frontend
Path in xenstore to the frontend, normally
/local/domain/$DOMID/device/$KIND/$DEVID
#### /libxl/$DOMID/device/$KIND/$DEVID/backend
Path in xenstore to the backend, normally
/local/domain/$BACKEND_DOMID/backend/$KIND/$DOMID/$DEVID
#### /libxl/$DOMID/dm-version ("qemu\_xen"|"qemu\_xen\_traditional") = [n,INTERNAL]
The device model version for a domain.
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.