85 Commits
Author SHA1 Message Date
Matthew Daley 9b6b1b815c xen/arm: correct duplicate MPIDR check to actually skip the node
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
2013-11-19 14:39:12 +00:00
Matthew Daley bd222b3fd4 xl: remove pointless null pointer check
poolinfo is guaranteed non-null here.

Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-11-11 16:13:57 +00:00
Matthew Daley 570e223242 libxc: remove pointless null pointer check
ctxt_buf is guaranteed non-null here.

Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-11-11 16:13:54 +00:00
Matthew Daley d621f95d6a xen/video: remove pointless if subcondition
It's already handled just above.

Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-11-11 16:13:52 +00:00
Matthew Daley 49e547756e xen/arm: remove pointless if subcondition
It's already handled just above.

Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-11-11 16:13:40 +00:00
Matthew Daley 9dc145a582 libxl: correct strtod error check
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-11-11 16:10:26 +00:00
Matthew Daley 5c42fd7f91 mini-os: remove repeated statement in netfront_input
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2013-11-08 11:10:08 +01:00
Matthew Daley c4e2dfccdd nestedsvm: remove pointless BUG_ON
It's already handled just above.

Signed-off-by: Matthew Daley <mattjd@gmail.com>
2013-11-08 11:09:37 +01:00
Matthew Daley 098ef0c4d4 libvchan: tidy up usages of fcntl in select-type sample application
Namely, don't overwrite all the other flags when twiddling O_NONBLOCK,
and add basic error handling.

Coverity-ID: 1055041
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Reviewed-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
2013-11-04 17:13:38 +00:00
Matthew Daley b714ae02a8 libxl: check for xc_domain_shutdown failure in libxl__domain_suspend_common_callback
Coverity-ID: 1055048
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-11-01 13:14:19 +00:00
Matthew Daley 2bb02b31fc libxl: check for xc_domain_max_vcpus failure in libxl__build_pre
Coverity-ID: 1055047
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-11-01 13:13:40 +00:00
Matthew Daley 577ec96e7d libxc: check for xc_vcpu_setcontext failure in xc_domain_resume_any
Coverity-ID: 1090352
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-11-01 13:12:50 +00:00
Matthew Daley bbf891bcd1 libxc: don't read uninitialized size value in xc_read_image
This error case can only be triggered by gzread returning 0 (and having
not read anything), so move it there.

Coverity-ID: 1056076
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-10-31 22:13:52 +00:00
Matthew Daley 96be5eab5d xentrace: undeadify invalid option argument handling
Apparently it's always been like this.

Coverity-ID: 1056153
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Reviewed-by: George Dunlap <george.dunlap@eu.citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-10-31 21:55:53 +00:00
Matthew Daley 7343db9a77 xentrace: don't try to close null libxc handle in disable_tbufs
While at it, simplify the function.

Coverity-ID: 1055316
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Reviewed-by: George Dunlap <george.dunlap@eu.citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-10-31 21:55:53 +00:00
Matthew Daley 1924ed33ac xenctx: correct error check when opening libxc
Coverity-ID: 1054979
Coverity-ID: 1055238
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Reviewed-by: George Dunlap <george.dunlap@eu.citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-10-31 21:55:53 +00:00
Matthew Daley 33d3716dc0 xenctx: only alloc symbol if we are inserting it into the symbol table
...otherwise it's pointless, and will leak.

Coverity-ID: 1055936
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-10-31 21:55:53 +00:00
Matthew Daley f2f06a2f1b libvchan: handle libxc evtchn failures properly in init functions
The reasoning behind this patch is that ctrl->event_port is a uint32_t
(ie. unsigned), so the current checks on it for negative error results,
non-negative port presence etc. are incorrect.

Fix by using evtchn_port_or_error_t in the init functions instead,
adjusting the error handling, and removing the now-unnecessary check
from the close function.

Coverity-ID: 1055609
Coverity-ID: 1055610
Coverity-ID: 1055611
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Reviewed-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-10-31 21:55:53 +00:00
Matthew Daley 93700cb6b4 docs: make xl vm-list example use verbatim formatting
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-10-31 21:55:53 +00:00
Matthew Daley 9d801e25c9 xl: correct references to long-removed function in error messages
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-10-31 21:55:52 +00:00
Matthew Daley 50b9bdf83b xl: remove needless infinite-loop construct in create_domain
Use a simple if condition instead.

Coverity-ID: 1056150
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-10-31 21:55:52 +00:00
Matthew Daley 77d8f86372 xl: check for restore file open failure in create_domain
...otherwise you get a less helpful error message.

Coverity-ID: 1055569
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-10-31 21:55:52 +00:00
Matthew Daley 235f16a15d xl: libxl_list_vm returns a pointer, not a handle
Coverity-ID: 1054978
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-10-31 21:55:52 +00:00
Matthew Daley 2ffc14ea22 libxl: only close fds which successfully opened in libxl__spawn_local_dm
Coverity-ID: 1055565
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-10-31 21:55:52 +00:00
Matthew Daley 1edd6d8da3 libxl: don't leak memory in libxl__poller_get failure case
Coverity-ID: 1055894
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-10-31 21:55:52 +00:00
Matthew Daley 4b62556b57 libxl: correct file open success check in libxl__device_pci_reset
It could, even if only in theory, be fd 0.

Coverity-ID: 1055895
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-10-31 21:55:51 +00:00
Matthew Daley 5bc3a84608 libxl: check for transaction abortion failure in libxl_set_memory_target
While at it, correct the error handling of libxl__fill_dom0_memory_info;
at that point there is no transaction to end in any manner.

Coverity-ID: 1055046
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-10-31 21:55:51 +00:00
Matthew Daley d6dea2f6ab libxc: remove null pointer checks in xc_pm_get_{c, p}xstat
We don't check for null pointers in similar functions, and it's silly to
do so for these arguments here anyway; they should fail noisily if null
is passed.

While at it, remove pointless brackets.

Coverity-ID: 1055938
Coverity-ID: 1055939
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-10-31 21:55:51 +00:00
Matthew Daley 492da27a3e libxc: initalize stdio loggers' progress_last_percent values to 0
...otherwise they are undefined in the first progress callback.

Coverity-ID: 1056055
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-10-31 21:55:51 +00:00
Matthew Daley e1fde2acce libxc: check for xc_domain_get_guest_width failure in xc_domain_resume_any
Coverity-ID: 1090351
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-10-31 21:30:28 +00:00
Matthew Daley 6b0283689a libxc: remove pointless null pointer check in xc_interface_open_common
xch is guaranteed non-null here.

Coverity-ID: 1055944
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-10-31 21:30:23 +00:00
Matthew Daley fcaacad1a4 libxc: tidy up loop construct in write_compressed
...otherwise the return 0 at the bottom is dead code.

Coverity-ID: 1055189
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-10-31 21:23:49 +00:00
Matthew Daley f46fa80ec4 libxc: don't ignore fd read failures when restoring a domain
Coverity-ID: 1055042
Coverity-ID: 1055043
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-10-31 21:23:46 +00:00
Matthew Daley 9fae04ff00 libxc: fix memory leak in move_l3_below_4G error handling
...otherwise mmu gets leaked.

Coverity-ID: 1055844
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-10-31 21:23:38 +00:00
Matthew Daley e9fa4c8636 libxc: fix retrieval of and remove pointless check on gzip size
Coverity-ID: 1055587
Coverity-ID: 1055963
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-10-31 21:13:47 +00:00
Matthew Daley 02ebea7768 xencommons: write domain 0's domid to xenstore
libvchan's init_xs_srv (server-side xenstore-related initialization)
expects to find the current domain's domid at this xenstore key. libxl
(and xend) write this for domains they create. Do the same for domain 0,
allowing the use of libvchan in dom0.

Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-10-31 20:59:34 +00:00
Matthew Daley c07134ccca tools: remove unnecessary null pointer checks before frees
Patch generated by the following semantic patch
(http://coccinelle.lip6.fr/):

@@
expression *P;
@@

- if(P) free(P);
+ free(P);

...and then by filtering through the following command:

filterdiff -p1 -x 'stubdom/*' -x 'tools/firmware/*' -x 'tools/qemu-*' -x 'tools/blktap*'

Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-10-31 20:04:25 +00:00
Matthew Daley 2cd1f418fe xl: don't emit misleading daemon pid message
After creating a domain, xl forks off a process to handle domain events
(shutdown, disk eject, ...). It prints out the pid of the process
created by the fork to stdout. However, the newly forked process soon
after calls daemon(), which itself forks once more (and exit()s the
original process). This means that the pid printed out is not the pid of
the actual process which remains in the background after all is said and
done, instead it is the pid of the transient process that exists between
xl's fork() and the fork'd process's daemon() call.

We could resolve this by printing the correct pid, ie. by open-coding
daemon() (we already do most of the heavy lifting it does ourselves by
fiddling with the standard fds). However, since no-one seems to be
complaining about the misleading message to begin with, and since it
seems like a pointless message anyway, just remove it outright instead.

Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
2013-10-28 15:54:45 +00:00
Matthew Daley 4c37ed5622 libxl: fix out-of-memory error handling in libxl_list_cpupool
...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>
2013-10-10 15:49:54 +01:00
Matthew Daley 3cd10fd212 tools/ocaml: fix erroneous free of cpumap in stub_xc_vcpu_getaffinity
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>
2013-10-10 15:49:40 +01:00
Matthew Daley 0771faba16 x86: check segment descriptor read result in 64-bit OUTS emulation
When emulating such an operation from a 64-bit context (CS has long
mode set), and the data segment is overridden to FS/GS, the result of
reading the overridden segment's descriptor (read_descriptor) is not
checked. If it fails, data_base is left uninitialized.

This can lead to 8 bytes of Xen's stack being leaked to the guest
(implicitly, i.e. via the address given in a #PF).

Coverity-ID: 1055116

This is CVE-2013-4368 / XSA-67.

Signed-off-by: Matthew Daley <mattjd@gmail.com>

Fix formatting.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
2013-10-10 15:19:53 +02:00
Matthew Daley 1e143e2ae8 libxl: correctly handle libxl_get_cpu_topology failure in libxl_{cpu, 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>
2013-10-03 14:45:54 +01:00
Matthew Daley c1f3f1748d libxl: only put poller if already gotten in libxl_event_wait
Coverity-ID: 1055292
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-10-03 14:07:30 +01:00
Matthew Daley c827d7f39f libxc: only munmap when something has actually been mapped in change_pte
Coverity-ID: 1055269
signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-10-03 14:06:43 +01:00
Matthew Daley a7fa7a4fd6 libxl: handle null lists in libxl_string_list_length
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>
2013-10-03 13:37:17 +01:00
Matthew Daley f220279c14 xenstore: check socket path length before copying it
Coverity-ID: 1055997
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-09-25 13:23:12 +01:00
Matthew Daley 07fa854a43 xenstored: fix faulty check for bad handle in domain_init
Coverity-ID: 1054975
Coverity-ID: 1055196
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-09-25 13:23:12 +01:00
Matthew Daley b865bda00f xenstored: handle unlikely failure better in ask_parents
Coverity-ID: 1055277
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-09-25 13:23:12 +01:00
Matthew Daley 1a0f10a8c8 libxl: fix file open failure check in libxl__file_reference_map
Coverity-ID: 1055567
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-09-25 12:56:08 +01:00
Matthew Daley 6b2b15ead2 libxl: fix typo in libxl__hotplug_nic error checking
Coverity-ID: 1055945
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-09-25 12:56:05 +01:00
Matthew Daley 2e979531e5 libxl: only free console reader if it was allocated in main_dmesg
Coverity-ID: 1055304
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-09-25 12:56:00 +01:00
Matthew Daley 96c0061c01 libxl: fix out-of-memory check in parse_global_config
Coverity-ID: 1055174
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-09-25 12:49:15 +01:00
Matthew Daley 2989ef9042 libxl: fix leak of rune in main_remus
Coverity-ID: 1087194
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-09-25 12:49:12 +01:00
Matthew Daley 7737ecb20c libxl: fix leak of config_data in main_cpupoolcreate
Coverity-ID: 1087193
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-09-25 12:49:01 +01:00
Matthew Daley 12eaa1b4d2 libxl: fix leak of corename in handle_domain_death
Coverity-ID: 1087192
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-09-25 12:45:39 +01:00
Matthew Daley 736491d155 libxl: fix dispose without init of disk in cd_insert
Coverity-ID: 1056078
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-09-25 12:44:24 +01:00
Matthew Daley b0be2b126e libxl: fix libxl_string_list_length and its only caller
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>
2013-09-25 12:42:02 +01:00
Matthew Daley 3b8782d95d libxc: fix memory leak in load_p2m_frame_list error handling
Coverity-ID: 1055885
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-09-25 12:35:24 +01:00
Matthew Daley 6c1bfef445 gdbsx: clear sockaddr before using it
...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>
2013-09-21 16:43:13 +01:00
Matthew Daley 6ea4840923 mini-os: fix various memory leaks in various locations
Coverity-ID: 1055827
Coverity-ID: 1055828
Coverity-ID: 1055829
Coverity-ID: 1055830
Coverity-ID: 1055831
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2013-09-21 16:43:04 +01:00
Matthew Daley c2849d8fab mini-os: fix various memory leaks in consfront
Coverity-ID: 1055816
Coverity-ID: 1055817
Coverity-ID: 1055818
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2013-09-21 16:42:42 +01:00
Matthew Daley a384c17325 mini-os: fix various memory leaks in pcifront
Coverity-ID: 1055834-1055840
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2013-09-21 16:42:31 +01:00
Matthew Daley 927c43c82b mini-os: fix various memory leaks in netfront
Coverity-ID: 1055832
Coverity-ID: 1055833
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2013-09-21 16:42:20 +01:00
Matthew Daley 00f502ebfe mini-os: fix various memory leaks in {fb, kbd}front
Coverity-ID: 1055819-1055826
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2013-09-21 16:42:07 +01:00
Matthew Daley 74ca2b1375 mini-os: fix various memory leaks in blkfront
Coverity-ID: 1055814
Coverity-ID: 1055815
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2013-09-21 16:41:55 +01:00
Matthew Daley 3e7da90205 mini-os: fix nodename generation in init_netfront
Using strlen here makes no sense.

Coverity-ID: 1056053
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2013-09-21 16:41:42 +01:00
Matthew Daley 5ae3285f24 gnttab: remove unused shared header lookup
Coverity-ID: 1056171

Signed-off-by: Matthew Daley <mattjd@gmail.com>
Reviewed-by: Tim Deegan <tim@xen.org>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
2013-09-20 11:40:00 +02:00
Matthew Daley ba033a204b xenstored: fix possible, but unlikely, stack overflow
...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>
2013-09-13 13:15:30 +01:00
Matthew Daley da89e7ef29 kdd: fix free of array-typed value
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>
2013-09-13 13:15:09 +01:00
Matthew Daley 6425b20c0f mini-os: handle possibly overlong _nodename in init_consfront
The only current user that passes a non-NULL _nodename limits it to 64
bytes anyway.

Coverity-ID: 1054993
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2013-09-13 13:15:02 +01:00
Matthew Daley 72b9c3e88c mini-os: fix use-after-free in xs_daemon_close event iteration
We need to get the next pointer before the freeing of the event.

Coverity-ID: 1056173
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-By: Samuel Thibault <samuel.thibault@ens-lyon.org>
2013-09-13 13:14:51 +01:00
Matthew Daley ad6aa096e4 libxl: correctly handle readlink() errors
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>
2013-09-13 13:14:41 +01:00
Matthew Daley ceb556178d libxl: fix use-after-free in discard_events iteration
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>
2013-09-13 13:14:37 +01:00
Matthew Daley 546ba2f170 sched/arinc653: check for guest data transfer failures
Coverity-ID: 1055121
Coverity-ID: 1055122
Coverity-ID: 1055123
Coverity-ID: 1055124
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
2013-09-10 17:16:02 +02:00
Matthew Daley 26d8a37c59 x86: add missing va_end to hypercall_xlat_continuation
Coverity-ID: 1056208
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
2013-09-10 17:15:35 +02:00
Matthew Daley 8e4610ec55 tools: build debug qemu-xen in debug tools builds
When building tools in debug mode (debug=y), pass --enable-debug when
configuring qemu-xen to enable some debug support (namely, to prevent
symbols from being stripped).

Signed-off-by: Matthew Daley <mattjd@gmail.com>
2013-09-09 14:41:49 +01:00
Matthew Daley 0cf2554189 libxc: silence HVM domain creation messages
There's no need for xl to output these messages on HVM domain creation
to stderr by default.

Change their loglevels from XTL_INFO to XTL_DETAIL; then the messages
output by xl are the same as those for PV domain creation. These
now-silenced messages can still be seen using verbose (-v) mode.

Signed-off-by: Matthew Daley <mattjd@gmail.com>
2013-08-20 15:23:13 +01:00
Matthew Daley ec7e270db8 gnttab: remove unused MAPTRACK_MAX_ENTRIES define
The maximum number of grant mappings is given by
max_nr_maptrack_frames() as of commit 5ce8faf, not this unused define.

Signed-off-by: Matthew Daley <mattjd@gmail.com>
2013-07-02 08:44:41 +02:00
Matthew Daley 966070058d libxc: check blob size before proceeding in xc_dom_check_gzip
This is part of the fix to a security issue, XSA-55.

Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

v8: Add a comment explaining where the number 6 comes from.

v6: This patch is new in v6 of the series.
2013-06-14 16:39:38 +01:00
Matthew Daley 9581c4f9a5 fix domain unlocking in some xsm error paths
A couple of xsm error/access-denied code paths in hypercalls neglect to
unlock a previously locked domain. Fix by ensuring the domains are
unlocked correctly.

Signed-off-by: Matthew Daley <mattjd@gmail.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
2013-03-06 17:10:26 +01:00
Matthew Daley f0fc1e8294 x86/mm: fix invalid unlinking of nested p2m tables
Commit 90805dc (c/s 26387:4056e5a3d815) ("EPT: Make ept data stucture or
operations neutral") makes nested p2m tables be unlinked from the host
p2m table before their destruction (in p2m_teardown_nestedp2m).
However, by this time the host p2m table has already been torn down,
leading to a possible race condition where another allocation between
the two kinds of table being torn down can lead to a linked list
assertion with debug=y builds or memory corruption on debug=n ones.

Fix by swapping the order the two kinds of table are torn down in. While
at it, remove the condition in p2m_final_teardown, as it is already
checked identically in p2m_teardown_hostp2m itself.

Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Tim Deegan <tim@xen.org>
2013-02-28 10:56:32 +00:00
Matthew Daley 3c6881d8d0 fix xenctl_cpumap_to_cpumask() buffer size check
xenctl_cpumap_to_cpumask incorrectly uses sizeof when checking whether
bits should be masked off from the input cpumap bitmap or not.

Fix by using the correct cpumask buffer size in place of sizeof.

Signed-off-by: Matthew Daley <mattjd@gmail.com>

Compare against copy_bytes instead, and use equality rather than less-
or-equal.

Further, this issue (introduced with c/s 23991:a7ccbc79fc17) is not
security relevant (i.e. the bug could not cause memory corruption):
_xmalloc() never returns chunks of data smaller than the size of a
pointer, i.e. even if sizeof(void*) > guest_bytes > copy_bytes, the
piece of memory erroneously written to would still be inside the
allocation done at the top of the function.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Jan Beulich <jbeulich@suse.com>
2012-11-13 11:28:10 +01:00
Matthew Daley 0c6601ee18 pygrub: Fix command line argument error handling
pygrub's individual config file parsers do not correctly check the
amount of command line arguments given to them. In addition, the LILO
config parser would report an incorrect message.

Use len() to correctly check the amount of arguments, and fix the LILO
error message.

Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
2012-11-12 17:03:21 +00:00
Matthew Daley 70973953ab x86/mm x86 shadow: Fix typo in sh_invlpg sl3 page presence check
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
2012-11-12 10:17:00 +00:00
Matthew Daley b85a0ab122 tmem: Prevent NULL dereference on error case
If the client / pool IDs given to tmemc_save_get_next_page are invalid,
the calculation of pagesize will dereference NULL.

Fix this by moving the calculation below the appropriate NULL check.

Signed-off-by: Matthew Daley <mattjd@gmail.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
2012-11-12 09:34:57 +01:00