aboutsummaryrefslogtreecommitdiffstats
path: root/tools
Commit message (Collapse)AuthorAgeFilesLines
* libxl: make libxl__poller_put tolerate p==NULLIan Jackson2013-10-112-4/+4
| | | | | | | | | | | | This is less fragile, and more in keeping with the usual style of initialising everything to 0 and freeing things unconditionally. Correspondingly, remove the tests at the call sites. Apropos of c1f3f174. No overall functional change. Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: fix out-of-memory error handling in libxl_list_cpupoolMatthew Daley2013-10-101-0/+1
| | | | | | | | | | | | ...otherwise it will return freed memory. All the current users of this function check already for a NULL return, so use that. Coverity-ID: 1056194 This is CVE-2013-4371 / XSA-70 Signed-off-by: Matthew Daley <mattjd@gmail.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* tools/ocaml: fix erroneous free of cpumap in stub_xc_vcpu_getaffinityMatthew Daley2013-10-101-2/+0
| | | | | | | | | | | Not sure how it got there... Coverity-ID: 1056196 This is CVE-2013-4370 / XSA-69 Signed-off-by: Matthew Daley <mattjd@gmail.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: fix vif rate parsingIan Jackson2013-10-102-6/+17
| | | | | | | | | | | | | | | strtok can return NULL here. We don't need to use strtok anyway, so just use a simple strchr method. Coverity-ID: 1055642 This is CVE-2013-4369 / XSA-68 Signed-off-by: Matthew Daley <mattjd@gmail.com> Fix type. Add test case Signed-off-by: Ian Campbell <Ian.campbell@citrix.com>
* libxl: introduce libxl_node_to_cpumapDario Faggioli2013-10-102-0/+25
| | | | | | | | As an helper for the special case (of libxl_nodemap_to_cpumap) when one wants the cpumap for just one node. Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
* xl: fix a typo in main_vcpulist()Dario Faggioli2013-10-101-1/+1
| | | | | | | which was preventing `xl vcpu-list -h' to work. Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* tools/migrate: Fix regression when migrating from older version of XenAndrew Cooper2013-10-1012-16/+67
| | | | | | | | | | | | | | | | | | | | | | | | | Commit 00a4b65f8534c9e6521eab2e6ce796ae36037774 Sep 7 2010 "libxc: provide notification of final checkpoint to restore end" broke migration from any version of Xen using tools from prior to that commit Older tools have no idea about an XC_SAVE_ID_LAST_CHECKPOINT, causing newer tools xc_domain_restore() to start reading the qemu save record, as ctx->last_checkpoint is 0. The failure looks like: xc: error: Max batch size exceeded (1970103633). Giving up. where 1970103633 = 0x756d6551 = *(uint32_t*)"Qemu" With this fix in place, the behaviour for normal migrations is reverted to how it was before the regression; the migration is considered non-checkpointed right from the start. A XC_SAVE_ID_LAST_CHECKPOINT chunk seen in the migration stream is a nop. For checkpointed migrations the behaviour is unchanged. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Campbell <Ian.Campbell@citrix.com> CC: Ian Jackson <Ian.Jackson@eu.citrix.com> Acked-by: Shriram Rajagopalan <rshriram@cs.ubc.ca> (Remus bits)
* tools: adds tracer on qemu-xen debug configure optionsFabio Fantoni2013-10-101-1/+1
| | | | | | | | | When building tools in debug mode (debug=y), pass also --enable-trace-backend=stderr when configuring qemu-xen. Useful to improve debug. Signed-off-by: Fabio Fantoni <fabio.fantoni@m2r.biz> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
* qemu-xen: Set localstatedir to /var.Anthony PERARD2013-10-101-0/+1
| | | | | | | | | This path is used by the QEMU build system to create the /run directory. If local-state-dir is not set, the result become $prefix/var which is not an acceptable path. Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* qemu-xen: Disabling build of guest-agent.Anthony PERARD2013-10-101-0/+1
| | | | | | | It is not use when QEMU is run with Xen. Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* libxc: add LZ4 decompression supportJan Beulich2013-10-074-1/+157
| | | | | | | | | | | Since there's no shared or static library to link against, this simply re-uses the hypervisor side code. However, I only audited the code added here for possible security issues, not the referenced code in the hypervisor tree. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: correctly handle libxl_get_cpu_topology failure in libxl_{cpu, ↵Matthew Daley2013-10-031-2/+2
| | | | | | | | | | | | | node}map_to_{node, cpu}map Initialize nr_cpus to 0 so that if it is unchanged by a failing libxl_get_cpu_topology, libxl_cputopology_list_free still works OK afterward. Coverity-ID: 1055294 Coverity-ID: 1055295 Signed-off-by: Matthew Daley <mattjd@gmail.com> Acked-by: Dario Faggioli <dario.faggioli@citrix.com>
* libxl: only put poller if already gotten in libxl_event_waitMatthew Daley2013-10-031-1/+2
| | | | | | Coverity-ID: 1055292 Signed-off-by: Matthew Daley <mattjd@gmail.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* libxc: only munmap when something has actually been mapped in change_pteMatthew Daley2013-10-031-3/+3
| | | | | | Coverity-ID: 1055269 signed-off-by: Matthew Daley <mattjd@gmail.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* xm-test: fix the ip allocation functionZhu Yanhai2013-10-031-1/+2
| | | | | | | | | __findFirstOctetIP() is expecting min and max available octets according to its code, however the caller getFreeIP() gives it the min octet and (max - min + 1), which is the length instead. Signed-off-by: Zhu Yanhai <gaoyang.zyh@taobao.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* xl: fork before execing vncviewerIan Campbell2013-10-032-2/+33
| | | | | | | | | Otherwise we don't daemonize to monitor the domain. Heavily cargo-culted from autoconnect-console and only compile tested. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Tested-by: Olaf Hering <olaf@aepfle.de>
* libxl: handle null lists in libxl_string_list_lengthMatthew Daley2013-10-031-2/+5
| | | | | | | | | | | | | After commit b0be2b12 ("libxl: fix libxl_string_list_length and its only caller") libxl_string_list_length no longer handles null (empty) lists. Fix so they are handled, returning length 0. While at it, remove the unneccessary undereferenced null pointer check and tidy the layout of the function. Reported-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> Signed-off-by: Matthew Daley <mattjd@gmail.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* hvmloader/smbios: Change strncpy to memcpy for anchor stringsAndrew Cooper2013-09-271-4/+4
| | | | | | | | | | | | | | | Coverity complains about the use of strncpy() to completely fill the anchor strings, resulting in an unterminated string. Although the strncpy result is correct, the anchor strings are not strings in the C sense, and use of memcpy is the prevaling style elsewhere in hvmloader anyway. While tidying up the style in this function, also remove some trailing whitespace and gratuitous cast. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Keir Fraser <keir@xen.org>
* xm-test: add a missing %sZhu Yanhai2013-09-251-1/+1
| | | | | | | Obviously we need a %s here. Signed-off-by: Zhu Yanhai <gaoyang.zyh@taobao.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* xenstore: check socket path length before copying itMatthew Daley2013-09-251-0/+4
| | | | | | Coverity-ID: 1055997 Signed-off-by: Matthew Daley <mattjd@gmail.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* xenstored: fix faulty check for bad handle in domain_initMatthew Daley2013-09-251-1/+1
| | | | | | | Coverity-ID: 1054975 Coverity-ID: 1055196 Signed-off-by: Matthew Daley <mattjd@gmail.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* 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>
* libxl: fix file open failure check in libxl__file_reference_mapMatthew Daley2013-09-251-1/+1
| | | | | | Coverity-ID: 1055567 Signed-off-by: Matthew Daley <mattjd@gmail.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: fix typo in libxl__hotplug_nic error checkingMatthew Daley2013-09-251-1/+1
| | | | | | Coverity-ID: 1055945 Signed-off-by: Matthew Daley <mattjd@gmail.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: only free console reader if it was allocated in main_dmesgMatthew Daley2013-09-251-1/+2
| | | | | | Coverity-ID: 1055304 Signed-off-by: Matthew Daley <mattjd@gmail.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: fix out-of-memory check in parse_global_configMatthew Daley2013-09-251-2/+2
| | | | | | Coverity-ID: 1055174 Signed-off-by: Matthew Daley <mattjd@gmail.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: fix leak of rune in main_remusMatthew Daley2013-09-251-0/+3
| | | | | | Coverity-ID: 1087194 Signed-off-by: Matthew Daley <mattjd@gmail.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: fix leak of config_data in main_cpupoolcreateMatthew Daley2013-09-251-0/+1
| | | | | | Coverity-ID: 1087193 Signed-off-by: Matthew Daley <mattjd@gmail.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: fix leak of corename in handle_domain_deathMatthew Daley2013-09-251-0/+1
| | | | | | Coverity-ID: 1087192 Signed-off-by: Matthew Daley <mattjd@gmail.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: fix dispose without init of disk in cd_insertMatthew Daley2013-09-251-4/+2
| | | | | | Coverity-ID: 1056078 Signed-off-by: Matthew Daley <mattjd@gmail.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: fix libxl_string_list_length and its only callerMatthew Daley2013-09-252-2/+2
| | | | | | | | | | | | | | | | The wrong amount of indirections were being taken in libxl_string_list_length, and its only caller was miscounting the amount of initial non-list arguments, seemingly since the initial commit (599c784). This has been seen and reported in the wild (##xen): < Trixboxer> Hi, any idea why would I get < Trixboxer> xl: libxl_bootloader.c:42: bootloader_arg: Assertion `bl->nargs < bl->argsspace' failed. < Trixboxer> 4.2.2-23.el6 Coverity-ID: 1054954 Signed-off-by: Matthew Daley <mattjd@gmail.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* libxc: fix memory leak in load_p2m_frame_list error handlingMatthew Daley2013-09-251-0/+1
| | | | | | Coverity-ID: 1055885 Signed-off-by: Matthew Daley <mattjd@gmail.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* gdbsx: clear sockaddr before using itMatthew Daley2013-09-211-0/+1
| | | | | | | | ...so that sin_zero is actually zero. Coverity-ID: 1056070 Signed-off-by: Matthew Daley <mattjd@gmail.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* x86_emulate: fix flag setting for 8-bit signed multiplicationJan Beulich2013-09-201-0/+2
| | | | | | | | | | | | | | | We really need to check for a signed overflow of 8 bits, while the previous check compared the sign-extended 8-bit result with the zero-extended 16-bit one (which was wrong for all negative results). Once at it - also adjust the 16-bit comparison for symmetry - improve the 8-bit multiplication (no need to zero-extend to 32-bits the sign-extended to 16 bits original 8-bit value) - fold both signed multiplication variants Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* x86_emulate: MOVSXD must read source operand just onceJan Beulich2013-09-201-4/+62
| | | | | | | | | | | | ... for the case of accessing MMIO. Also streamline the ARPL emulation a little, and add tests for both instructions (the MOVSXD one requires a few other adjustments, as we now need to run in a mode where the emulator's mode_64bit() returns true). Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* x86: fix dependencies of emulator testJan Beulich2013-09-201-6/+5
| | | | | | | | | | | | Rather than mentioning the (linked) directory, mention the files thus making sure things get rebuild as needed when the core emulator files change. Also enable debug info generation unconditionally, as this is testing stuff only anyway. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* tools: print xm deprecation warning to stderrIan Campbell2013-09-191-2/+2
| | | | | | To avoid confusing anything which is parsing the output. Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
* tools: disable xend build by defaultIan Campbell2013-09-174-4/+57
| | | | | | | | | | Add big warnings to configure, xend initscript and xm. The big xm warning is displayed once (per boot, or per tmpreaper clean), afterwards a single line warning is displayed. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
* tools/hotplug: set mtu from bridge for tap interfaceCharles Arnold2013-09-172-5/+12
| | | | | | | | | | | | | With changeset 22885 support was added for setting the MTU in the vif-bridge script for when a vif interface was set to 'online'. The was not done for the 'add' operation. The 'add' operation was added to the script for when tap devices were specified (c/s 21944). With the setting of the MTU for the 'online' case was there a reason for omitting the 'add'? This patch sets the MTU for both 'online' and 'add' in the vif-bridge script. Signed-off-by: Charles Arnold <carnold@suse.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: Use LOG_ERRNO rather than ERRNOVAL in libxl_pci.cGeorge Dunlap2013-09-161-10/+10
| | | | | | | | The xc_* functions (now) return -1 on error and set errno. Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com> CC: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
* Revert "libxl, hotplug/Linux: default to phy backend for raw format file"Ian Campbell2013-09-162-12/+10
| | | | | This reverts commit 11a63a1660453269ddd1893c15d0a98133b33ca7. The change causes issues with live migration.
* xen-mfndump: Use inttypes.h to format uint64_t types.Ian Campbell2013-09-141-2/+3
| | | | | | | | | | | | Fixes 32-bit build: cc1: warnings being treated as errors xen-mfndump.c: In function 'dump_ptes_func': xen-mfndump.c:236: error: format '%lx' expects type 'long unsigned int', but argument 3 has type 'uint64_t' xen-mfndump.c: In function 'lookup_pte_func': xen-mfndump.c:305: error: format '%lx' expects type 'long unsigned int', but argument 5 has type 'uint64_t' Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: Spice vdagent support for upstream qemuFabio Fantoni2013-09-135-0/+30
| | | | | | | | | | | | | | | | | | Usage: - spicevdagent=1|0 (default=0) Enables spice vdagent. The Spice vdagent is an optional component for enhancing user experience and performing guest-oriented management tasks. Its features includes: client mouse mode (no need to grab mouse by client, no mouse lag), automatic adjustment of screen resolution, copy and paste (text and image) between client and domU. It also requires vdagent service installed on domU o.s. to work. - spice_clipboard_sharing=1|0 (default=0) Enables Spice clipboard sharing (copy/paste). It requires spicevdagent enabled. Signed-off-by: Fabio Fantoni <fabio.fantoni@m2r.biz> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* xenstored: fix possible, but unlikely, stack overflowMatthew Daley2013-09-131-1/+1
| | | | | | | | | ...when reading xenbus port from xenfs. Coverity-ID: 1055741 Signed-off-by: Matthew Daley <mattjd@gmail.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
* kdd: fix free of array-typed valueMatthew Daley2013-09-131-1/+0
| | | | | | | | | | g->id is an array and is allocated as part of g itself; it's not a separate allocation. Coverity-ID: 1054980 Signed-off-by: Matthew Daley <mattjd@gmail.com> Acked-by: Tim Deegan <tim@xen.org> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
* libxl: correctly handle readlink() errorsMatthew Daley2013-09-131-1/+1
| | | | | | | | readlink() returns a ssize_t with a negative value on failure. Coverity-ID: 1055566 Signed-off-by: Matthew Daley <mattjd@gmail.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxl: fix use-after-free in discard_events iterationMatthew Daley2013-09-131-2/+2
| | | | | | | | | We need to use the foreach variant which gets the next pointer before the loop body is executed. Coverity-ID: 1056193 Signed-off-by: Matthew Daley <mattjd@gmail.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxl: fix libxl__device_disk_from_xs_be to parse backend domidRoger Pau Monne2013-09-131-0/+7
| | | | | | | | | | | | | | libxl__device_disk_from_xs_be was ignoring the backend domid, setting it to 0 by default. Fix this by parsing the backend disk path in order to fetch the backend domid. This fixes the issue reported when trying to block-detach disks that have it's backend on a driver domain. Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Reported-by: G.R. <firemeteor@users.sourceforge.net> Cc: Ian Jackson <Ian.Jackson@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* xenstat: Fix buffer over-run with new_domains being negative.Konrad Rzeszutek Wilk2013-09-131-5/+9
| | | | | | | | | | | | | Coverity identified this as: CID 1055740 Out-of-bounds read - "In xenstat_get_node: Out-of-bounds read from a buffer (CWE-125)" And sure enough, if xc_domain_getinfolist returns us -1, we will try to use it later on in the for (i = 0; i < new_domains; ..) loop. Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
* tools/misc: introduce xen-mfndump.Dario Faggioli2013-09-132-2/+430
| | | | | | | | | | | | | | | | | | | | | | A little development and debugging tool, useful when looking for information about MFN to PFN mappings, MFN/PFN mappings in a guest's PTEs, etc. This is what it can do as of now: $ /usr/sbin/xen-mfndump Usage: xen-mfndump <command> [args] Commands: help show this help dump-m2p show M2P dump-p2m <domid> show P2M of <domid> dump-ptes <domid> <mfn> show the PTEs in <mfn> lookup-pte <domid> <mfn> find the PTE mapping <mfn> memcmp-mfns <domid1> <mfn1> <domid2> <mfn2> (str)compare content of <mfn1> & <mfn2> Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>