]> xenbits.xensource.com Git - xen.git/commit
tools/ocaml/xenstored: clean up permissions for dead domains
authorEdwin Török <edvin.torok@citrix.com>
Tue, 15 Dec 2020 13:33:16 +0000 (14:33 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 15 Dec 2020 13:33:16 +0000 (14:33 +0100)
commit2525a745e18bbf14b4f7b1b18209a0ab9166178d
treec3b4e020d3459fe3d3d67ae80776058ed26a32b4
parentc8b97ff6797f594421e8ed86fc2dd09b70424457
tools/ocaml/xenstored: clean up permissions for dead domains

domain ids are prone to wrapping (15-bits), and with sufficient number
of VMs in a reboot loop it is possible to trigger it.  Xenstore entries
may linger after a domain dies, until a toolstack cleans it up. During
this time there is a window where a wrapped domid could access these
xenstore keys (that belonged to another VM).

To prevent this do a cleanup when a domain dies:
 * walk the entire xenstore tree and update permissions for all nodes
   * if the dead domain had an ACL entry: remove it
   * if the dead domain was the owner: change the owner to Dom0

This is done without quota checks or a transaction. Quota checks would
be a no-op (either the domain is dead, or it is Dom0 where they are not
enforced).  Transactions are not needed, because this is all done
atomically by oxenstored's single thread.

The xenstore entries owned by the dead domain are not deleted, because
that could confuse a toolstack / backends that are still bound to it
(or generate unexpected watch events). It is the responsibility of a
toolstack to remove the xenstore entries themselves.

This is part of XSA-322.

Signed-off-by: Edwin Török <edvin.torok@citrix.com>
Acked-by: Christian Lindig <christian.lindig@citrix.com>
tools/ocaml/xenstored/perms.ml
tools/ocaml/xenstored/process.ml
tools/ocaml/xenstored/store.ml
tools/ocaml/xenstored/xenstored.ml