From: Paolo Bonzini <pbonzini@redhat.com>
To: Laurent Vivier <laurent@vivier.eu>,
Peter Maydell <peter.maydell@linaro.org>
Cc: QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PULL v2 00/15] Misc patches for QEMU 3.1-rc3
Date: Tue, 27 Nov 2018 16:59:12 +0100 [thread overview]
Message-ID: <f0d29af6-0f92-01b9-b7c3-d7e7357d6514@redhat.com> (raw)
In-Reply-To: <76c272d6-684f-60c8-6e23-06321165045e@vivier.eu>
On 27/11/18 16:47, Laurent Vivier wrote:
> On 27/11/2018 16:43, Peter Maydell wrote:
>> On Tue, 27 Nov 2018 at 14:38, Paolo Bonzini <pbonzini@redhat.com> wrote:
>>>
>>> The following changes since commit 4822f1ee9efa8df56e29db0a68323b484bdb0335:
>>>
>>> Merge remote-tracking branch 'remotes/kraxel/tags/fixes-31-20181127-pull-request' into staging (2018-11-27 11:21:38 +0000)
>>>
>>> are available in the git repository at:
>>>
>>>
>>> git://github.com/bonzini/qemu.git tags/for-upstream
>>>
>>> for you to fetch changes up to cb16c8466b6c62868aba47cd95fadcf316541f40:
>>>
>>> hostmem: no need to check for host_memory_backend_mr_inited() in alloc() (2018-11-27 15:35:19 +0100)
>>>
>>> ----------------------------------------------------------------
>>> * lsi HBA reselection fix (George)
>>> * Small cleanups (Li Qiang)
>>> * bugfixes for vhost-user-bridge and hostmem (Marc-André)
>>> * single-thread TCG fix (me)
>>> * VMX migration blocker (me)
>>> * target/i386 fix for LOCK (Richard)
>>> * fix elf2dmp check (Roman)
>>> * MAINTAINERS update (Philippe, Thomas)
>>>
>>> ----------------------------------------------------------------
>>
>> Hi; I'm afraid this has compile problems on 32-bit hosts and
>> on the various BSDs.
>>
>> Format string issues, 32-bit hosts:
>>
>> /home/peter.maydell/qemu/contrib/elf2dmp/main.c: In function 'get_kdbg':
>> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:90:52: error: format
>> '%lx' expects argument of type 'long unsigned int', but argument 2 has
>> type 'uint64_t {aka
>> long long unsigned int}' [-Werror=format=]
>> if (!SYM_RESOLVE(KernBase, pdb, KiWaitNever) ||
>> ^
>> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:44:17: note: in
>> definition of macro 'SYM_RESOLVE'
>> s ? printf(#s" = 0x%016lx\n", s) : eprintf("Failed to resolve "#s"\n"), s)
>> ^
>> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:91:57: error: format
>> '%lx' expects argument of type 'long unsigned int', but argument 2 has
>> type 'uint64_t {aka
>> long long unsigned int}' [-Werror=format=]
>> !SYM_RESOLVE(KernBase, pdb, KiWaitAlways) ||
>> ^
>> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:44:17: note: in
>> definition of macro 'SYM_RESOLVE'
>> s ? printf(#s" = 0x%016lx\n", s) : eprintf("Failed to resolve "#s"\n"), s)
>> ^
>> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:92:64: error: format
>> '%lx' expects argument of type 'long unsigned int', but argument 2 has
>> type 'uint64_t {aka
>> long long unsigned int}' [-Werror=format=]
>> !SYM_RESOLVE(KernBase, pdb, KdpDataBlockEncoded)) {
>> ^
>> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:44:17: note: in
>> definition of macro 'SYM_RESOLVE'
>> s ? printf(#s" = 0x%016lx\n", s) : eprintf("Failed to resolve "#s"\n"), s)
>> ^
>> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:101:16: error: format
>> '%lx' expects argument of type 'long unsigned int', but argument 2 has
>> type 'uint64_t {aka
>> long long unsigned int}' [-Werror=format=]
>> printf("[KiWaitNever] = 0x%016lx\n", kwn);
>> ^
>> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:102:16: error: format
>> '%lx' expects argument of type 'long unsigned int', but argument 2 has
>> type 'uint64_t {aka
>> long long unsigned int}' [-Werror=format=]
>> printf("[KiWaitAlways] = 0x%016lx\n", kwa);
>> ^
>> /home/peter.maydell/qemu/contrib/elf2dmp/main.c: In function 'fix_dtb':
>> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:205:20: error: format
>> '%lx' expects argument of type 'long unsigned int', but argument 2 has
>> type 'uint64_t {aka
>> long long unsigned int}' [-Werror=format=]
>> printf("DTB 0x%016lx has been found from CPU #%zu"
>> ^
>> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:225:16: error: format
>> '%lx' expects argument of type 'long unsigned int', but argument 2 has
>> type 'uint64_t {aka
>> long long unsigned int}' [-Werror=format=]
>> printf("DirectoryTableBase = 0x%016lx has been found from CPU #0"
>> ^
>> /home/peter.maydell/qemu/contrib/elf2dmp/main.c: In function 'main':
>> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:491:12: error: format
>> '%lx' expects argument of type 'long unsigned int', but argument 2 has
>> type 'uint64_t {aka long long unsigned int}' [-Werror=format=]
>> printf("CPU #0 CR3 is 0x%016lx\n", state->cr[3]);
>> ^
>> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:500:12: error: format
>> '%lx' expects argument of type 'long unsigned int', but argument 2 has
>> type 'uint64_t {aka long long unsigned int}' [-Werror=format=]
>> printf("CPU #0 IDT is at 0x%016lx\n", state->idt.base);
>> ^
>> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:508:12: error: format
>> '%lx' expects argument of type 'long unsigned int', but argument 2 has
>> type 'uint64_t {aka long long unsigned int}' [-Werror=format=]
>> printf("CPU #0 IDT[0] -> 0x%016lx\n", idt_desc_addr(first_idt_desc));
>> ^
>> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:511:12: error: format
>> '%lx' expects argument of type 'long unsigned int', but argument 2 has
>> type 'uint64_t {aka long long unsigned int}' [-Werror=format=]
>> printf("Searching kernel downwards from 0x%16lx...\n", KernBase);
>> ^
>> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:524:12: error: format
>> '%lx' expects argument of type 'long unsigned int', but argument 2 has
>> type 'uint64_t {aka long long unsigned int}' [-Werror=format=]
>> printf("KernBase = 0x%16lx, signature is \'%.2s\'\n", KernBase,
>> ^
>> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:548:57: error: format
>> '%lx' expects argument of type 'long unsigned int', but argument 2 has
>> type 'uint64_t {aka long long unsigned int}' [-Werror=format=]
>> if (!SYM_RESOLVE(KernBase, &pdb, KdDebuggerDataBlock) ||
>> ^
>> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:44:17: note: in
>> definition of macro 'SYM_RESOLVE'
>> s ? printf(#s" = 0x%016lx\n", s) : eprintf("Failed to resolve "#s"\n"), s)
>> ^
>> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:549:56: error: format
>> '%lx' expects argument of type 'long unsigned int', but argument 2 has
>> type 'uint64_t {aka long long unsigned int}' [-Werror=format=]
>> !SYM_RESOLVE(KernBase, &pdb, KdVersionBlock)) {
>> ^
>> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:44:17: note: in
>> definition of macro 'SYM_RESOLVE'
>> s ? printf(#s" = 0x%016lx\n", s) : eprintf("Failed to resolve "#s"\n"), s)
>> ^
>> /home/peter.maydell/qemu/contrib/elf2dmp/pdb.c: In function
>> 'pdb_find_public_v3_symbol':
>> /home/peter.maydell/qemu/contrib/elf2dmp/pdb.c:69:20: error: format
>> '%lx' expects argument of type 'long unsigned int', but argument 7 has
>> type 'uint64_t {aka long long unsigned int}' [-Werror=format=]
>> printf("%s: 0x%016x(%d:\'%.8s\') + 0x%08x = 0x%09lx\n", name,
>> ^
>>
>>
>> Compile failure, FreeBSD:
>>
>> backends/hostmem-file.c:61:5: error: use of undeclared identifier 'path'
>> path = object_get_canonical_path(OBJECT(backend));
>> ^
>> backends/hostmem-file.c:63:38: error: use of undeclared identifier 'path'
>> path,
>> ^
>> backends/hostmem-file.c:68:12: error: use of undeclared identifier 'path'
>> g_free(path);
>> ^
>>
>> (The variable declaration is in #ifdef CONFIG_LINUX, but the use is
>> guarded by CONFIG_POSIX.)
>>
>>
>> Compile failure, OpenBSD and OSX:
>> In file included from contrib/elf2dmp/addrspace.h:11:0,
>> from contrib/elf2dmp/main.c:10:
>> contrib/elf2dmp/qemu_elf.h:12:17: fatal error: elf.h: No such file or directory
>> #include <elf.h>
>> ^
>>
>> and a format-descriptor issue not in the 32-bit host lot above:
>> contrib/elf2dmp/pdb.c: In function 'pdb_find_public_v3_symbol':
>> contrib/elf2dmp/pdb.c:71:21: warning: format '%lx' expects argument of
>> type 'long unsigned int', but argument 7 has type 'uint64_t'
>> [-Wformat=]
>> ((char *)segment - 8), sym->public_v3.offset, rva);
>
> I think PATCH 15/15 should be "$mingw32" = "yes" as the intend of the tool
> is to convert ELF dump to Windows MEMORY.DMP:
No, the tool can be run on POSIX systems, the ones where you get the ELF
dump, and produces a MEMORY.DMP that you can load in windbg, so
mingw32=no is correct; it simply hasn't been ported to Windows yet.
Anyway the fix can wait for 3.2, I'll just drop the patch.
Paolo
> commit 3fa2d384c245bcee3a9ecfa11f298b76ea4c9d57
> Author: Viktor Prutyanov <viktor.prutyanov@virtuozzo.com>
> Date: Wed Aug 29 15:41:25 2018 +0300
>
> contrib: add elf2dmp tool
>
> elf2dmp is a converter from ELF dump (produced by 'dump-guest-memory') to
> Windows MEMORY.DMP format (also know as 'Complete Memory Dump') which can be
> opened in WinDbg.
>
> This tool can help if VMCoreInfo device/driver is absent in Windows VM and
> 'dump-guest-memory -w' is not available but dump can be created in ELF format.
>
> The tool works as follows:
> 1. Determine the system paging root looking at GS_BASE or KERNEL_GS_BASE
> to locate the PRCB structure and finds the kernel CR3 nearby if QEMU CPU
> state CR3 is not suitable.
> 2. Find an address within the kernel image by dereferencing the first
> IDT entry and scans virtual memory upwards until the start of the
> kernel.
> 3. Download a PDB matching the kernel from the Microsoft symbol store,
> and figure out the layout of certain relevant structures necessary for
> the dump.
> 4. Populate the corresponding structures in the memory image and create
> the appropriate dump header.
>
>
next prev parent reply other threads:[~2018-11-27 15:59 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-27 14:36 [Qemu-devel] [PULL v2 00/15] Misc patches for QEMU 3.1-rc3 Paolo Bonzini
2018-11-27 14:36 ` [Qemu-devel] [PULL 01/15] target/i386: kvm: add VMX migration blocker Paolo Bonzini
2018-11-27 14:36 ` [Qemu-devel] [PULL 02/15] cpus: run work items for all vCPUs if single-threaded Paolo Bonzini
2018-11-27 14:36 ` [Qemu-devel] [PULL 03/15] lsi: Reselection needed to remove pending commands from queue Paolo Bonzini
2018-11-27 14:36 ` [Qemu-devel] [PULL 04/15] migration: savevm: consult migration blockers Paolo Bonzini
2018-11-27 14:36 ` [Qemu-devel] [PULL 05/15] vmstate: constify VMStateField Paolo Bonzini
2018-11-27 14:36 ` [Qemu-devel] [PULL 06/15] vl: Improve error message when we can't load fw_cfg from file Paolo Bonzini
2018-11-27 14:36 ` [Qemu-devel] [PULL 07/15] vhost-user-bridge: fix recvmsg iovlen Paolo Bonzini
2018-11-27 14:36 ` [Qemu-devel] [PULL 08/15] vl.c: remove outdated comment Paolo Bonzini
2018-11-27 14:36 ` [Qemu-devel] [PULL 09/15] checkpatch: g_test_message does not need a trailing newline Paolo Bonzini
2018-11-27 14:36 ` [Qemu-devel] [PULL 10/15] target/i386: Generate #UD when applying LOCK to a register destination Paolo Bonzini
2018-11-27 14:36 ` [Qemu-devel] [PULL 11/15] MAINTAINERS: Add some missing entries related to accelerators Paolo Bonzini
2018-11-27 14:36 ` [Qemu-devel] [PULL 12/15] MAINTAINERS: Add an entry for the Firmware Configuration (fw_cfg) device Paolo Bonzini
2018-11-27 14:36 ` [Qemu-devel] [PULL 13/15] configure: fix elf2dmp check Paolo Bonzini
2018-11-27 14:36 ` [Qemu-devel] [PULL 14/15] hostmem-memfd: honour share=on/off property Paolo Bonzini
2018-11-27 14:36 ` [Qemu-devel] [PULL 15/15] hostmem: no need to check for host_memory_backend_mr_inited() in alloc() Paolo Bonzini
2018-11-27 15:43 ` [Qemu-devel] [PULL v2 00/15] Misc patches for QEMU 3.1-rc3 Peter Maydell
2018-11-27 15:47 ` Laurent Vivier
2018-11-27 15:59 ` Paolo Bonzini [this message]
2018-11-27 18:36 ` Peter Maydell
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=f0d29af6-0f92-01b9-b7c3-d7e7357d6514@redhat.com \
--to=pbonzini@redhat.com \
--cc=laurent@vivier.eu \
--cc=peter.maydell@linaro.org \
--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).