diff options
author | Alex Williamson <alex.williamson@hp.com> | 2007-12-14 10:12:40 -0700 |
---|---|---|
committer | Alex Williamson <alex.williamson@hp.com> | 2007-12-14 10:12:40 -0700 |
commit | 0cc375e055bd872fde80a4e323bf8dc824613582 (patch) | |
tree | 737247cf6f68beadb221a7802941c18f70382752 /tools | |
parent | 61d203d579deb6c7596f856f4354002936d88acc (diff) | |
parent | 2d3604815210d7b59b78ca630c19ec75bfa51d49 (diff) | |
download | xen-0cc375e055bd872fde80a4e323bf8dc824613582.tar.gz xen-0cc375e055bd872fde80a4e323bf8dc824613582.tar.bz2 xen-0cc375e055bd872fde80a4e323bf8dc824613582.zip |
merge with xen-unstable.hg (staging)
Diffstat (limited to 'tools')
-rw-r--r-- | tools/libfsimage/Rules.mk | 2 | ||||
-rw-r--r-- | tools/libfsimage/common/Makefile | 2 | ||||
-rw-r--r-- | tools/libxc/Makefile | 3 | ||||
-rw-r--r-- | tools/python/Makefile | 2 | ||||
-rw-r--r-- | tools/python/xen/util/xsm/acm/acm.py | 49 | ||||
-rw-r--r-- | tools/python/xen/util/xsm/dummy/dummy.py | 10 | ||||
-rw-r--r-- | tools/xenstore/xenstored_core.c | 5 | ||||
-rw-r--r-- | tools/xenstore/xenstored_watch.c | 4 | ||||
-rw-r--r-- | tools/xenstore/xs.c | 5 | ||||
-rw-r--r-- | tools/xenstore/xsls.c | 2 |
10 files changed, 64 insertions, 20 deletions
diff --git a/tools/libfsimage/Rules.mk b/tools/libfsimage/Rules.mk index 9d49c6373d..ca6380a4a1 100644 --- a/tools/libfsimage/Rules.mk +++ b/tools/libfsimage/Rules.mk @@ -27,6 +27,6 @@ $(FSLIB): $(PIC_OBJS) $(CC) $(CFLAGS) $(LDFLAGS) $(SHLIB_CFLAGS) -o $@ $^ -lfsimage $(FS_LIBDEPS) clean distclean: - rm -f $(PIC_OBJS) $(FSLIB) + rm -f $(PIC_OBJS) $(FSLIB) $(DEPS) -include $(DEPS) diff --git a/tools/libfsimage/common/Makefile b/tools/libfsimage/common/Makefile index 6efce44f02..5c22fa974d 100644 --- a/tools/libfsimage/common/Makefile +++ b/tools/libfsimage/common/Makefile @@ -32,7 +32,7 @@ install: all $(INSTALL_DATA) fsimage_grub.h $(DESTDIR)/usr/include clean distclean: - rm -f $(PIC_OBJS) $(LIB) + rm -f $(PIC_OBJS) $(LIB) $(DEPS) libfsimage.so: libfsimage.so.$(MAJOR) ln -sf $< $@ diff --git a/tools/libxc/Makefile b/tools/libxc/Makefile index 3c9899d152..618b371615 100644 --- a/tools/libxc/Makefile +++ b/tools/libxc/Makefile @@ -125,7 +125,8 @@ TAGS: clean: rm -rf *.rpm $(LIB) *~ $(DEPS) xen \ $(CTRL_LIB_OBJS) $(CTRL_PIC_OBJS) \ - $(GUEST_LIB_OBJS) $(GUEST_PIC_OBJS) + $(GUEST_LIB_OBJS) $(GUEST_PIC_OBJS) \ + $(LIBELF_SRCS) libelf-private.h .PHONY: rpm rpm: build diff --git a/tools/python/Makefile b/tools/python/Makefile index 880a19c9ff..21be26b99b 100644 --- a/tools/python/Makefile +++ b/tools/python/Makefile @@ -104,4 +104,4 @@ test: .PHONY: clean clean: - rm -rf build *.pyc *.pyo *.o *.a *~ $(CATALOGS) xen/util/xsm/xsm.py + rm -rf build *.pyc *.pyo *.o *.a *~ $(CATALOGS) xen/util/xsm/xsm.py xen/util/auxbin.pyc diff --git a/tools/python/xen/util/xsm/acm/acm.py b/tools/python/xen/util/xsm/acm/acm.py index 7973a5b704..8bb0928c6e 100644 --- a/tools/python/xen/util/xsm/acm/acm.py +++ b/tools/python/xen/util/xsm/acm/acm.py @@ -1545,21 +1545,44 @@ def get_security_label(self, xspol=None): label = self.info.get('security_label', label) return label + +__cond = threading.Condition() +__script_runner = None +__orders = [] + def run_resource_label_change_script(resource, label, command): - def __run_resource_label_change_script(label, command): + global __cond, __orders, __script_runner + + def __run_resource_label_change_script(): + global __cond, __orders script = XendOptions.instance().get_resource_label_change_script() if script: - parms = { - 'resource' : resource, - 'label' : label, - 'command' : command, - } - log.info("Running resource label change script %s: %s" % - (script, parms)) - parms.update(os.environ) - os.spawnve(os.P_WAIT, script[0], script, parms) + parms = {} + while True: + __cond.acquire() + if len(__orders) == 0: + __cond.wait() + + parms['label'], \ + parms['command'], \ + parms['resource'] = __orders[0] + + __orders = __orders[1:] + __cond.release() + + log.info("Running resource label change script %s: %s" % + (script, parms)) + parms.update(os.environ) + os.spawnve(os.P_WAIT, script[0], script, parms) else: log.info("No script given for relabeling of resources.") - thread = threading.Thread(target=__run_resource_label_change_script, - args=(label,command)) - thread.start() + if not __script_runner: + __script_runner = \ + threading.Thread(target=__run_resource_label_change_script, + args=()) + __script_runner.start() + + __cond.acquire() + __orders.append((label,command,resource)) + __cond.notify() + __cond.release() diff --git a/tools/python/xen/util/xsm/dummy/dummy.py b/tools/python/xen/util/xsm/dummy/dummy.py index 66fc8c2bd2..b82e1b9ff5 100644 --- a/tools/python/xen/util/xsm/dummy/dummy.py +++ b/tools/python/xen/util/xsm/dummy/dummy.py @@ -33,7 +33,6 @@ xmlrpc_exports = [ def err(msg): """Raise XSM-dummy exception. """ - sys.stderr.write("XSM-dummyError: " + msg + "\n") raise XSMError(msg) def on(): @@ -123,3 +122,12 @@ def get_domain_label(domain): def set_domain_label(): err("Command not supported under xsm 'dummy' module.") + +def dump_policy(): + pass + +def dump_policy_file(): + pass + +def get_ssid(domain): + err("No ssid has been assigned to any domain under xsm dummy module.") diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c index 825d834e37..acf6dd3918 100644 --- a/tools/xenstore/xenstored_core.c +++ b/tools/xenstore/xenstored_core.c @@ -672,6 +672,9 @@ bool is_valid_nodename(const char *node) if (strstr(node, "//")) return false; + if (strlen(node) > XENSTORE_ABS_PATH_MAX) + return false; + return valid_chars(node); } @@ -1281,7 +1284,7 @@ static void handle_input(struct connection *conn) if (in->used != sizeof(in->hdr)) return; - if (in->hdr.msg.len > PATH_MAX) { + if (in->hdr.msg.len > XENSTORE_PAYLOAD_MAX) { syslog(LOG_ERR, "Client tried to feed us %i", in->hdr.msg.len); goto bad_client; diff --git a/tools/xenstore/xenstored_watch.c b/tools/xenstore/xenstored_watch.c index 72927fa9c7..8e3e4f2b61 100644 --- a/tools/xenstore/xenstored_watch.c +++ b/tools/xenstore/xenstored_watch.c @@ -125,6 +125,10 @@ void do_watch(struct connection *conn, struct buffered_data *in) if (strstarts(vec[0], "@")) { relative = false; + if (strlen(vec[0]) > XENSTORE_REL_PATH_MAX) { + send_error(conn, EINVAL); + return; + } /* check if valid event */ } else { relative = !strstarts(vec[0], "/"); diff --git a/tools/xenstore/xs.c b/tools/xenstore/xs.c index faa7e5c80f..a815257798 100644 --- a/tools/xenstore/xs.c +++ b/tools/xenstore/xs.c @@ -319,6 +319,11 @@ static void *xs_talkv(struct xs_handle *h, xs_transaction_t t, for (i = 0; i < num_vecs; i++) msg.len += iovec[i].iov_len; + if (msg.len > XENSTORE_PAYLOAD_MAX) { + errno = E2BIG; + return 0; + } + ignorepipe.sa_handler = SIG_IGN; sigemptyset(&ignorepipe.sa_mask); ignorepipe.sa_flags = 0; diff --git a/tools/xenstore/xsls.c b/tools/xenstore/xsls.c index cd8e3a9dac..337e87cc5b 100644 --- a/tools/xenstore/xsls.c +++ b/tools/xenstore/xsls.c @@ -8,7 +8,7 @@ #include <sys/ioctl.h> #include <termios.h> -#define STRING_MAX PATH_MAX +#define STRING_MAX XENSTORE_ABS_PATH_MAX+1024 static int max_width = 80; static int desired_width = 60; static int show_whole_path = 0; |