From: "Marc-André Lureau" <marcandre.lureau@redhat.com>
To: qemu-devel@nongnu.org
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Subject: [GIT PULL 6/8] tests/qtest/dump: reject win-dmp without vmcoreinfo
Date: Tue, 30 Jun 2026 19:13:21 +0400 [thread overview]
Message-ID: <20260630-dump-v1-6-7df3087dffc9@redhat.com> (raw)
In-Reply-To: <20260630-dump-v1-0-7df3087dffc9@redhat.com>
From: "Denis V. Lunev" <den@openvz.org>
Requesting the Windows crashdump format (win-dmp) on a guest that does not
expose a Windows dump header through vmcoreinfo must be rejected, not
silently turned into a bogus dump. Add a test that asks for win-dmp on a
plain VM and checks the request fails with "invalid vmcoreinfo note size"
and that the VM stays usable afterwards (a subsequent ELF dump succeeds).
The test is x86_64 only, where win_dump_available() performs this check.
Signed-off-by: Denis V. Lunev <den@openvz.org>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20260619101834.228432-7-den@openvz.org>
---
tests/qtest/dump-test.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
diff --git a/tests/qtest/dump-test.c b/tests/qtest/dump-test.c
index eb188c9ccb8..6afaa2c2ea4 100644
--- a/tests/qtest/dump-test.c
+++ b/tests/qtest/dump-test.c
@@ -174,8 +174,51 @@ static void test_dump_invalid_protocol(void)
qtest_quit(qts);
}
+/*
+ * Requesting win-dmp without a Windows dump header in vmcoreinfo must be
+ * rejected with a clear error -- and must leave the VM usable, rather than
+ * produce a bogus dump.
+ */
+static void test_dump_win_dmp_unavailable(void)
+{
+ QTestState *qts = dump_test_start();
+ g_autofree char *tmp = NULL;
+ g_autofree char *proto = NULL;
+ g_autofree char *path = NULL;
+ GError *err = NULL;
+ QDict *resp, *error;
+ const char *desc;
+ int fd;
+
+ fd = g_file_open_tmp("dump-test-XXXXXX", &tmp, &err);
+ g_assert_no_error(err);
+ close(fd);
+ proto = g_strdup_printf("file:%s", tmp);
+
+ resp = qtest_qmp(qts,
+ "{ 'execute': 'dump-guest-memory',"
+ " 'arguments': { 'paging': false, 'protocol': %s,"
+ " 'format': 'win-dmp' } }", proto);
+ error = qdict_get_qdict(resp, "error");
+ g_assert_nonnull(error);
+ desc = qdict_get_try_str(error, "desc");
+ g_assert_nonnull(desc);
+ g_assert_nonnull(strstr(desc, "vmcoreinfo"));
+ qobject_unref(resp);
+ unlink(tmp);
+
+ /* the failed request must not wedge the VM: a plain dump still works */
+ path = do_dump(qts, NULL);
+ assert_valid_elf_core(path);
+ unlink(path);
+
+ qtest_quit(qts);
+}
+
int main(int argc, char **argv)
{
+ const char *arch = qtest_get_arch();
+
g_test_init(&argc, &argv, NULL);
qtest_add_func("/dump/query-capability", test_query_capability);
@@ -184,5 +227,11 @@ int main(int argc, char **argv)
qtest_add_func("/dump/kdump-raw-zlib", test_dump_kdump_raw_zlib);
qtest_add_func("/dump/invalid-protocol", test_dump_invalid_protocol);
+ /* win-dmp is an x86_64-only format */
+ if (g_str_equal(arch, "x86_64")) {
+ qtest_add_func("/dump/win-dmp-unavailable",
+ test_dump_win_dmp_unavailable);
+ }
+
return g_test_run();
}
--
2.54.0
next prev parent reply other threads:[~2026-06-30 15:16 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-30 15:13 [GIT PULL 0/8] Dump patches for 2026-06-30 Marc-André Lureau
2026-06-30 15:13 ` [GIT PULL 1/8] migration: add migration_guest_ram_loading() helper Marc-André Lureau
2026-06-30 15:13 ` [GIT PULL 2/8] dump: refuse dump-guest-memory while guest RAM is being migrated Marc-André Lureau
2026-06-30 15:13 ` [GIT PULL 3/8] system/cpus: refuse memsave/pmemsave " Marc-André Lureau
2026-06-30 15:13 ` [GIT PULL 4/8] dump: make win_dump_available() check vmcoreinfo for a Windows dump header Marc-André Lureau
2026-06-30 15:13 ` [GIT PULL 5/8] tests/qtest: add dump-guest-memory test Marc-André Lureau
2026-06-30 15:13 ` Marc-André Lureau [this message]
2026-06-30 15:13 ` [GIT PULL 7/8] tests/qtest/dump: cover win-dmp availability via vmcoreinfo Marc-André Lureau
2026-06-30 15:13 ` [GIT PULL 8/8] dump: fix misleading VMCOREINFO phys_base parse error Marc-André Lureau
2026-07-02 18:49 ` [GIT PULL 0/8] Dump patches for 2026-06-30 Stefan Hajnoczi
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=20260630-dump-v1-6-7df3087dffc9@redhat.com \
--to=marcandre.lureau@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.