aboutsummaryrefslogtreecommitdiff
path: root/qga
AgeCommit message (Collapse)Author
2020-04-29qga: Fix qmp_guest_suspend_{disk, ram}() error handlingMarkus Armbruster
The Error ** argument must be NULL, &error_abort, &error_fatal, or a pointer to a variable containing NULL. Passing an argument of the latter kind twice without clearing it in between is wrong: if the first call sets an error, it no longer points to NULL for the second qmp_guest_suspend_disk() and qmp_guest_suspend_ram() pass @local_err first to check_suspend_mode(), then to acquire_privilege(), then to execute_async(). Continuing after errors here can only end in tears. For instance, we risk tripping error_setv()'s assertion. Fixes: aa59637ea1c6a4c83430933f9c44c43e6c3f1b69 Fixes: f54603b6aa765514b2519e74114a2f417759d727 Cc: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20200422130719.28225-15-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2020-04-29qga: Fix qmp_guest_get_memory_blocks() error handlingMarkus Armbruster
The Error ** argument must be NULL, &error_abort, &error_fatal, or a pointer to a variable containing NULL. Passing an argument of the latter kind twice without clearing it in between is wrong: if the first call sets an error, it no longer points to NULL for the second call. qmp_guest_get_memory_blocks() passes &local_err to transfer_memory_block() in a loop. If this fails in more than one iteration, it can trip error_setv()'s assertion. Fix it to break the loop. Cc: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20200422130719.28225-14-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2020-04-15qga: Restrict guest-file-read count to 48 MB to avoid crashesPhilippe Mathieu-Daudé
On [*] Daniel Berrangé commented: The QEMU guest agent protocol is not sensible way to access huge files inside the guest. It requires the inefficient process of reading the entire data into memory than duplicating it again in base64 format, and then copying it again in the JSON serializer / monitor code. For arbitrary general purpose file access, especially for large files, use a real file transfer program or use a network block device, not the QEMU guest agent. To avoid bug reports as BZ#1594054 (CVE-2018-12617), follow his suggestion to put a low, hard limit on "count" in the guest agent QAPI schema, and don't allow count to be larger than 48 MB. [*] https://www.mail-archive.com/qemu-devel@nongnu.org/msg693176.html Fixes: CVE-2018-12617 Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1594054 Reported-by: Fakhri Zulkifli <mohdfakhrizulkifli@gmail.com> Suggested-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> *update schema documentation to indicate 48MB limit instead of 10MB Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2020-04-15qga: Extract qmp_guest_file_read() to common commands.cPhilippe Mathieu-Daudé
Extract the common code shared by both POSIX/Win32 implementations. Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2020-04-15qga: Extract guest_file_handle_find() to commands-common.hPhilippe Mathieu-Daudé
As we are going to reuse this method, declare it in common header. Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2020-04-15Revert "prevent crash when executing guest-file-read with large count"Philippe Mathieu-Daudé
As noted by Daniel Berrangé in [*], the fix from commit 807e2b6fce which replaced malloc() by try_malloc() is not enough, the process can still run out of memory a few line later: 346 buf = g_try_malloc0(count + 1); 347 if (!buf) { 348 error_setg(errp, 349 "failed to allocate sufficient memory " 350 "to complete the requested service"); 351 return NULL; 352 } 353 is_ok = ReadFile(fh, buf, count, &read_count, NULL); 354 if (!is_ok) { 355 error_setg_win32(errp, GetLastError(), "failed to read file"); 356 slog("guest-file-read failed, handle %" PRId64, handle); 357 } else { 358 buf[read_count] = 0; 359 read_data = g_new0(GuestFileRead, 1); ^^^^^^ Instead we are going to put a low hard limit on 'count' in the next commits. This reverts commit 807e2b6fce022707418bc8f61c069d91c613b3d2. [*] https://lists.gnu.org/archive/html/qemu-devel/2018-06/msg03471.html Suggested-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2020-04-04qga/commands-posix: fix use after free of local_errVladimir Sementsov-Ogievskiy
local_err is used several times in guest_suspend(). Setting non-NULL local_err will crash, so let's zero it after freeing. Also fix possible leak of local_err in final if(). Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Message-Id: <20200324153630.11882-7-vsementsov@virtuozzo.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2020-03-24qemu-ga: document vsock-listen in the man pageStefan Hajnoczi
Although qemu-ga has supported vsock since 2016 it was not documented on the man page. Also add the socket address representation to the qga --help output. Fixes: 586ef5dee77180fc32e33bc08051600030630239 ("qga: add vsock-listen method") Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2020-03-24qga: Fix undefined C behaviorEric Blake
The QAPI struct GuestFileWhence has a comment about how we are exploiting equivalent values between two different integer types shared in a union. But C says behavior is undefined on assignments to overlapping storage when the two types are not the same width, and indeed, 'int64_t value' and 'enum QGASeek name' are very likely to be different in width. Utilize a temporary variable to fix things. Reported-by: Peter Maydell <peter.maydell@linaro.org> Fixes: 0b4b49387 Fixes: Coverity CID 1421990 Signed-off-by: Eric Blake <eblake@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2020-03-24qga-win: prevent crash when executing guest-file-read with large countBasil Salman
guest-file-read command is currently implemented to read from a file handle count number of bytes. when executed with a very large count number qemu-ga crashes. after some digging turns out that qemu-ga crashes after trying to allocate a buffer large enough to save the data read in it, the buffer was allocated using g_malloc0 which is not fail safe, and results a crash in case of failure. g_malloc0 was replaced with g_try_malloc0() which returns NULL on failure, A check was added for that case in order to prevent qemu-ga from crashing and to send a response to the qemu-ga client accordingly. Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1594054 Signed-off-by: Basil Salman <basil@daynix.com> Reported-by: Fakhri Zulkifli <mohdfakhrizulkifli@gmail.com> Cc: qemu-stable@nongnu.org Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2020-03-24qga-win: Handle VSS_E_PROVIDER_ALREADY_REGISTERED errorSameeh Jubran
This patch handles the case where VSS Provider is already registered, where in such case qga uninstalls the provider and registers it again. Signed-off-by: Sameeh Jubran <sjubran@redhat.com> Signed-off-by: Basil Salman <basil@daynix.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2020-03-24qga: Installer: Wait for installation to finishBasil Salman
Installation might fail if we don't wait for the provider unregisteration process to finish. Signed-off-by: Sameeh Jubran <sjubran@redhat.com> Signed-off-by: Basil Salman <basil@daynix.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2020-03-17qmp: constify QmpCommand and listMarc-André Lureau
Since 0b69f6f72ce47a37a749b056b6d5ec64c61f11e8 "qapi: remove qmp_unregister_command()", the command list can be declared const. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Damien Hedde <damien.hedde@greensocs.com> Message-Id: <20200316171824.2319695-1-marcandre.lureau@redhat.com> [Rebased] Signed-off-by: Markus Armbruster <armbru@redhat.com>
2020-03-09qga: Fix a memory leakPhilippe Mathieu-Daudé
The string returned by g_win32_error_message() has to be deallocated with g_free(). Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20200228100726.8414-5-philmd@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2020-03-09qga: Improve error report by calling error_setg_win32()Philippe Mathieu-Daudé
Use error_setg_win32() which adds a hint similar to strerror(errno)). Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20200228100726.8414-4-philmd@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2020-02-15qga/qapi-schema.json: minor format fixups for rSTPeter Maydell
We would like to switch the doc comments to rST format, and rST requires a blank line before the start of a bulleted or enumerated list. Two places in qapi-schema.json were missing this blank line. Some places were using an indented line as a sort of single-item bulleted list, which in the Texinfo output comes out all run onto a single line; use a real bulleted list instead. Some places unnecessarily indented lists, which confuses rST. guest-fstrim:minimum's documentation was indented the right amount to share a line with @minimum, but wasn't actually doing so. The indent on the bulleted list in the guest-set-vcpus Returns section meant rST misindented it. Changes to the generated Texinfo are very minor (the new bulleted lists, and a few extra blank lines). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20200213175647.17628-7-peter.maydell@linaro.org> [Commit message tweaked] Signed-off-by: Markus Armbruster <armbru@redhat.com>
2020-02-15qga/qapi-schema.json: Fix indent level on doc commentsPeter Maydell
The current doc generation doesn't care much about indentation levels, but we would like to switch to an rST format, and rST does care about indentation. Make the doc comments more strongly consistent about indentation for multiline constructs like: @arg: description line 1 description line 2 Returns: line one line 2 so that there is always exactly one space after the colon, and subsequent lines align with the first. This commit is a purely whitespace change, and it does not alter the generated .texi files (because the texi generation code strips away all the extra whitespace). This does mean that we end up with some over-length lines. Note that when the documentation for an argument fits on a single line like this: @arg: one line only then stray extra spaces after the ':' don't affect the rST output, so I have not attempted to methodically fix them, though the preference is a single space here too. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20200213175647.17628-6-peter.maydell@linaro.org> [Commit message tweaked] Signed-off-by: Markus Armbruster <armbru@redhat.com>
2020-02-15qga/qapi-schema.json: Fix missing '-' in GuestDiskBusType doc commentPeter Maydell
The doc comment for GuestDiskBusType doesn't match up with the enumeration because of a missing hyphen in 'file-backed-virtual'. This means the docs are rendered wrongly: "virtual" Win virtual bus type "file-backed" virtual: Win file-backed bus type "file-backed-virtual" Not documented Add the missing hyphen. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20200213175647.17628-5-peter.maydell@linaro.org> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2020-01-24build-sys: clean up flags included in the linker command linePaolo Bonzini
Some of the CFLAGS that are discovered during configure, for example compiler warnings, are being included on the linker command line because QEMU_CFLAGS is added to it. Other flags, such as the -m32, appear twice because they are included in both QEMU_CFLAGS and LDFLAGS. All this leads to confusion with respect to what goes in which Makefile variables (and we have plenty). So, introduce QEMU_LDFLAGS for flags discovered by configure, following the lead of QEMU_CFLAGS, and stop adding to it: 1) options that are already in CFLAGS, for example "-g" 2) duplicate options At the same time, options that _are_ needed by both compiler and linker must now be added to both QEMU_CFLAGS and QEMU_LDFLAGS, which is clearer. This is mostly -fsanitize options. For now, --extra-cflags has this behavior (but --extra-cxxflags does not). Meson will not include CFLAGS on the linker command line, do the same in our build system as well. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-01-14qapi: Generate command registration stuff into separate filesMarkus Armbruster
Having to include qapi-commands.h just for qmp_init_marshal() is suboptimal. Generate it into separate files. This lets monitor/misc.c, qga/main.c, and the generated qapi-commands-FOO.h include less. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20191120182551.23795-4-armbru@redhat.com> [Typos in docs/devel/qapi-code-gen.txt fixed] Reviewed-by: Eric Blake <eblake@redhat.com>
2019-12-18qga: rename Error ** parameter to more common errpVladimir Sementsov-Ogievskiy
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Message-Id: <20191205174635.18758-13-vsementsov@virtuozzo.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2019-12-18qga: Fix guest-get-fsinfo error API violationsMarkus Armbruster
build_guest_fsinfo_for_virtual_device() dereferences @errp when build_guest_fsinfo_for_device() fails. That's wrong; see the big comment in error.h. Introduced in commit 46d4c5723e "qga: Add guest-get-fsinfo command". No caller actually passes null. Fix anyway: splice in a local Error *err, and error_propagate(). Cc: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20191204093625.14836-10-armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
2019-12-14qga: fence guest-set-time if hwclock not availableCornelia Huck
The Posix implementation of guest-set-time invokes hwclock to set/retrieve the time to/from the hardware clock. If hwclock is not available, the user is currently informed that "hwclock failed to set hardware clock to system time", which is quite misleading. This may happen e.g. on s390x, which has a different timekeeping concept anyway. Let's check for the availability of the hwclock command and return QERR_UNSUPPORTED for guest-set-time if it is not available. Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Message-Id: <20191205115350.18713-1-cohuck@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Cornelia Huck <cohuck@redhat.com>
2019-11-04qga: Add "guest-get-memory-block-info" to blacklistBasil Salman
Memory block commands are only supported for linux with sysfs, "guest-get-memory-block-info" was not in blacklist for other cases. Reported on: https://bugzilla.redhat.com/show_bug.cgi?id=1751431 Signed-off-by: Basil Salman <bsalman@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2019-11-04qga-win: network-get-interfaces command name field bug fixBishara AbuHattoum
Network interface name is fetched as an encoded WCHAR array, (wide character), then it is decoded using the guest's CP_ACP Windows code page, which is the default code page as configure in the guest's Windows, then it is returned as a byte array, (char array). As stated in the BZ#1733165, when renaming a network interface to a Chinese name and invoking this command, the returned name field has the (\ufffd) value for each Chinese character the name had, this value is an indication that the code page does not have the decoding information for the given character. This bug is a result of using the CP_ACP code page for decoding which is an interchangeable code page, instead CP_UTF8 code page should be used for decoding the network interface's name. https://bugzilla.redhat.com/show_bug.cgi?id=1733165 Signed-off-by: Bishara AbuHattoum <bishara@daynix.com> Cc: qemu-stable@nongnu.org Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2019-09-03socket: Add backlog parameter to socket_listenJuan Quintela
Current parameter was always one. We continue with that value for now in all callers. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> --- Moved trace to socket_listen
2019-06-12Include qemu-common.h exactly where neededMarkus Armbruster
No header includes qemu-common.h after this commit, as prescribed by qemu-common.h's file comment. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20190523143508.25387-5-armbru@redhat.com> [Rebased with conflicts resolved automatically, except for include/hw/arm/xlnx-zynqmp.h hw/arm/nrf51_soc.c hw/arm/msf2-soc.c block/qcow2-refcount.c block/qcow2-cluster.c block/qcow2-cache.c target/arm/cpu.h target/lm32/cpu.h target/m68k/cpu.h target/mips/cpu.h target/moxie/cpu.h target/nios2/cpu.h target/openrisc/cpu.h target/riscv/cpu.h target/tilegx/cpu.h target/tricore/cpu.h target/unicore32/cpu.h target/xtensa/cpu.h; bsd-user/main.c and net/tap-bsd.c fixed up]
2019-06-12Include qemu/module.h where needed, drop it from qemu-common.hMarkus Armbruster
Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20190523143508.25387-4-armbru@redhat.com> [Rebased with conflicts resolved automatically, except for hw/usb/dev-hub.c hw/misc/exynos4210_rng.c hw/misc/bcm2835_rng.c hw/misc/aspeed_scu.c hw/display/virtio-vga.c hw/arm/stm32f205_soc.c; ui/cocoa.m fixed up]
2019-05-13Clean up ill-advised or unusual header guardsMarkus Armbruster
Leading underscores are ill-advised because such identifiers are reserved. Trailing underscores are merely ugly. Strip both. Our header guards commonly end in _H. Normalize the exceptions. Done with scripts/clean-header-guards.pl. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20190315145123.28030-7-armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> [Changes to slirp/ dropped, as we're about to spin it off]
2019-05-07qga: Fix mingw compilation warnings on enum conversionCao Jiaxi
The win2qemu[] is supposed to be the conversion table to convert between STORAGE_BUS_TYPE in Windows SDK and GuestDiskBusType in qga. But it was incorrectly written that it forces to set a GuestDiskBusType value to STORAGE_BUS_TYPE, which generates an enum conversion warning in clang. Suggested-by: Eric Blake <eblake@redhat.com> Signed-off-by: Cao Jiaxi <driver1998@foxmail.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-id: 20190503003650.10137-1-driver1998@foxmail.com Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2019-03-18qga: process_event() simplificationMarc-André Lureau
Simplify the code around qmp_dispatch(): - rely on qmp_dispatch/check_obj() for message checking - have a single send_response() point - constify send_response() argument It changes a couple of error messages: * When @req isn't a dictionary, from Invalid JSON syntax to QMP input must be a JSON object * When @req lacks member "execute", from this feature or command is not currently supported to QMP input lacks member 'execute' CC: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2019-03-18qga: Fix guest-get-fsinfo PCI address collection in WindowsMatt Hines
The Windows QEMU guest agent erroneously tries to collect PCI information directly from the physical drive. However, windows stores SCSI/IDE information with the drive and PCI information with the underlying storage controller This changes get_pci_info to use the physical drive's underlying storage controller to get PCI information. * Additionally Fixes incorrect size being passed to DeviceIoControl when getting volume extents. Can occasionally crash the guest agent Signed-off-by: Matt Hines <mhines@scalecomputing.com> *fix up some checkpatch warnings *fix domain reporting and add some sanity checks for debug Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2019-03-18qga-win: fix VSS build breakage due to unintended gnu99 C++ flagMichael Roth
Commit 7be41675f7c set -std=gnu99 for C code via QEMU_CFLAGS. Currently we generate a "custom" QEMU_CXXFLAGS for VSS DLL C++ build by filtering out some options from QEMU_CFLAGS and adding some others. Since we don't filter out -std=gnu99 currently this breaks builds when VSS support is enabled. We could keep the existing approach, filter out -std=gnu99 from QEMU_CFLAGS, and add -std=gnu++98, like configure currently does for QEMU_CXXFLAGS, but as it turns out our resulting QEMU_CXXFLAGS would be exactly what configure already generates, just with these filtered out: -fstack-protector-all -fstack-protector-strong and these added: -Wno-unknown-pragmas -Wno-delete-non-virtual-dtor So fix the issue by re-using configure-generated QEMU_CXXFLAGS and just handling these specific changes. Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2019-03-18qga-win: include glib when building VSS DLLMichael Roth
Commit 3ebee3b191e defined assert() as g_assert(), but when we build the VSS DLL component of QGA (to handle fsfreeze) we do not include glib, which results in breakage when building with VSS support enabled. Fix this by including glib (along with the -lintl and -lws2_32 dependencies it brings). Since the VSS DLL is built statically, this introduces an additional dependency on static glib and supporting libs for the mingw environment (possibly why we didn't include glib originally), but VSS support already has very specific prerequisites so it shouldn't affect too many build environments. Since the VSS DLL code does use qemu/osdep.h, this should also help avoid future breakages and possibly allow for some clean ups in current VSS code. Suggested-by: Daniel P. Berrangé <berrange@redhat.com> Cc: Daniel P. Berrangé <berrange@redhat.com> Cc: qemu-stable@nongnu.org Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2019-03-18qga-win: Adding support for Windows Server 2019 get-osinfo commandBishara AbuHattoum
Since Windows Server 2016, Microsoft stopped upgrading the major and minor versions of their new Windows Server product, so, the current functionality of checking major and minor version numbers to determine the Windows Server version wont work as expected. The implemented solution here is to use the build number in addition to the major and minor version numbers of the product to determine the Windows Server product version. The final build number of Windows Server 2016 is 14939, and the final build number of Windows Server 2019 is 17764, so any Windows Server product that has the major version of 10 and minor version of 0 with a build number lower or equal to 14939 will resemble 2016 and if the build number is lower or equal to 17763 will resemble 2019. Reference: https://techcommunity.microsoft.com/t5/Windows-Server-Insiders/Windows-Server-2019-version-info/m-p/293112/highlight/true#M859 Signed-off-by: Bishara AbuHattoum <bishara@daynix.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2019-03-18qga: update docs with systemd suspend support infoDaniel Henrique Barboza
Commit 067927d62e ("qga: systemd hibernate/suspend/hybrid-sleep support") failed to update qapi-schema.json after adding systemd hibernate/suspend/hybrid-sleep capabilities to guest-suspend-* QGA commands. Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2019-01-11qemu/queue.h: simplify reverse access to QTAILQPaolo Bonzini
The new definition of QTAILQ does not require passing the headname, remove it. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-01-11qga: drop < Vista compatibilityMarc-André Lureau
Building QGA for XP seems possible so far: the dependency on libqemuutil.a implies building qemu-thread-win32.c, which requires Vista API since commit 12f8def0 (v2.9). But qemu-thread isn't being used in QGA, the resulting binary may still work on XP. XP is no longer supported for the past 4.5y, it's time to drop support for it. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20181122110039.15972-5-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-01-11build-sys: build with Vista API by defaultMarc-André Lureau
Both qemu & qga build with Vista API by default already, by defining _WIN32_WINNT 0x0600. Set it globally in osdep.h instead. This replaces WINVER by _WIN32_WINNT in osdep.h. WINVER doesn't seem to be really useful these days. (see also https://blogs.msdn.microsoft.com/oldnewthing/20070411-00/?p=27283) Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20181122110039.15972-4-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2018-12-19Merge remote-tracking branch ↵Peter Maydell
'remotes/vivier2/tags/trivial-patches-pull-request' into staging Trivial patches (2018-12-18) # gpg: Signature made Tue 18 Dec 2018 14:28:41 GMT # gpg: using RSA key F30C38BD3F2FBE3C # gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" # gpg: aka "Laurent Vivier <laurent@vivier.eu>" # gpg: aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" # Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F 5173 F30C 38BD 3F2F BE3C * remotes/vivier2/tags/trivial-patches-pull-request: error: Remove NULL checks on error_propagate() calls vl: Use error_fatal to simplify obvious fatal errors (again) i386: hvf: drop debug printf in decode_sldtgroup docs/devel/build-system: fix 'softmu' typo Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-12-18error: Remove NULL checks on error_propagate() callsMarkus Armbruster
Patch created mechanically by rerunning: $ spatch --sp-file scripts/coccinelle/error_propagate_null.cocci \ --macro-file scripts/cocci-macro-file.h \ --dir . --in-place Whitespace tidied up manually. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20181213173113.11211-1-armbru@redhat.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2018-12-18qga: update guest-suspend-ram and guest-suspend-hybrid descriptionsDaniel Henrique Barboza
This patch updates the descriptions of 'guest-suspend-ram' and 'guest-suspend-hybrid' to mention that both commands relies now on the proper support for wake up from suspend, retrieved by the 'wakeup-suspend-support' attribute of the 'query-current-machine' QMP command. Reported-by: Balamuruhan S <bala24@linux.vnet.ibm.com> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Message-Id: <20181205194701.17836-3-danielhb413@gmail.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Acked-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2018-11-09qga: Add multiple include guard to guest-agent-core.hPeter Maydell
The guest-agent-core.h header was missing the usual guards against multiple inclusion; add them. (Spotted by lgtm.com's static analyzer.) Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2018-11-09qga-win: fix leaks of build_guest_disk_info()Marc-André Lureau
Introduced in commit b1ba8890e63ce9432c41c5c3fc229f54c87c9c99, vol_h handle should be closed, and "out" cleanup should be done after DeviceIoControl() fails. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2018-10-31qga-win: changing --retry-path option behaviorBishara AbuHattoum
Currently whenever the qemu-ga's service doesn't find the virtio-serial the run_agent() loops in a QGA_RETRY_INTERVAL (default 5 seconds) intervals and try to restart the qemu-ga which causes a synchronous loop. Changed to wait and listen for the serial events by registering for notifications a proper serial event handler that deals with events: DBT_DEVICEARRIVAL indicates that the device has been inserted and is available DBT_DEVICEREMOVECOMPLETE indicates that the devive has been removed Which allow us to determine when the channel path is available for the qemu-ga to restart. Signed-off-by: Bishara AbuHattoum <bishara@daynix.com> Signed-off-by: Sameeh Jubran <sameeh@daynix.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2018-10-31qga-win: report specific error when failing to open channelMichael Roth
Useful in general, but especially now that errors might occur more frequently with --retry-path set. Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2018-10-31qga-win: install service with --retry-path set by defaultMichael Roth
It's nicer from a management perspective that the agent can survive hotplug/unplug of the channel device, or be started prior to the installation of the channel device's driver without and still be able to resume normal function afterward. On linux there are alternatives like systemd to support this, but on w32 --retry-path is the only option so it makes sense to set it by default when installed as a w32 service. Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2018-10-31qga: add --retry-path option for re-initializing channel on failureMichael Roth
This adds an option to instruct the agent to periodically attempt re-opening the communication channel after a channel error has occurred. The main use-case for this is providing an OS-independent way of allowing the agent to survive situations like hotplug/unplug of the communication channel, or initial guest set up where the agent may be installed/started prior to the installation of the channel device's driver. There are nicer ways of implementing this functionality via things like systemd services, but this option is useful for platforms like *BSD/w32. Currently a channel error will result in the GSource for that channel being removed from the GMainLoop, but the main loop continuing to run. That behavior results in a dead loop when --retry-path isn't set, and prevents us from knowing when to attempt re-opening the channel when it is set, so we also force the loop to exit as part of this patch. Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2018-10-31qga: move w32 service handling out of run_agent()Michael Roth
Eventually we want a w32 service to be able to restart the qga main loop from within service_main(). To allow for this we move service handling out of run_agent() such that service_main() calls run_agent() instead of the reverse. Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Bishara AbuHattoum <bishara@daynix.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2018-10-31qga: hang GAConfig/socket_activation off of GAState globalMichael Roth
For w32 services we rely on the global GAState to access resources associated with the agent within service_main(). Currently this is sufficient for starting the agent since we open the channel once prior to calling service_main(), and simply start the GMainLoop to start the agent from within service_main(). Eventually we want to be able to also [re-]open the communication channel from within service_main(), which requires access to config/socket_activation variables, so we hang them off GAState in preparation for that. Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Sameeh Jubran <sameeh@daynix.com> *dont move GAConfig struct, just the typedef *fix build bisect for w32 Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>