aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xenstore/xenstored_core.c
Commit message (Collapse)AuthorAgeFilesLines
* xenstored: handle unlikely failure better in ask_parentsMatthew Daley2013-09-251-1/+3
| | | | | | Coverity-ID: 1055277 Signed-off-by: Matthew Daley <mattjd@gmail.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* Switch to poll() in cxenstored's IO loopWei Liu2013-04-111-60/+131
| | | | | | | | | | | | | | | | | Poll() can support more file descriptors than select(). We've done this for xenconsoled, now do this for cxenstored as well. The code is taken from xenconsoled and modified to adapt to cxenstored. Note that poll() semantic is a bit different from select(). In Linux, if a fd is set in IN/OUT fd_set and error occurs inside select(), this fd is still considered readable / writable, and it is set in the returned IN/OUT fd_set. So in later handle_input / handle_output, the connection will eventually be talloc_free'ed(). After switching to poll(), we should take care of any error right away, making the code clearer. Signed-off-by: Wei Liu <wei.liu2@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* nstore: rename public xenstore headersIan Campbell2012-05-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | The xenstore header xs.h is producing conflicts with other software[1]. xs is a too short identifier and does not matche the library. Renaming the headers to xenstore.h and xenstore_lib.h is the easiest way to make them easy recognizable and prevent furthe problems. [1]: http://bugs.debian.org/668550 [ Also update QEMU_TAG, to bring in corresponding change to qemu-xen-traditional. -iwj ] Signed-off-by: Bastian Blank <waldi@debian.org> Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com> --HG-- rename : tools/xenstore/xs.h => tools/xenstore/xenstore.h rename : tools/xenstore/xs_lib.h => tools/xenstore/xenstore_lib.h
* xenstored: add --priv-domid parameterDaniel De Graaf2012-02-091-0/+5
| | | | | | | | | | | | This parameter identifies an alternative service domain which has superuser access to the xenstore database, which is currently required to set up a new domain's xenstore entries. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Acked-by: Ian Campbell <ian.campbell@citrix.com> Cc: Ian Jackson <ian.jackson@eu.citrix.com> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
* xenstored: use domain_is_unprivileged instead of checking conn->idDaniel De Graaf2012-02-091-3/+3
| | | | | | | | | | | This centralizes all the permission checking for privileged domains in preparation for allowing domains other than dom0 to be privileged. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Acked-by: Ian Campbell <ian.campbell@citrix.com> Cc: Ian Jackson <ian.jackson@eu.citrix.com> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
* xenstored: add --event parameter for bootstrappingDaniel De Graaf2012-02-091-0/+5
| | | | | | | | | | | | When xenstored is run in a minios domain, it needs a bootstrap connection to dom0 so that additional domain introduce messages can be sent to it. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Acked-by: Ian Campbell <ian.campbell@citrix.com> Cc: Ian Jackson <ian.jackson@eu.citrix.com> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
* xenstored: support running in minios stubdomDaniel De Graaf2012-02-091-78/+10
| | | | | | | | | | | | | A previous versions of this patch has been sent to xen-devel. See http://lists.xensource.com/archives/html/xen-devel/2009-03/msg01655.html Signed-off-by: Diego Ongaro <diego.ongaro@citrix.com> Signed-off-by: Alex Zeffertt <alex.zeffertt@eu.citrix.com> Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Acked-by: Ian Campbell <ian.campbell@citrix.com> Cc: Ian Jackson <ian.jackson@eu.citrix.com> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
* xenstored: add --internal-db flagDaniel De Graaf2012-02-091-6/+14
| | | | | | | | Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Acked-by: Ian Campbell <ian.campbell@citrix.com> Cc: Ian Jackson <ian.jackson@eu.citrix.com> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
* xenstored: add NO_SOCKETS compilation optionAlex Zeffertt2012-02-091-5/+23
| | | | | | | | | | | | | Add option for compiling xenstored without unix sockets to support running on mini-OS Signed-off-by: Diego Ongaro <diego.ongaro@citrix.com> Signed-off-by: Alex Zeffertt <alex.zeffertt@eu.citrix.com> Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Acked-by: Ian Campbell <ian.campbell@citrix.com> Cc: Ian Jackson <ian.jackson@eu.citrix.com> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
* xenstored: refactor socket setup codeDaniel De Graaf2012-02-091-39/+46
| | | | | | | | Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Acked-by: Ian Campbell <ian.campbell@citrix.com> Cc: Ian Jackson <ian.jackson@eu.citrix.com> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
* xenstored: Fix processing of zero-length messagesDaniel De Graaf2011-11-011-1/+0
| | | | | | | | | | | When a message with zero length is sent to xenstore, the body of the message was not processed until the socket or ring had more data to read; this will cause deadlocks if the requestor is waiting on a response to continue. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* xenstored: allow guest to shutdown all its watches/transactionsOlaf Hering2011-09-151-0/+5
| | | | | | | | | | | | | | | | During kexec all old watches have to be removed, otherwise the new kernel will receive unexpected events. Allow a guest to reset itself and cleanup all of its watches and transactions. Add a new XS_RESET_WATCHES command to do the reset on behalf of the guest. (Changes by iwj: specify the argument to be a single nul byte. Permit read-only clients to use the new command.) Signed-off-by: Olaf Hering <olaf@aepfle.de> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* tools: xenstored: make usage info of xenstored accurateJuergen Gross2011-03-311-1/+1
| | | | | | | | The usage printed for xenstored was not in sync with the parameters defined in the code. Signed-off-by: juergen.gross@ts.fujitsu.com Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxc: convert evtchn interfaces to use an opaque handle typeIan Campbell2010-12-231-3/+3
| | | | | | | | | | | | This makes the interface consistent with the changes made to the main interface in 21483:779c0ef9682c. Also fix some references to "struct xc_interface" which should have been simply "xc_interface" in tools/xenpaging, and update QEMU_TAG to pull in the corresponding qemu change. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* xenstored: fix use-after free bugKeir Fraser2009-03-011-2/+4
| | | | | | | | | | | Problem: Handling requests for one connection can not only zap the connection itself, due to socket disconnects for example. It can also zap *other* connections, due to domain release requests. Especially it can zap the connection we have saved a pointer to in the "next" variable. From: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* tools: Declare functions static where they should be, and provideKeir Fraser2008-07-151-17/+0
| | | | | | proper prototypes for others as required. Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
* xemnstored: Fix xenstored abort when connection dropped.Keir Fraser2008-05-011-9/+21
| | | | | | | | | | | | | If a connection is dropped with pending input and output data then the connection will be dereferenced by both handle_input and handle_output resulting in a double free when the main loop dereferences the connection. Fix this issue by taking/releasing a reference over the calls to handle_input and handle_output separately and checking the result of talloc_free to see if the connection went away. Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
* xenstore: fix canonicalize for metanodesKeir Fraser2008-04-091-1/+1
| | | | Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
* Add DTrace support to xenstoredKeir Fraser2008-01-311-5/+10
| | | | | | | Add USDT probes for significant xenstore operations to allow dynamic tracing. Signed-off-by: John Levon <john.levon@sun.com>
* New XS_SET_TARGETKeir Fraser2008-01-231-2/+11
| | | | | | | | | | | Stubdomains (and probably other domain disagregation elements too) need to be able to tinker with another domain. This adds XS_SET_TARGET so that XenStore allows domains to have permissions on files on which the "target" has permissions. This also adds xs_set_target, called by the domain builder when the 'target' option is used in the configuration. Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
* xenstore size limitsKeir Fraser2007-12-141-1/+4
| | | | | | | | | | | | | | | * Documents the existing 4kby size limit on xenstore message payloads * Causes xs.c in libxenstore to fail locally rather than violating said limit (which is good because xenstored kills the client connection if it's exceeded). * Introduces some limits on path lengths in xenstored. I trust no-one is using path lengths >2kby. This is good because currently a domain client can create a 4kby relative path that the dom0 tools cannot access since they'd have to specify the somewhat longer absolute path. * Removes uses of the host's PATH_MAX (!) Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* xenstore: document the xenstore protocolKeir Fraser2007-12-051-3/+12
| | | | | | | | | | | | | | | | | The attached patch adds a new text file docs/misc/xenstore.txt which describes the actual protocol implemented by xenstored. This was reverse-engineered from the actual code in tools/xenstore. I didn't bother making any automatic arrangements to ensure that the implemented and documented protocols are kept in step (for example, automatic code generation, etc.) The protocol is rather messy unfortunately and unsuitable for an xdr approach, and in any case is not likely to change very quickly. Also in this patch are a couple of comments for xenstored_core.c which help clarify the behaviour of some payload parsing helper functions. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* xenstore: sprintf->snprintf, and fix for OpenBSD.Keir Fraser2007-10-051-2/+2
| | | | Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
* Fix xenstored's dup2() usage.kfraser@localhost.localdomain2007-09-071-4/+4
| | | | | | | The dup2() calls had their arguments reversed. Also remove the unnecessary close() calls. Signed-off-by: John Levon <john.levon@sun.com>
* xenstore: Redirect stdin/stdout/stderr to /dev/null.kfraser@localhost.localdomain2007-08-011-4/+8
| | | | Signed-off-by: Keir Fraser <keir@xensource.com>
* xenstore: Do not assign to stdout/stderr/stdin - they are notkfraser@localhost.localdomain2007-08-011-5/+1
| | | | | implemented as variables on all systems. Signed-off-by: Keir Fraser <keir@xensource.com>
* xenstored: Do not write to stderr if we are daemonised!kfraser@localhost.localdomain2007-08-011-1/+8
| | | | | | This fixes client reader-thread deaths in which a 'garbage string' was being read instead of a well-formed message header. Signed-off-by: Keir Fraser <keir@xensource.com>
* xenstored: Fix socket-based connection teardown. Reading zero byteskfraser@localhost.localdomain2007-07-251-0/+6
| | | | | | *should* in fact cause the connection to be destroyed. Fix this with a little extra code in the readfd() handler. Signed-off-by: Keir Fraser <keir@xensource.com>
* xenstore: Small cleanups and fixes.kfraser@localhost.localdomain2007-07-241-8/+30
| | | | | | | | 1. readfd/writefd account for EINTR/EAGAIN errno returns. 2. Handle zero return from ->read() and ->write() handlers symmetrically. 3. Fix some indentation issues (use hard tabs). Signed-off-by: Keir Fraser <keir@xensource.com>
* xenstored: Fairly round-robin schedule work across all connections.kfraser@localhost.localdomain2007-07-241-43/+43
| | | | | Avoids total starvation under some workloads. Signed-off-by: Keir Fraser <keir@xensource.com>
* xenstore: Remove broken and unmaintained test code.kfraser@localhost.localdomain2007-07-031-102/+3
| | | | Signed-off-by: Keir Fraser <keir@xensource.com>
* Handle EOF on xenstored socket.Steven Hand2007-04-271-1/+1
| | | | | | Suggested by Pavel Kankovsky <peak@argo.troja.mff.cuni.cz>. Signed-off-by: Steven Hand <steven@xensource.com>
* xenstored: Only dom0 can do XS_DEBUG in non-test environments.kfraser@localhost.localdomain2007-04-211-0/+7
| | | | Signed-off-by: Keir Fraser <keir@xensource.com>
* xenstore: add XS_RESUME command; export it to xend.kfraser@localhost.localdomain2007-01-191-0/+5
| | | | | | | | This clears the shutdown flag for a domain in xenstore, allowing subsequent shutdowns of the same domain to fire the appropriate watches. Signed-off-by: Brendan Cully <brendan@cs.ubc.ca>
* Fix handling of the entries-per-domain quota. Entries which are created byEwan Mellor2006-11-131-6/+19
| | | | | | | | | | | | | the guest but deleted by dom0 were remaining accounted against the guest, which meant that the guest would eventually run out of quota. This patch also prevents unprivileged domains from changing the owner of a node. One guest could attack another by creating nodes and then transferring them to the ownership of another, and though the accounting could be made to work properly in this case, domains should never be transferring nodes in any case, so it seems safer just to disallow the operation entirely. Signed-off-by: Ewan Mellor <ewan@xensource.com>
* [XENSTORED] Fix errno 'leak' in xenstored.kaf24@localhost.localdomain2006-11-111-1/+3
| | | | | | | | | | | In certain cases, when a client doesn't have enough permissions, the errno variable is not set in xenstored_core.c before its value is reported back. As a result, the client can learn about the errno of the last failed request to xenstored (which could have come from another client). (An unintended information channel! :-) From: Magnus Carlsson <magnus@galois.com> Signed-off-by: Keir Fraser <keir@xensource.com>
* [SOLARIS] Create kernel-interface implementations for libxc and xenstored.kfraser@localhost.localdomain2006-10-171-0/+3
| | | | | | Additionally, on Solaris, tell the kernel when xenstored is running. Signed-off-by: John Levon <john.levon@sun.com>
* [SOLARIS] A couple of simple compile fixes for tools/ on Solaris.kfraser@localhost.localdomain2006-10-171-2/+2
| | | | Signed-off-by: John Levon <john.levon@sun.com>
* Add a transaction_started field in xenstored connection structure instead ofvhanquez@gwig.uk.xensource.com2006-07-311-1/+8
| | | | | | | | browsing the list of transaction each time Bump the default to 10, and make it configurable through the command line. Signed-off-by: Vincent Hanquez <vincent@xensource.com>
* [TOOLS] Introduce xc_evtchn_*() interface for interacting with /dev/xen/evtchn.kaf24@firebug.cl.cam.ac.uk2006-06-151-3/+10
| | | | | | | | No longer open the device as non-blocking: all reads immediately follow a select() on the device indicating it's ready to read. Signed-off-by: John Levon <john.levon@sun.com>
* Fix log message written when xenstored corrupts its store.emellor@leeni.uk.xensource.com2006-05-231-1/+6
| | | | | Signed-off-by: Ewan Mellor <ewan@xensource.com>
* dom0 and anonymous connections can create unlimited sized entries in the store.vhanquez@kneesa.uk.xensource.com2006-05-111-1/+1
| | | | | Signed-off-by: Vincent Hanquez <vincent@xensource.com>
* Try to create runtime xenstored's directories at startup time.vhanquez@kneesa.uk.xensource.com2006-05-111-0/+15
| | | | | Signed-off-by: Vincent Hanquez <vincent@xensource.com>
* When building with FORTIFY_SOURCE to ensure that return codes of commonkaf24@firebug.cl.cam.ac.uk2006-04-281-7/+11
| | | | | | | | | functions are checked to avoid some bugs, a few warnings pop up and become errors due to -Werror. Attached checks the return codes (or at least stores them to a dummy variable). Signed-off-by: Jeremy Katz <katzj@redhat.com>
* add quota to xenstored.vhanquez@kneesa.uk.xensource.com2006-04-131-6/+40
| | | | | Signed-off-by: Vincent Hanquez <vincent@xensource.com>
* Further attempts to recover from a corrupt store, this one triggered when aemellor@leeni.uk.xensource.com2006-03-311-0/+1
| | | | | | | tdb_store fails. Signed-off-by: Ewan Mellor <ewan@xensource.com>
* Import the current version of talloc from the Samba 3 source base. This givesemellor@leeni.uk.xensource.com2006-03-231-22/+0
| | | | | | | | | us greater confidence that our talloc implementation is "known good". Remove the OOM handling from consider_message: talloc_set_fail_handler is no longer supported. Signed-off-by: Ewan Mellor <ewan@xensource.com>
* fix buffer overflow in print XS_DEBUG commandvhanquez@kneesa.uk.xensource.com2006-03-151-1/+10
| | | | | Signed-off-by: Vincent Hanquez <vincent@xensource.com>
* move XS_DEBUG code into a proper functionvhanquez@kneesa.uk.xensource.com2006-03-151-15/+20
| | | | | Signed-off-by: Vincent Hanquez <vincent@xensource.com>
* More build config changes:kaf24@firebug.cl.cam.ac.uk2006-03-101-3/+3
| | | | | | | | | | - Build -O2 rather than -O3 - Build with -Wstrict-prototypes - Move target-specific generic compiler switches to Config.mk Signed-off-by: Keir Fraser <keir@xensource.com>