qemu-ga patch queue for hard-freeze

* fix undefined C behavior with guest-file-* interfaces
 * fix w32 installer issues
 * fix crash for large file reads via guest-file-read on windows
 * add missing man page documentation for virtio-vsock
 -----BEGIN PGP SIGNATURE-----
 
 iQFOBAABCgA4FiEEzqzJ4VU066u4LT+gM1PJzvEItYQFAl56OSQaHG1kcm90aEBs
 aW51eC52bmV0LmlibS5jb20ACgkQM1PJzvEItYRXsgf/cAg9ZZkmyYDuzgFX6HGb
 ZWEL1EnSl423w0rvimVWuLa6n5j+BO/OjWNLmpdbWKP77EmCD2XwGFPcjZ4xBzKQ
 DdFzr5OiQQpFjzBaF7/ZU04t43nRBKlgt/Fse845Feu7MqsBoR2mMSKl6XscX/oz
 /KJ41KsfzuydIhCeXEY6kQ2dzoqlWsZYMwMkHeu3S7tbHdYslZCOK3VO2VQSuNd4
 zqrS5zdUgA8xFLSQ2EIAtBCLdltkAWnP5LPsvNukVUWf75c7e4yblycDJ8LUrszM
 V/P1gCgvMHqQYxLlyKkFJfcGPJvi3vFBTD+fDxTaCs/41iaugwFbNzzHTDmhM93z
 RQ==
 =eJGx
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/mdroth/tags/qga-pull-2020-03-24-tag0' into staging

qemu-ga patch queue for hard-freeze

* fix undefined C behavior with guest-file-* interfaces
* fix w32 installer issues
* fix crash for large file reads via guest-file-read on windows
* add missing man page documentation for virtio-vsock

# gpg: Signature made Tue 24 Mar 2020 16:45:24 GMT
# gpg:                using RSA key CEACC9E15534EBABB82D3FA03353C9CEF108B584
# gpg:                issuer "mdroth@linux.vnet.ibm.com"
# gpg: Good signature from "Michael Roth <flukshun@gmail.com>" [full]
# gpg:                 aka "Michael Roth <mdroth@utexas.edu>" [full]
# gpg:                 aka "Michael Roth <mdroth@linux.vnet.ibm.com>" [full]
# Primary key fingerprint: CEAC C9E1 5534 EBAB B82D  3FA0 3353 C9CE F108 B584

* remotes/mdroth/tags/qga-pull-2020-03-24-tag0:
  qemu-ga: document vsock-listen in the man page
  qga: Fix undefined C behavior
  qga-win: prevent crash when executing guest-file-read with large count
  qga-win: Handle VSS_E_PROVIDER_ALREADY_REGISTERED error
  qga: Installer: Wait for installation to finish

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2020-03-24 16:56:05 +00:00
commit 9c353b2fc9
6 changed files with 32 additions and 7 deletions

View File

@ -36,13 +36,14 @@ Options
.. option:: -m, --method=METHOD
Transport method: one of ``unix-listen``, ``virtio-serial``, or
``isa-serial`` (``virtio-serial`` is the default).
``isa-serial``, or ``vsock-listen`` (``virtio-serial`` is the default).
.. option:: -p, --path=PATH
Device/socket path (the default for virtio-serial is
``/dev/virtio-ports/org.qemu.guest_agent.0``,
the default for isa-serial is ``/dev/ttyS0``)
the default for isa-serial is ``/dev/ttyS0``). Socket addresses for
vsock-listen are written as ``<cid>:<port>``.
.. option:: -l, --logfile=PATH

View File

@ -343,7 +343,13 @@ GuestFileRead *qmp_guest_file_read(int64_t handle, bool has_count,
}
fh = gfh->fh;
buf = g_malloc0(count+1);
buf = g_try_malloc0(count + 1);
if (!buf) {
error_setg(errp,
"failed to allocate sufficient memory "
"to complete the requested service");
return NULL;
}
is_ok = ReadFile(fh, buf, count, &read_count, NULL);
if (!is_ok) {
error_setg_win32(errp, GetLastError(), "failed to read file");

View File

@ -482,10 +482,15 @@ done:
* the guest's SEEK_ constants. */
int ga_parse_whence(GuestFileWhence *whence, Error **errp)
{
/* Exploit the fact that we picked values to match QGA_SEEK_*. */
/*
* Exploit the fact that we picked values to match QGA_SEEK_*;
* however, we have to use a temporary variable since the union
* members may have different size.
*/
if (whence->type == QTYPE_QSTRING) {
int value = whence->u.name;
whence->type = QTYPE_QNUM;
whence->u.value = whence->u.name;
whence->u.value = value;
}
switch (whence->u.value) {
case QGA_SEEK_SET:

View File

@ -81,7 +81,7 @@
Arguments="-d --retry-path"
>
</ServiceInstall>
<ServiceControl Id="StartService" Start="install" Stop="both" Remove="uninstall" Name="QEMU-GA" Wait="no" />
<ServiceControl Id="StartService" Start="install" Stop="both" Remove="uninstall" Name="QEMU-GA" Wait="yes" />
</Component>
<?ifdef var.InstallVss?>
<Component Id="qga_vss_dll" Guid="{CB19C453-FABB-4BB1-ABAB-6B74F687BFBB}">

View File

@ -234,7 +234,9 @@ QEMU_COPYRIGHT "\n"
" -p, --path device/socket path (the default for virtio-serial is:\n"
" %s,\n"
" the default for isa-serial is:\n"
" %s)\n"
" %s).\n"
" Socket addresses for vsock-listen are written as\n"
" <cid>:<port>.\n"
" -l, --logfile set logfile path, logs to stderr by default\n"
" -f, --pidfile specify pidfile (default is %s)\n"
#ifdef CONFIG_FSFREEZE

View File

@ -443,6 +443,17 @@ STDAPI DllRegisterServer(void)
VSS_PROV_SOFTWARE,
const_cast<WCHAR*>(QGA_PROVIDER_VERSION),
g_gProviderVersion);
if (hr == (long int) VSS_E_PROVIDER_ALREADY_REGISTERED) {
DllUnregisterServer();
hr = pVssAdmin->RegisterProvider(g_gProviderId, CLSID_QGAVSSProvider,
const_cast<WCHAR * >
(QGA_PROVIDER_LNAME),
VSS_PROV_SOFTWARE,
const_cast<WCHAR * >
(QGA_PROVIDER_VERSION),
g_gProviderVersion);
}
if (FAILED(hr)) {
errmsg_dialog(hr, "RegisterProvider failed");
}