From: "Tomáš Golembiovský" <tgolembi@redhat.com>
To: Michael Roth <mdroth@linux.vnet.ibm.com>
Cc: qemu-devel@nongnu.org, "Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 3/4] qga: win32: fix crashes when PCI info cannot be retrived
Date: Fri, 7 Sep 2018 13:24:44 +0200 [thread overview]
Message-ID: <20180907132444.19bdddf8@fiorina> (raw)
In-Reply-To: <153618966719.28231.7120762050650762023@sif>
On Wed, 05 Sep 2018 18:21:07 -0500
Michael Roth <mdroth@linux.vnet.ibm.com> wrote:
> Quoting Tomáš Golembiovský (2018-08-07 05:51:37)
> > The guest-get-fsinfo command collects also information about PCI
> > controller where the disk is attached. When this fails for some reasons
> > it tries to return just the partial information. However in certain
> > cases the pointer to the structure was not initialized and was set to
> > NULL. This breaks the serializer and lead to crasehs of the guest agent.
> >
> > Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
> > ---
> > qga/commands-win32.c | 27 ++++++++++++++++++++++-----
> > 1 file changed, 22 insertions(+), 5 deletions(-)
> >
> > diff --git a/qga/commands-win32.c b/qga/commands-win32.c
> > index 36d76c22c0..995f62c2e4 100644
> > --- a/qga/commands-win32.c
> > +++ b/qga/commands-win32.c
> > @@ -642,15 +642,32 @@ static GuestDiskAddressList *build_guest_disk_info(char *guid, Error **errp)
> > g_debug("getting pci-controller info");
> > if (DeviceIoControl(vol_h, IOCTL_SCSI_GET_ADDRESS, NULL, 0, scsi_ad,
> > sizeof(SCSI_ADDRESS), &len, NULL)) {
> > + Error *local_err = NULL;
> > disk->unit = addr.Lun;
> > disk->target = addr.TargetId;
> > disk->bus = addr.PathId;
> > - disk->pci_controller = get_pci_info(name, errp);
> > + g_debug("unit=%lld target=%lld bus=%lld",
> > + disk->unit, disk->target, disk->bus);
> > + disk->pci_controller = get_pci_info(name, &local_err);
> > +
> > + if (local_err) {
> > + slog("failed to get PCI controller info: %s",
> > + error_get_pretty(local_err));
>
> slog() is more for logging/auditing events that a guest administrator might
> be interested in knowing about, like when qga is accessing files, freezing
> filesystems, etc. General qga-side error reporting and debug logging should
> go through the normal g_debug/g_warning/etc interfaces to be captured in
> qga's log file.
ok
>
> We should also moved patch 1 after this so we don't expose a breakage
> prior to the fix.
ok
>
> How often are you seeing failures with the pci info?
On Windows 10 Enterprise every the time. On Windows 8 the original code
fails terribly much sooner.
> And does the
> information for the non-failures look valid to you?
I'll tell you when I see that. :)
> I tried to fix the
> CONFIG_QGA_NTDDSCSI naming screw-up a while back and some values like
> PCI func/bus/etc looked bogus, SPDRP_BUSNUMBER/SPDRP_ADDRESS/SPDRP_BUSNUMBER
> didn't seem to be returning what the current code thinks they are. If that's
> still the case it would be good to fix that before we final re-enable this
> code.
Does that mean the queries for SPDRP_* properties work for you?
The issue is that it fails every time as the request is for a
volume not a disk.
Unfortunately I don't know how to fix that at the moment. See my comment
in the followup version of the series that I will send shortly.
Tomas
>
> > + error_free(local_err);
> > + } else if (disk->pci_controller != NULL) {
> > + g_debug("pci: domain=%lld bus=%lld slot=%lld function=%lld",
> > + disk->pci_controller->domain,
> > + disk->pci_controller->bus,
> > + disk->pci_controller->slot,
> > + disk->pci_controller->function);
> > + }
> > }
> > - /* We do not set error in this case, because we still have enough
> > - * information about volume. */
> > - } else {
> > - disk->pci_controller = NULL;
> > + }
> > + /* We do not set error in case pci_controller is NULL, because we still
> > + * have enough information about volume. */
> > + if (disk->pci_controller == NULL) {
> > + g_debug("no PCI controller info");
> > + disk->pci_controller = g_malloc0(sizeof(GuestPCIAddress));
> > }
> >
> > list = g_malloc0(sizeof(*list));
> > --
> > 2.18.0
> >
>
--
Tomáš Golembiovský <tgolembi@redhat.com>
next prev parent reply other threads:[~2018-09-07 11:24 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-07 10:51 [Qemu-devel] [PATCH v2 0/4] qga: report serial number and disk node Tomáš Golembiovský
2018-08-07 10:51 ` [Qemu-devel] [PATCH v2 1/4] build: rename CONFIG_QGA_NTDDDISK to CONFIG_QGA_NTDDSCSI Tomáš Golembiovský
2018-08-07 10:51 ` [Qemu-devel] [PATCH v2 2/4] qga: win32: add debugging information Tomáš Golembiovský
2018-08-07 10:51 ` [Qemu-devel] [PATCH v2 3/4] qga: win32: fix crashes when PCI info cannot be retrived Tomáš Golembiovský
2018-09-05 23:21 ` Michael Roth
2018-09-07 11:24 ` Tomáš Golembiovský [this message]
2018-08-07 10:51 ` [Qemu-devel] [PATCH v2 4/4] qga: report serial ID and device node Tomáš Golembiovský
2018-08-07 13:52 ` Eric Blake
2018-08-09 11:50 ` Tomáš Golembiovský
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180907132444.19bdddf8@fiorina \
--to=tgolembi@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).