summaryrefslogtreecommitdiffstats
path: root/hw
diff options
context:
space:
mode:
authorIan Campbell <ian.campbell@citrix.com>2016-01-15 13:23:43 +0000
committerTimothy Pearson <tpearson@raptorengineering.com>2019-11-29 19:29:55 -0600
commit564cd6ed0b2c3c31572b692ab4752c489f974c8b (patch)
tree1fb5bb9bac08c9cdc3778125524c638ab8a217d6 /hw
parentd3321e16c8fb0d4ccbd853820b0a78bf7d763ebd (diff)
downloadhqemu-564cd6ed0b2c3c31572b692ab4752c489f974c8b.zip
hqemu-564cd6ed0b2c3c31572b692ab4752c489f974c8b.tar.gz
xen: domainbuild: reopen libxenctrl interface after forking for domain watcher.
Using an existing libxenctrl handle after a fork was never particularly safe (especially if foreign mappings existed at the time of the fork) and the xc fd has been unavailable for many releases. Reopen the handle after fork and therefore do away with xc_fd(). Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/xenpv/xen_domainbuild.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/hw/xenpv/xen_domainbuild.c b/hw/xenpv/xen_domainbuild.c
index ac0e5ac..f9be029 100644
--- a/hw/xenpv/xen_domainbuild.c
+++ b/hw/xenpv/xen_domainbuild.c
@@ -174,12 +174,15 @@ static int xen_domain_watcher(void)
for (i = 3; i < n; i++) {
if (i == fd[0])
continue;
- if (i == xc_fd(xen_xc)) {
- continue;
- }
close(i);
}
+ /*
+ * Reopen xc interface, since the original is unsafe after fork
+ * and was closed above.
+ */
+ xen_xc = xc_interface_open(0, 0, 0);
+
/* ignore term signals */
signal(SIGINT, SIG_IGN);
signal(SIGTERM, SIG_IGN);
OpenPOWER on IntegriCloud