qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PULL v2 00/15] Misc patches for QEMU 3.1-rc3


From: Laurent Vivier
Subject: Re: [Qemu-devel] [PULL v2 00/15] Misc patches for QEMU 3.1-rc3
Date: Tue, 27 Nov 2018 16:47:29 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0

On 27/11/2018 16:43, Peter Maydell wrote:
> On Tue, 27 Nov 2018 at 14:38, Paolo Bonzini <address@hidden> 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:

commit 3fa2d384c245bcee3a9ecfa11f298b76ea4c9d57
Author: Viktor Prutyanov <address@hidden>
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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]