From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Nikolai Barybin <nikolai.barybin@virtuozzo.com>
Cc: qemu-devel@nongnu.org, "Denis V . Lunev" <den@virtuozzo.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Ani Sinha" <anisinha@redhat.com>
Subject: Re: [PATCH 1/1] dump: enhance win_dump_available to report properly
Date: Mon, 8 Sep 2025 17:57:04 +0100 [thread overview]
Message-ID: <aL8K4I91w4dRZrCC@redhat.com> (raw)
In-Reply-To: <20250831161022.452426-2-nikolai.barybin@virtuozzo.com>
On Sun, Aug 31, 2025 at 07:10:22PM +0300, Nikolai Barybin wrote:
> QMP query-dump-guest-memory-capability reports win dump as available for
> any x86 VM, which is false.
>
> This patch implements proper query of vmcoreinfo and calculation of
> guest note size. Based on that we can surely report whether win dump
> available or not.
>
> To perform this I suggest to split dump_init() into dump_preinit() and
> dump_init_complete() to avoid exausting copypaste in
> win_dump_available().
>
> Also dump_state_prepare() and dump_cleanup() were modified to avoid
> unsafe close on fd == 0. Thus, it is initialized to -1.
>
> For further reference one may review this libvirt discussion:
> https://lists.libvirt.org/archives/list/devel@lists.libvirt.org/thread/HJ3JRLWLGN3IKIC22OQ3PMZ4J3EFG5XB/#HJ3JRLWLGN3IKIC22OQ3PMZ4J3EFG5XB
> [PATCH 0/4] Allow xml-configured coredump format on VM crash
>
> Signed-off-by: Nikolai Barybin <nikolai.barybin@virtuozzo.com>
> ---
> dump/dump.c | 138 ++++++++++++++++++++++++++++--------------------
> dump/win_dump.c | 23 ++++++--
> dump/win_dump.h | 2 +-
> 3 files changed, 101 insertions(+), 62 deletions(-)
>
> diff --git a/dump/dump.c b/dump/dump.c
> index 15bbcc0c61..ce8b43f819 100644
> --- a/dump/dump.c
> +++ b/dump/dump.c
> @@ -103,7 +103,10 @@ static int dump_cleanup(DumpState *s)
>
> guest_phys_blocks_free(&s->guest_phys_blocks);
> memory_mapping_list_free(&s->list);
> - close(s->fd);
> + if (s->fd != -1) {
> + close(s->fd);
> + }
> + s->fd = -1;
> g_free(s->guest_note);
> g_clear_pointer(&s->string_table_buf, g_array_unref);
> s->guest_note = NULL;
> @@ -1708,8 +1711,8 @@ static DumpState dump_state_global = { .status = DUMP_STATUS_NONE };
>
> static void dump_state_prepare(DumpState *s)
> {
> - /* zero the struct, setting status to active */
> - *s = (DumpState) { .status = DUMP_STATUS_ACTIVE };
> + /* zero the struct, setting status to active and fd to -1 */
> + *s = (DumpState) { .fd = -1, .status = DUMP_STATUS_ACTIVE };
> }
>
Can you do this as a separate patch, as this is a pre-existing bug that
ought to be cherry-picked to be fixed in stable too.
If this is split, then you can add
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
to both patches.
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
prev parent reply other threads:[~2025-09-08 16:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-31 16:10 [PATCH v3 0/1] dump: enhance win_dump_available to report properly Nikolai Barybin
2025-08-31 16:10 ` [PATCH 1/1] " Nikolai Barybin
2025-09-08 16:57 ` Daniel P. Berrangé [this message]
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=aL8K4I91w4dRZrCC@redhat.com \
--to=berrange@redhat.com \
--cc=anisinha@redhat.com \
--cc=den@virtuozzo.com \
--cc=marcandre.lureau@redhat.com \
--cc=nikolai.barybin@virtuozzo.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).