Move some backend configuration
PATCH 1/1 Move some backend configuration
This patch moves some dom0 variables and backend device configuration from frontend directories to /local/domain/<backdomid>/backend or /vm.
Also,
- the first console is created as a xend device and moves from console/0 to device/console/0
- /vm_path/<domid> is introduced, referencing the /vm path
- /vm_path/device/backend holds the backend device location, rather than storing it in the frontend directory
- a few helpers are added to xs.c to deal with this
Signature · 2 lines
\o/ Pascal Bouchareine - Gandi g 0170393757 15, place de la Nation - 75011 Paris
tools/console/client/main.c +12 -7
@@ -221,7 +221,7 @@ int main(int argc, char **argv) { 0 }, }; -char *path; +char *path, *s;int spty, xsfd;struct xs_handle *xs;char *end;
@@ -257,13 +257,18 @@ int main(int argc, char **argv)signal (SIGTERM , sighandler); - path =xs_get_domain_path (xs, domid); -if (path ==NULL ) -err (errno,"xs_get_domain_path()" ); - path =realloc (path,strlen (path) +strlen ("/console/tty" ) +1 ); -if (path ==NULL ) + path =xs_get_backend_dev (xs, domid,"console" ,0 ); +if (path ==NULL ) { +err (errno,"Could not get backend path to tty" ); + } + + s =realloc (path,strlen (path) +5 ); +if (s ==NULL ) { +free (path);err (ENOMEM ,"realloc" ); -strcat (path,"/console/tty" ); + } + path = s; +strcat (path,"/tty" );/* FIXME consoled currently does not assume domain-0 doesn't have a console which is good when we break domain-0 up. To keep us
tools/console/daemon/io.c +43 -35
162 lines not on this page · raw message
tools/console/daemon/utils.c +2 -2
@@ -109,7 +109,7 @@ bool xen_setup(void)bool xen_setup (void ) { - xs =xs_daemon_open (); + xs =xs_domain_open ();if (xs ==NULL ) {dolog (LOG_ERR ,"Failed to contact xenstore (%m). Is it running?" );
@@ -136,7 +136,7 @@ bool xen_setup(void) out:if (xs) -xs_daemon_close (xs); +xs_domain_close (xs);if (xc !=-1 )xc_interface_close (xc);return false;
tools/python/xen/xend/XendBootloader.py +3 -1
@@ -72,7 +72,9 @@ def bootloader(blexec, disk, dom, quiet fcntl.fcntl(m1, fcntl.F_SETFL, os.O_NDELAY); os.close(s1) slavename = ptsname.ptsname(m1) - dom.storeDom("console/tty", slavename) + + dev = dom.getDeviceController('console') + dev.writeBackend(0, 'tty', slavename) # Release the domain lock here, because we definitely don't want # a stuck bootloader to deny service to other xend clients.
tools/python/xen/xend/XendDomainInfo.py +83 -68
341 lines not on this page · raw message
tools/python/xen/xend/image.py +2 -2
@@ -289,7 +289,7 @@ class ImageHandler: log.info("spawning device models: %s %s", self.device_model, args) # keep track of pid and spawned options to kill it later self.pid = os.spawnve(os.P_NOWAIT, self.device_model, args, env) - self.vm.storeDom("image/device-model-pid", self.pid) + self.vm.storeVm("image/device-model-pid", self.pid) log.info("device model pid: %d", self.pid) def saveDeviceModel(self):
@@ -320,7 +320,7 @@ class ImageHandler: def recreate(self): if self.device_model is None: return - self.pid = self.vm.gatherDom(('image/device-model-pid', int)) + self.pid = self.vm.gatherVm(('image/device-model-pid', int)) def destroyDeviceModel(self): if self.device_model is None:
tools/python/xen/xend/server/ConsoleController.py +14 -2
@@ -2,13 +2,16 @@ from xen.xend.XendLogging import log from xen.xend.XendLogging import log from xen.xend.XendError import VmError + +from xen.xend import XendOptions +xoptions = XendOptions.instance() class ConsoleController(DevController): """A dummy controller for us to represent serial and vnc console devices with persistent UUIDs. """ - valid_cfg = ['location', 'uuid', 'protocol'] + valid_cfg = ['location', 'uuid', 'protocol', 'limit'] def __init__(self, vm): DevController.__init__(self, vm)
@@ -16,8 +19,17 @@ class ConsoleController(DevController): def getDeviceDetails(self, config): back = dict([(k, config[k]) for k in self.valid_cfg if k in config]) - return (self.allocateDeviceID(), back, {}) + devid = self.allocateDeviceID() + front = { } + + if devid == 0 and self.vm.console_mfn: + front.update({ + 'type': '%s' % self.vm.get_console_type() + }) + + back['limit'] = str(xoptions.get_console_limit() * 1024) + return (devid, back, front) def getDeviceConfiguration(self, devid, transaction = None): result = DevController.getDeviceConfiguration(self, devid, transaction)
tools/python/xen/xend/server/DevController.py +39 -21
139 lines not on this page · raw message
tools/python/xen/xend/server/netif.py +4 -34
@@ -141,10 +141,6 @@ class NetifController(DevController): if sec_lab: back['security_label'] = sec_lab - config_path = "device/%s/%d/" % (self.deviceClass, devid) - for x in back: - self.vm._writeVm(config_path + x, back[x]) - back['handle'] = "%i" % devid back['script'] = os.path.join(xoptions.network_script_dir, script) if rate:
@@ -188,40 +184,14 @@ class NetifController(DevController): result = DevController.getDeviceConfiguration(self, devid, transaction) - config_path = "device/%s/%d/" % (self.deviceClass, devid) - devinfo = () for x in ( 'script', 'ip', 'bridge', 'mac', 'type', 'vifname', 'rate', 'uuid', 'model', 'accel', 'security_label'): if transaction is None: - y = self.vm._readVm(config_path + x) + y = self.readBackend(devid, x) else: - y = self.vm._readVmTxn(transaction, config_path + x) - devinfo += (y,) - (script, ip, bridge, mac, typ, vifname, rate, uuid, - model, accel, security_label) = devinfo - - if script: - result['script'] = script - if ip: - result['ip'] = ip - if bridge: - result['bridge'] = bridge - if mac: - result['mac'] = mac - if typ: - result['type'] = typ - if vifname: - result['vifname'] = vifname - if rate: - result['rate'] = rate - if uuid: - result['uuid'] = uuid - if model: - result['model'] = model - if accel: - result['accel'] = accel - if security_label: - result['security_label'] = security_label + y = self.readBackendTxn(transaction, devid, x) + if y: + result[x] = y return result
tools/xenstore/xs.c +60 -0
78 lines not on this page · raw message
tools/xenstore/xs.h +12 -0
@@ -42,6 +42,7 @@ struct xs_handle *xs_daemon_open_readonl/* Close the connection to the xs daemon. */ void xs_daemon_close (struct xs_handle *); +void xs_domain_close (struct xs_handle *);/* Get contents of a directory. * Returns a malloced array: call free() on it after use.
@@ -146,6 +147,17 @@ bool xs_release_domain(struct xs_handle*/ char *xs_get_domain_path (struct xs_handle *h,unsigned int domid); +/* Query the vm path for a domain. Call free() after use. +*/ +char *xs_get_vm_path (struct xs_handle *h,unsigned int domid); + +/* Get a device backend path from domain, devclass, devid */ +char *xs_get_backend_dev (struct xs_handle *h,unsigned int domid,const char *devclass,unsigned int devid); + +/* Get a device frontend path from domain, devclass, devid */ +char *xs_get_frontend_dev (struct xs_handle *h,unsigned int domid,const char *devclass,unsigned int devid); + +/* Return whether the domain specified has been introduced to xenstored. */ bool xs_is_domain_introduced (struct xs_handle *h,unsigned int domid);
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 3 lines · Pascal Bouchareine
This patch moves some dom0 variables and backend device configuration from frontend directories to /local/domain/<backdomid>/backend or /vm.
What is the point of this? These paths, however wrong they might be, are API, surely.
regards
john
Quoted 8 lines · John Levon
Quoted 3 lines · Pascal Bouchareine
This patch moves some dom0 variables and backend device configuration from frontend directories to /local/domain/<backdomid>/backend or /vm.
What is the point of this? These paths, however wrong they might be, are API, surely.
Which guaranteed API would that be? These paths are private to the toolstack implementation. Perhaps the only exception is the xenconsoled-to-console-client xenstore path, but that is the one that most urgently needs to change, since we can't trust domUs not to mess with the tty path, for example.
-- Keir
Quoted 8 lines · Keir Fraser
Quoted 6 lines · John Levon
Quoted 3 lines · Pascal Bouchareine
This patch moves some dom0 variables and backend device configuration from frontend directories to /local/domain/<backdomid>/backend or /vm.
Quoted 5 lines
Quoted 2 lines
What is the point of this? These paths, however wrong they might be, are API, surely.
Which guaranteed API would that be? These paths are private to the toolstack implementation. Perhaps the only exception is the
Precisely the problem, there's absolutely no idea or indication what is and isn't private. Thus you get libvirt looking in places it maybe shouldn't, but how are they supposed to know?
I'm pretty sure this patch breaks libvirt again.
Quoted 3 lines
xenconsoled-to-console-client xenstore path, but that is the one that most urgently needs to change, since we can't trust domUs not to mess with the tty path, for example.
If it's a security fix (and I see the issue), it needs to be much more public than this patch was, and of course backported to at least 3.2 ASAP.
regards
john
Quoted 8 lines · John Levon
Quoted 2 lines
Which guaranteed API would that be? These paths are private to the toolstack implementation. Perhaps the only exception is the
Precisely the problem, there's absolutely no idea or indication what is and isn't private. Thus you get libvirt looking in places it maybe shouldn't, but how are they supposed to know?
I'm pretty sure this patch breaks libvirt again.
I don't really see why it would. Beyond the console-client-to-daemon interface change (which we can make not depend on the /vm_path stuff) the rest is changing things which I believe are internal to xend.
If libvirt is really going in at this private state, perhaps we could patch xend so that it writes to the new locations *in addition to* the old locations. It then has its own guaranteed-private and -consistent state, while libvirt can still read from old locations.
-- Keir
Keir Fraser writes ("Re: [Xen-devel] [PATCH] [Xend] Move some backend configuration"):
Quoted 4 lines
If libvirt is really going in at this private state, perhaps we could patch xend so that it writes to the new locations *in addition to* the old locations. It then has its own guaranteed-private and -consistent state, while libvirt can still read from old locations.
There are other reasons besides libvirt why we might want to write to the old locations for a while too: it will reduce the problems of version skew between various components - for example, tools, and hypervisor.
Does qemu-dm need to interact with this at all ?
Ian.
Quoted 11 lines · Keir Fraser
Quoted 8 lines · John Levon
Quoted 2 lines
Which guaranteed API would that be? These paths are private to the toolstack implementation. Perhaps the only exception is the
Precisely the problem, there's absolutely no idea or indication what is and isn't private. Thus you get libvirt looking in places it maybe shouldn't, but how are they supposed to know?
I'm pretty sure this patch breaks libvirt again.
Quoted 8 lines
I don't really see why it would. Beyond the console-client-to-daemon interface change (which we can make not depend on the /vm_path stuff) the rest is changing things which I believe are internal to xend.
If libvirt is really going in at this private state, perhaps we could patch xend so that it writes to the new locations *in addition to* the old locations. It then has its own guaranteed-private and -consistent state, while libvirt can still read from old locations.
I've done a quick check of what libvirt accesses in xenstore:
General VM metadata
/local/domain/%d/vm
/local/domain/%d/cpu
/local/domain/%d/name
/local/domain/%d/running
/local/domain/%d/memory/target
/local/domain/%d/cpu_time
Console data
/local/domain/%d/console/vnc-port
/local/domain/%d/console/tty
For fetching disk/net statistics
/local/domain/0/backend/vbd/%d/%d/state
/local/domain/0/backend/vif/%d
/local/domain/0/backend/vbd/%d
/local/domain/0/backend/tap/%d
The first group is not being changed, so that's not a problem. Likewise the latter is not impacted. The only problem I see is with the console TTY paths and VNC port.
While I would prefer it not to change, or have backwards compatability data written in existing fields, we have the ability to check multiple different data sources. So if the TTY info and VNC port is available via the 'xm list --long' output we could make libvirt check there if it fails to find it in xenstore. We only historically used xenstored for the few occassions when the 'xm list --long' output was incomplete.
Daniel
Signature · 4 lines
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
Quoted 4 lines · Daniel P. Berrange
Console data
/local/domain/%d/console/vnc-port
/local/domain/%d/console/tty
Duplicating this pair of nodes sounds fine to me, *but* then libvirt is simply remaining vulnerable to the kind of attack we're are looking to avoid? Can any good really come from keeping the old locations?
-- Keir
Quoted 8 lines · Keir Fraser
Quoted 4 lines
Console data
/local/domain/%d/console/vnc-port
/local/domain/%d/console/ttyDuplicating this pair of nodes sounds fine to me, *but* then libvirt is simply remaining vulnerable to the kind of attack we're are looking to avoid? Can any good really come from keeping the old locations?
Why isn't xenstored refusing writes/deletes from domid != 0 for these ? Isn't this a much better fix?
It's ugly, but the mistake was made a long time ago, and it seems like it should be lived with.
BTW, the ability to change the name or whatever also seems suspect, though most likely less serious.
regards
john
Quoted 2 lines · John Levon
Why isn't xenstored refusing writes/deletes from domid != 0 for these ? Isn't this a much better fix?
We have to manage races and such, and prevent deletion up to the parent nodes, too - Was not sure this was wanted/easy to do, or clean as you mention
Quoted 2 lines
BTW, the ability to change the name or whatever also seems suspect, though most likely less serious.
Untrusted user input coming into dom0 surely leads to bad things. "name" is stored into /vm too, I guess this one is used by tools ?
Most sensitive information in xend can be moved replacing calls to read/storeDom with calls to read/storeVm.
Signature · 2 lines
\o/ Pascal Bouchareine - Gandi g 0170393757 15, place de la Nation - 75011 Paris
Quoted 10 lines · Keir Fraser
Quoted 4 lines · Daniel P. Berrange
Console data
/local/domain/%d/console/vnc-port
/local/domain/%d/console/ttyDuplicating this pair of nodes sounds fine to me, *but* then libvirt is simply remaining vulnerable to the kind of attack we're are looking to avoid? Can any good really come from keeping the old locations?
Given that this is security sensitive, I have no objection to updating libvirt to read from the new locations. The only thing I need to work out is a reliable way to choose when to use the new location, vs the looking at old location (for compat with existing deployments).
Daniel
Signature · 4 lines
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
Quoted 8 lines · Daniel P. Berrange
Quoted 7 lines · Keir Fraser
Quoted 4 lines · Daniel P. Berrange
Console data
/local/domain/%d/console/vnc-port
/local/domain/%d/console/tty
Quoted 8 lines
Quoted 3 lines
Duplicating this pair of nodes sounds fine to me, *but* then libvirt is simply remaining vulnerable to the kind of attack we're are looking to avoid? Can any good really come from keeping the old locations?
Given that this is security sensitive, I have no objection to updating libvirt to read from the new locations. The only thing I need to work out is a reliable way to choose when to use the new location, vs the looking at old location (for compat with existing deployments).
I think the existence of /vm_path would do that, but we need to move *all* this stuff, surely. /local/domain/X/ should be effectively write-only from dom0 since none of it is trustworthy.
regards
john
Quoted 8 lines · Daniel P. Berrange
Quoted 3 lines
Duplicating this pair of nodes sounds fine to me, *but* then libvirt is simply remaining vulnerable to the kind of attack we're are looking to avoid? Can any good really come from keeping the old locations?
Given that this is security sensitive, I have no objection to updating libvirt to read from the new locations. The only thing I need to work out is a reliable way to choose when to use the new location, vs the looking at old location (for compat with existing deployments).
That's an interesting question. Obviously you don't want to race their creation and go down the unsafe path unnecessarily.
We could add a node to xenstore, or append version/feature info to the pid file? Do you have a preference?
-- Keir
Quoted 11 lines · Keir Fraser
Quoted 8 lines · Daniel P. Berrange
Quoted 3 lines
Duplicating this pair of nodes sounds fine to me, *but* then libvirt is simply remaining vulnerable to the kind of attack we're are looking to avoid? Can any good really come from keeping the old locations?
Given that this is security sensitive, I have no objection to updating libvirt to read from the new locations. The only thing I need to work out is a reliable way to choose when to use the new location, vs the looking at old location (for compat with existing deployments).
Quoted 5 lines
That's an interesting question. Obviously you don't want to race their creation and go down the unsafe path unnecessarily.
We could add a node to xenstore, or append version/feature info to the pid file? Do you have a preference?
I think its probably best to have explicit "feature" info written into somewhere in xenstore to indicate that the new layout is in use - "version" info would get too confusing when we inevitably have to backport this stuff.
To avoid a race condition we'd not want it in the per-VM areas. It'd want to be a global feature flag we can probe once when libvirt connects, rather than probing per guest.
I notice there's a /tool area that's unused
# xenstore-ls /tool xenstored = ""
Could put a little feature flag node there perhaps ?
Daniel
Signature · 4 lines
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
Quoted 3 lines · Daniel P. Berrange
libvirt to read from the new locations. The only thing I need to work out is a reliable way to choose when to use the new location, vs the looking at old location (for compat with existing deployments).
I think /vm_path existence indicates to look through /vm/, as for the race I'm not sure how to handle this, however /vm and /vm_path are updated before device creation - this should be equivalent to looking at /local/domain.
Signature · 2 lines
\o/ Pascal Bouchareine - Gandi g 0170393757 15, place de la Nation - 75011 Paris
Keir Fraser writes ("Re: [Xen-devel] [PATCH] [Xend] Move some backend configuration"):
Quoted 8 lines · Daniel P. Berrange
Quoted 3 lines
Console data
/local/domain/%d/console/vnc-port
/local/domain/%d/console/ttyDuplicating this pair of nodes sounds fine to me, *but* then libvirt is simply remaining vulnerable to the kind of attack we're are looking to avoid? Can any good really come from keeping the old locations?
Once again we have this tradeoff: in an old installation which has not been properly patched or updated, should we
(a) continue to let the system `work' but be vulnerable
(b) make the system report an error so that the administrator knows that it needs to be fixed.
At least in this case I suppose we can expect old installations to be patched _eventually_ ...
Ian.
Quoted 8 lines · Ian Jackson
Once again we have this tradeoff: in an old installation which has not been properly patched or updated, should we
(a) continue to let the system `work' but be vulnerable
(b) make the system report an error so that the administrator knows that it needs to be fixed.At least in this case I suppose we can expect old installations to be patched _eventually_ ...
An update on this: I solved this issue by fiddling permissions in xenstore after all! /local/domain/<domid> is now read-only to the guest, and specific subdirs only are writable (currently device, error and control).
This fixes the console vulnerability with no annoying movement of entries, and also gets rid of the new /vm_path entries in xenstore since /l/d/<domid>/vm can be trusted now.
I've compacted the changesets together and backported to 3.3 for 3.3.1. It'll also be an obvious candidate for 3.2 branch if that branch gets an ongoing maintainer.
Of course the one downside is that this slightly changes the guest-visible interface since it can't scribble at will in /l/d/<domid> any more. I hope noone was relying on that! If we need to open up some more specific subdirs for write access, I will consider that.
-- Keir
Quoted 3 lines · Keir Fraser
An update on this: I solved this issue by fiddling permissions in xenstore after all! /local/domain/<domid> is now read-only to the guest, and specific subdirs only are writable (currently device, error and control).
writing into device allows the guest to rewrite it's backend location, this should be protected too i guess ?
the patch stored backend paths into /vm for this reason
Signature · 2 lines
\o/ Pascal Bouchareine - Gandi g 0170393757 15, place de la Nation - 75011 Paris
Quoted 9 lines · Pascal Bouchareine
Quoted 3 lines · Keir Fraser
An update on this: I solved this issue by fiddling permissions in xenstore after all! /local/domain/<domid> is now read-only to the guest, and specific subdirs only are writable (currently device, error and control).
writing into device allows the guest to rewrite it's backend location, this should be protected too i guess ?
the patch stored backend paths into /vm for this reason
I kept that part of your patch as indeed the guest can still modify its backend reference.
-- Keir
Pascal Bouchareine writes ("Re: [Xen-devel] [PATCH] [Xend] Move some backend configuration"):
Quoted 7 lines · Keir Fraser
Quoted 3 lines
An update on this: I solved this issue by fiddling permissions in xenstore after all! /local/domain/<domid> is now read-only to the guest, and specific subdirs only are writable (currently device, error and control).
writing into device allows the guest to rewrite it's backend location, this should be protected too i guess ?
We will arrange for the backend location not to be trusted by anything important. In fact, it is entirely formulaic: if you know which domain the backend is supposed to be in, you can simply shuffle the path components. And you can double check against the backend's frontend path.
Ian.
Quoted 8 lines · Ian Jackson
Quoted 2 lines
writing into device allows the guest to rewrite it's backend location, this should be protected too i guess ?
We will arrange for the backend location not to be trusted by anything important. In fact, it is entirely formulaic: if you know which domain the backend is supposed to be in, you can simply shuffle the path components. And you can double check against the backend's frontend path.
If you know the backend domid this works great. You don't need to check anything in this case. If you try to validate the frontend's backend reference then that's hard: strictly speaking you can only trust the /local/domain/0 path prefix since otherwise two domains could collude to redirect you to a backend directory under their control (or a domain could point you at a 'backend directory' under its own path prefix, for example). So this approach really only works for backends known to be in dom0 (which of course is true for the vast majority of Xen installations). Hence xend is storing the backend path under /vm where it's safe. Equally it could store only the backend-id and construct the backend path from that.
-- Keir
Keir Fraser writes ("Re: [Xen-devel] [PATCH] [Xend] Move some backend configuration"):
Quoted 2 lines
If you know the backend domid this works great. You don't need to check anything in this case.
Right. qemu (non-stubdom, which is the relevant case) knows its own domid and that is the relevant one - because qemu is providing a parallel path to the pv frontend/backend arrangements, the relevant backend it is supposed to be the one that qemu is running in.
If it isn't then there is something wrong, so it should check it.
Ian.
Quoted 4 lines · Keir Fraser
Of course the one downside is that this slightly changes the guest-visible interface since it can't scribble at will in /l/d/<domid> any more. I hope noone was relying on that! If we need to open up some more specific subdirs for write access, I will consider that.
We're writing to the following paths that aren't standard:
device-misc/vif/default-link
hvmpv/{xpv,xdf,xpvd,xnf}/version
Can they be opened up? (Ideally we'd use the guest/ suggestion below, and we will, but there's already stuff out there assuming it can do this.)
Also, I'd like to see an explicit /l/d/domid/guest directory. The guest can write anything there, but there's a clear indicator that it's not to be trusted (we could even document this stuff by expanding xenstore.txt ?)
regards
john
Quoted 8 lines · John Levon
We're writing to the following paths that aren't standard:
device-misc/vif/default-link
hvmpv/{xpv,xdf,xpvd,xnf}/versionCan they be opened up? (Ideally we'd use the guest/ suggestion below, and we will, but there's already stuff out there assuming it can do this.)
What happens if you try to write them, and fail? What are they actually used for (e.g., communication with your own xvm tool stack?).
Quoted 4 lines
Also, I'd like to see an explicit /l/d/domid/guest directory. The guest can write anything there, but there's a clear indicator that it's not to be trusted (we could even document this stuff by expanding xenstore.txt ?)
Probably a good idea.
-- Keir
Quoted 6 lines · Keir Fraser
Quoted 4 lines
Also, I'd like to see an explicit /l/d/domid/guest directory. The guest can write anything there, but there's a clear indicator that it's not to be trusted (we could even document this stuff by expanding xenstore.txt ?)
Probably a good idea.
On the other hand, should we be encouraging guests to squirrel guest-specific stuff away in xenstore? Really it's for communication with backends (via device/ subdir) and with toolstacks (which can open up access to other subdirs if they wish, since presumably they run in dom0). It's not supposed to be a handy storage area (and indeed it doesn't persist across save/restore).
-- Keir
Quoted 11 lines · Keir Fraser
Quoted 8 lines
We're writing to the following paths that aren't standard:
device-misc/vif/default-link
hvmpv/{xpv,xdf,xpvd,xnf}/versionCan they be opened up? (Ideally we'd use the guest/ suggestion below, and we will, but there's already stuff out there assuming it can do this.)
What happens if you try to write them, and fail? What are they actually used for (e.g., communication with your own xvm tool stack?).
They're both tool stack values, so in the sense that we can permanently patch xenstored, you don't need the change, you're right. Although, we're already carrying way way too much customizations.
The former contains the "main" IP address of the domU. The latter contain driver versions, to allow for the tool stack to determine a need for updates. Note that neither are general enough to try and merge up as a standard thing IMO, perhaps you disagree.
Regarding guest/ - xenstore is by far the simplest and easiest way to communicate with the tool stack. I strongly doubt that we're the only vendor to have done, or want to do, something like the above. Of course there are caveats, but compared to the alternative (guest additions - blech), it's pretty low cost.
I don't see it going away, so in my mind explicitly saying now that you should only use guest/$(VENDOR) will avoid a lot of trouble down the line.
regards
john
Quoted 7 lines · John Levon
Quoted 2 lines
What happens if you try to write them, and fail? What are they actually used for (e.g., communication with your own xvm tool stack?).
They're both tool stack values, so in the sense that we can permanently patch xenstored, you don't need the change, you're right. Although, we're already
carrying way way too much customizations.
Well, you don't need to patch xenstored. Your customised toolstack -- the one that consumes these extra nodes -- can also open them up, right? The only reason to open them in xend is if that is the difference between them working and not working running against the default open-source toolstack.
I will allow these through if there is a net win for compatibility with the default open-source toolstack. But I don't particularly want to do so just to save you a one-line patch to your xend or equivalent.
Quoted 3 lines
I don't see it going away, so in my mind explicitly saying now that you should only use guest/$(VENDOR) will avoid a lot of trouble down the line.
Mmm... I suppose I can see logic here. Vendor daemons running alongside open-source xend for example.
-- Keir
Quoted 5 lines · Keir Fraser
Quoted 4 lines
They're both tool stack values, so in the sense that we can permanently patch xenstored, you don't need the change, you're right. Although, we're already
carrying way way too much customizations.
Quoted 8 lines
Well, you don't need to patch xenstored. Your customised toolstack -- the one that consumes these extra nodes -- can also open them up, right? The only reason to open them in xend is if that is the difference between them working and not working running against the default open-source toolstack.
I will allow these through if there is a net win for compatibility with the default open-source toolstack. But I don't particularly want to do so just to save you a one-line patch to your xend or equivalent.
I should have read your fix. We will probably do that one-liner to xend too (the toolstack lives at least two levels above xend, so it's not the best place).
thanks,
john
John Levon writes ("Re: [Xen-devel] [PATCH] [Xend] Move some backend configuration"):
Quoted 10 lines · Keir Fraser
Quoted 4 lines
Of course the one downside is that this slightly changes the guest-visible interface since it can't scribble at will in /l/d/<domid> any more. I hope noone was relying on that! If we need to open up some more specific subdirs for write access, I will consider that.
We're writing to the following paths that aren't standard:
device-misc/vif/default-link
hvmpv/{xpv,xdf,xpvd,xnf}/version
What are these and how are they used ?
Quoted 1 line
(we could even document this stuff by expanding xenstore.txt ?)
xenstore.txt currently has only the xenstored<->domains protocol, and doesn't specify the structure or meaning of the xenstore tree.
interface.tex is supposed to do the latter but it's hopelessly out of date and of course no-one really wants to edit TeX when they update anything.
If some kind soul were to make a stab at extracting the relevant (true!) parts of interface.tex into a new .txt file that would be very nice :-).
Ian.
Quoted 5 lines · John Levon
Precisely the problem, there's absolutely no idea or indication what is and isn't private. Thus you get libvirt looking in places it maybe shouldn't, but how are they supposed to know?
I'm pretty sure this patch breaks libvirt again.
Regarding compatibility:
This might not break too much stuff as we kept the original backend path(s) at their location. Most obvious fix for other clients is changing the reading of the backend location from the frontend directory, but the old behaviour still works.
However, some parts (the console tty, location) have changed and require attention.
Quoted 3 lines
If it's a security fix (and I see the issue), it needs to be much more public than this patch was, and of course backported to at least 3.2 ASAP.
It might well be a security fix, even if this sounds like a moderate issue yet.
I agree this requires a quick update, but we need to discuss it here before publicizing ?
Signature · 2 lines
\o/ Pascal Bouchareine - Gandi g 0170393757 15, place de la Nation - 75011 Paris
Quoted 8 lines · Keir Fraser
Quoted 6 lines · John Levon
Quoted 3 lines · Pascal Bouchareine
This patch moves some dom0 variables and backend device configuration from frontend directories to /local/domain/<backdomid>/backend or /vm.
Quoted 8 lines
Quoted 2 lines
What is the point of this? These paths, however wrong they might be, are API, surely.
Which guaranteed API would that be? These paths are private to the toolstack implementation. Perhaps the only exception is the xenconsoled-to-console-client xenstore path, but that is the one that most urgently needs to change, since we can't trust domUs not to mess with the tty path, for example.
Actually I'm wrong: avoiding finding backend paths by looking in frontend-writable xenstore nodes is even more important. But that bit of the patch should be uncontentious: it's just xend adding extra private state in xenstore for its own private use.
The 'helper' functions added to libxenstore perhaps make this look more like an interface change than it actually is. Noone is forced to use those extra utility functions, and they're only going to make sense when the /vm_path/ stuff has been set up by xend. Arguably those functions should be implemented in the xend python wrapper for xenstore, and perhaps duplicated as necessary in the console client (or arguably the client could safely assume the console daemon is in dom0 and hardcode the backend path prefix!).
The console client-to-daemon interface change is unfortunate, but I can't think of an easy alternative fix.
-- Keir
Quoted 2 lines · Keir Fraser
frontend-writable xenstore nodes is even more important. But that bit of the patch should be uncontentious: it's just xend adding extra private state in
Yep, no problem with that.
Quoted 2 lines
The console client-to-daemon interface change is unfortunate, but I can't think of an easy alternative fix.
No me neither, I think you're indeed forced to break the API and libvirt will just have to change.
regards
john