aboutsummaryrefslogtreecommitdiff
path: root/contrib/elf2dmp
AgeCommit message (Collapse)Author
2024-03-11contrib/elf2dmp: Ensure phdrs fit in fileAkihiko Odaki
Callers of elf64_getphdr() and elf_getphdrnum() assume phdrs are accessible. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2202 Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Tested-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 20240307-elf2dmp-v4-19-4f324ad4d99d@daynix.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2024-03-11contrib/elf2dmp: Clamp QEMU note to file sizeAkihiko Odaki
This fixes crashes with truncated dumps. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Tested-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu> Message-id: 20240307-elf2dmp-v4-18-4f324ad4d99d@daynix.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2024-03-11contrib/elf2dmp: Use GPtrArrayAkihiko Odaki
This removes the need to enumarate QEMUCPUState twice and saves code. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Tested-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu> Message-id: 20240307-elf2dmp-v4-17-4f324ad4d99d@daynix.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2024-03-11contrib/elf2dmp: Use rol64() to decodeAkihiko Odaki
rol64() is roubust against too large shift values and fixes UBSan warnings. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Tested-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-id: 20240307-elf2dmp-v4-14-4f324ad4d99d@daynix.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2024-03-11contrib/elf2dmp: Use lduw_le_p() to read PDBAkihiko Odaki
The relevant value may be unaligned and is little-endian. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Tested-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-id: 20240307-elf2dmp-v4-13-4f324ad4d99d@daynix.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2024-03-11contrib/elf2dmp: Ensure segment fits in fileAkihiko Odaki
This makes elf2dmp more robust against corrupted inputs. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Tested-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu> Message-id: 20240307-elf2dmp-v4-12-4f324ad4d99d@daynix.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2024-03-11contrib/elf2dmp: Always destroy PA spaceAkihiko Odaki
Destroy PA space even if paging base couldn't be found, fixing memory leak. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Tested-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu> Message-id: 20240307-elf2dmp-v4-11-4f324ad4d99d@daynix.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2024-03-11contrib/elf2dmp: Always check for PA resolution failureAkihiko Odaki
Not checking PA resolution failure can result in NULL deference. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Tested-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu> Message-id: 20240307-elf2dmp-v4-10-4f324ad4d99d@daynix.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2024-03-11contrib/elf2dmp: Fix error reporting style in main.cAkihiko Odaki
include/qapi/error.h says: > We recommend > * bool-valued functions return true on success / false on failure, > ... Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Tested-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 20240307-elf2dmp-v4-9-4f324ad4d99d@daynix.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2024-03-11contrib/elf2dmp: Fix error reporting style in qemu_elf.cAkihiko Odaki
include/qapi/error.h says: > We recommend > * bool-valued functions return true on success / false on failure, > ... Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Tested-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 20240307-elf2dmp-v4-8-4f324ad4d99d@daynix.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2024-03-11contrib/elf2dmp: Fix error reporting style in pdb.cAkihiko Odaki
include/qapi/error.h says: > We recommend > * bool-valued functions return true on success / false on failure, > ... Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Tested-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 20240307-elf2dmp-v4-7-4f324ad4d99d@daynix.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2024-03-11contrib/elf2dmp: Fix error reporting style in download.cAkihiko Odaki
include/qapi/error.h says: > We recommend > * bool-valued functions return true on success / false on failure, > ... Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Tested-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 20240307-elf2dmp-v4-6-4f324ad4d99d@daynix.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2024-03-11contrib/elf2dmp: Fix error reporting style in addrspace.cAkihiko Odaki
include/qapi/error.h says: > We recommend > * bool-valued functions return true on success / false on failure, > ... Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Tested-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-id: 20240307-elf2dmp-v4-5-4f324ad4d99d@daynix.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2024-03-11contrib/elf2dmp: Change pa_space_create() signatureAkihiko Odaki
pa_space_create() used to return an integer to propagate error, but it never fails so let it return void. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Tested-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-id: 20240307-elf2dmp-v4-4-4f324ad4d99d@daynix.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2024-03-11contrib/elf2dmp: Continue even contexts are lackingAkihiko Odaki
Let fill_context() continue even if it fails to fill contexts of some CPUs. A dump may still contain valuable information even if it lacks contexts of some CPUs due to dump corruption or a failure before starting CPUs. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Tested-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu> Message-id: 20240307-elf2dmp-v4-3-4f324ad4d99d@daynix.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2024-03-11contrib/elf2dmp: Assume error by defaultAkihiko Odaki
A common construct in contrib/elf2dmp is to set "err" flag and goto in error paths. In such a construct, there is only one successful path while there are several error paths, so it will be more simpler to initialize "err" flag set, and clear it in the successful path. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Tested-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu> Message-id: 20240307-elf2dmp-v4-2-4f324ad4d99d@daynix.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2024-03-11contrib/elf2dmp: Remove unnecessary err flagsAkihiko Odaki
They are always evaluated to 1. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Tested-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu> Message-id: 20240307-elf2dmp-v4-1-4f324ad4d99d@daynix.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2023-10-19contrib/elf2dmp: Use g_malloc(), g_new() and g_free()Suraj Shirvankar
QEMU coding style uses the glib memory allocation APIs, not the raw libc malloc/free. Switch the allocation and free calls in elf2dmp to use these functions (dropping the now-unneeded checks for failure). Signed-off-by: Suraj Shirvankar <surajshirvankar@gmail.com> Message-id: 169753938460.23804.11418813007617535750-1@git.sr.ht [PMM: also remove NULL checks from g_malloc() calls; beef up commit message] Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2023-10-19elf2dmp: check array bounds in pdb_get_file_sizeViktor Prutyanov
Index in file_size array must be checked against num_files, because the entries we are looking for may be absent in the PDB. Fixes: Coverity CID 1521597 Signed-off-by: Viktor Prutyanov <viktor@daynix.com> Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-id: 20230930235317.11469-3-viktor@daynix.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2023-10-19elf2dmp: limit print length for sign_rsdsViktor Prutyanov
String sign_rsds isn't terminated, so the print length must be limited. Fixes: Coverity CID 1521598 Signed-off-by: Viktor Prutyanov <viktor@daynix.com> Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com> Message-id: 20230930235317.11469-2-viktor@daynix.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2023-09-21elf2dmp: rework PDB_STREAM_INDEXES::segments obtainingViktor Prutyanov
PDB for Windows 11 kernel has slightly different structure compared to previous versions. Since elf2dmp don't use the other fields, copy only 'segments' field from PDB_STREAM_INDEXES. Signed-off-by: Viktor Prutyanov <viktor@daynix.com> Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com> Message-id: 20230915170153.10959-6-viktor@daynix.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2023-09-21elf2dmp: use Linux mmap with MAP_NORESERVE when possibleViktor Prutyanov
Glib's g_mapped_file_new maps file with PROT_READ|PROT_WRITE and MAP_PRIVATE. This leads to premature physical memory allocation of dump file size on Linux hosts and may fail. On Linux, mapping the file with MAP_NORESERVE limits the allocation by available memory. Signed-off-by: Viktor Prutyanov <viktor@daynix.com> Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com> Message-id: 20230915170153.10959-5-viktor@daynix.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2023-09-21elf2dmp: introduce merging of physical memory runsViktor Prutyanov
DMP supports 42 physical memory runs at most. So, merge adjacent physical memory ranges from QEMU ELF when possible to minimize total number of runs. Signed-off-by: Viktor Prutyanov <viktor@daynix.com> Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com> Message-id: 20230915170153.10959-4-viktor@daynix.com [PMM: fixed format string for printing size_t values] Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2023-09-21elf2dmp: introduce physical block alignmentViktor Prutyanov
Physical memory ranges may not be aligned to page size in QEMU ELF, but DMP can only contain page-aligned runs. So, align them. Signed-off-by: Viktor Prutyanov <viktor@daynix.com> Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com> Message-id: 20230915170153.10959-3-viktor@daynix.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2023-09-21elf2dmp: replace PE export name check with PDB name checkViktor Prutyanov
PE export name check introduced in d399d6b179 isn't reliable enough, because a page with the export directory may be not present for some reason. On the other hand, elf2dmp retrieves the PDB name in any case. It can be also used to check that a PE image is the kernel image. So, check PDB name when searching for Windows kernel image. Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=2165917 Signed-off-by: Viktor Prutyanov <viktor@daynix.com> Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com> Message-id: 20230915170153.10959-2-viktor@daynix.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2023-07-31elf2dmp: Don't abandon when Prcb is set to 0Akihiko Odaki
Prcb may be set to 0 for some CPUs if the dump was taken before they start. The dump may still contain valuable information for started CPUs so don't abandon conversion in such a case. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Reviewed-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu> Message-id: 20230611033434.14659-1-akihiko.odaki@daynix.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2023-03-21contrib/elf2dmp: add PE name check and Windows Server 2022 supportViktor Prutyanov
Since its inception elf2dmp has checked MZ signatures within an address space above IDT[0] interrupt vector and took first PE image found as Windows Kernel. But in Windows Server 2022 memory dump this address space range is full of invalid PE fragments and the tool must check that PE image is 'ntoskrnl.exe' actually. So, introduce additional validation by checking image name from Export Directory against 'ntoskrnl.exe'. Signed-off-by: Viktor Prutyanov <viktor@daynix.com> Tested-by: Yuri Benditovich <yuri.benditovich@daynix.com> Reviewed-by: Annie Li <annie.li@oracle.com> Message-id: 20230222211246.883679-4-viktor@daynix.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2023-03-21contrib/elf2dmp: move PE dir search to pe_get_data_dir_entryViktor Prutyanov
Move out PE directory search functionality to be reused not only for Debug Directory processing but for arbitrary PE directory. Signed-off-by: Viktor Prutyanov <viktor@daynix.com> Reviewed-by: Annie Li <annie.li@oracle.com> Message-id: 20230222211246.883679-3-viktor@daynix.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2023-03-21contrib/elf2dmp: fix code styleViktor Prutyanov
Originally elf2dmp were added with some code style issues, especially in pe.h header, and some were introduced by 2d0fc797faaa73fbc1d30f5f9e90407bf3dd93f0. Fix them now. Signed-off-by: Viktor Prutyanov <viktor@daynix.com> Reviewed-by: Annie Li <annie.li@oracle.com> Message-id: 20230222211246.883679-2-viktor@daynix.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2022-10-22elf2dmp: free memory in failurelu zhipeng
The 'kdgb' is allocating memory in get_kdbg(), but it is not freed in error path. So fix that. Signed-off-by: lu zhipeng <luzhipeng@cestc.cn> Reviewed-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-Id: <20221007020128.760-1-luzhipeng@cestc.cn> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2022-05-25contrib/elf2dmp: add ELF dump header checkingViktor Prutyanov
Add ELF header checking to prevent processing input file which is not QEMU x86_64 guest memory dump or even not ELF. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1013 Signed-off-by: Viktor Prutyanov <viktor.prutyanov@redhat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20220520084339.171684-1-viktor.prutyanov@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2022-04-22include/qemu: rename Windows context definitions to expose bitnessViktor Prutyanov
Context structure in 64-bit Windows differs from 32-bit one and it should be reflected in its name. Signed-off-by: Viktor Prutyanov <viktor.prutyanov@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220406171558.199263-2-viktor.prutyanov@redhat.com>
2022-01-12meson: build contrib/ executables after generated headersPaolo Bonzini
This will be needed as soon as config-poison.h moves from configure to a meson custom_target (which is built at "ninja" time). Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-09-20elf2dmp: Fail cleanly if PDB file specifies zero block_sizePeter Maydell
Coverity points out that if the PDB file we're trying to read has a header specifying a block_size of zero then we will end up trying to divide by zero in pdb_ds_read_file(). Check for this and fail cleanly instead. Fixes: Coverity CID 1458869 Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Tested-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu> Message-id: 20210910170656.366592-3-philmd@redhat.com Message-Id: <20210901143910.17112-3-peter.maydell@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2021-09-20elf2dmp: Check curl_easy_setopt() return valuePeter Maydell
Coverity points out that we aren't checking the return value from curl_easy_setopt(). Fixes: Coverity CID 1458895 Inspired-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu> Tested-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu> Message-id: 20210910170656.366592-2-philmd@redhat.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2021-01-20elf2dmp: Rename PAGE_SIZE to ELF2DMP_PAGE_SIZEJiaxun Yang
As per POSIX specification of limits.h [1], OS libc may define PAGE_SIZE in limits.h. To prevent collosion of definition, we rename PAGE_SIZE here. [1]: https://pubs.opengroup.org/onlinepubs/7908799/xsh/limits.h.html Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20210118063808.12471-6-jiaxun.yang@flygoat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2021-01-02curl: convert to mesonPaolo Bonzini
Reviewed-by: Daniel Berrangé <berrange@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-12-13elf2dmp/pdb: Plug memleak in pdb_init_from_filePan Nengyuan
Missing g_error_free in pdb_init_from_file() error path. Fix that. Reported-by: Euler Robot <euler.robot@huawei.com> Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com> Reviewed-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu> Reviewed-by: Li Qiang <liq3ea@gmail.com> Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-Id: <20201023061218.2080844-5-kuhn.chenqun@huawei.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2020-12-13elf2dmp/qemu_elf: Plug memleak in QEMU_Elf_initPan Nengyuan
Missing g_error_free in QEMU_Elf_init() error path. Fix that. Reported-by: Euler Robot <euler.robot@huawei.com> Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com> Reviewed-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu> Reviewed-by: Li Qiang <liq3ea@gmail.com> Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-Id: <20201023061218.2080844-4-kuhn.chenqun@huawei.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2020-10-27elf2dmp: Fix memory leak on main() error pathsAlexChen
The 'kdgb' is allocating memory in get_kdbg(), but it is not freed in both fill_header() and fill_context() failed branches, fix it. Signed-off-by: AlexChen <alex.chen@huawei.com> Reviewed-by: Li Qiang <liq3ea@gmail.com> Reviewed-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-Id: <5F463659.8080101@huawei.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2020-08-21contrib/elf2dmp: convert to mesonMarc-André Lureau
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-07-22contrib/elf2dmp: Build download.o with CURL_CFLAGSPeter Maydell
contrib/elf2dmp has a source file which uses curl/curl.h; although we link the final executable with CURL_LIBS, we forgot to build this source file with CURL_CFLAGS, so if the curl header is in a place that's not already on the system include path then it will fail to build. Add a line specifying the cflags needed for download.o; while we are here, bring the specification of the libs into line with this, since using a per-object variable setting is preferred over adding them to the final executable link line. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-id: 20190719100955.17180-1-peter.maydell@linaro.org
2019-06-12Clean up a few header guard symbolsMarkus Armbruster
Commit 58ea30f5145 "Clean up header guards that don't match their file name" messed up contrib/elf2dmp/qemu_elf.h and tests/migration/migration-test.h. It missed target/cris/opcode-cris.h and tests/uefi-test-tools/UefiTestToolsPkg/Include/Guid/BiosTablesTest.h due to the scripts/clean-header-guards.pl bug fixed in the previous commit. Commit a8b991b52dc "Clean up ill-advised or unusual header guards" missed include/hw/xen/io/ring.h for the same reason. Commit 3979fca4b69 "disas: Rename include/disas/bfd.h back to include/disas/dis-asm.h" neglected to update the guard symbol for the rename. Commit a331c6d7741 "semihosting: implement a semihosting console" created include/hw/semihosting/console.h with an ill-advised guard symbol. Clean them up. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20190604181618.19980-4-armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2019-05-13Clean up header guards that don't match their file nameMarkus Armbruster
Header guard symbols should match their file name to make guard collisions less likely. Cleaned up with scripts/clean-header-guards.pl, followed by some renaming of new guard symbols picked by the script to better ones. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20190315145123.28030-6-armbru@redhat.com> [Rebase to master: update include/hw/net/ne2000-isa.h]
2019-05-13Clean up includesMarkus Armbruster
Clean up includes so that osdep.h is included first and headers which it implies are not included manually. This commit was created with scripts/clean-includes, with the changes to the following files manually reverted: contrib/libvhost-user/libvhost-user-glib.h contrib/libvhost-user/libvhost-user.c contrib/libvhost-user/libvhost-user.h linux-user/mips64/cpu_loop.c linux-user/mips64/signal.c linux-user/sparc64/cpu_loop.c linux-user/sparc64/signal.c linux-user/x86_64/cpu_loop.c linux-user/x86_64/signal.c slirp/src/* target/s390x/gen-features.c tests/fp/platform.h tests/migration/s390x/a-b-bios.c tests/test-rcu-simpleq.c tests/test-rcu-tailq.c tests/uefi-test-tools/UefiTestToolsPkg/BiosTablesTest/BiosTablesTest.c We're in the process of spinning out slirp/. tests/fp/platform.h is has to include qemu/osdep.h because tests/fp/berkeley-softfloat-3/ and tests/fp/berkeley-testfloat-3/ don't. tests/uefi-test-tools/ is guest software. The remaining reverts are the same as in commit b7d89466dde. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20190313162812.8885-1-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> [Revert change to tests/fp/platform.h, adjust commit message]
2019-03-11contrib/elf2dmp: add kernel start address checkingViktor Prutyanov
Before this patch, if elf2dmp failed to find NT kernel PE magic in allowed virtual address range, then it assumes NULL as NT kernel address and cause segfault. This patch fix the problem described above by checking NT kernel address before futher processing. Signed-off-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu> Message-Id: <20190219211936.6466-1-viktor.prutyanov@phystech.edu> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-02-05contrib/elf2dmp: fix printf formatViktor Prutyanov
Format strings for printf are changed for successful build for Windows hosts. Signed-off-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu> Message-Id: <20181220012441.13694-6-viktor.prutyanov@phystech.edu> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-02-05contrib/elf2dmp: fix structures definitionsViktor Prutyanov
Remove duplicate structures definitions in case of build for Windows hosts. Signed-off-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu> Message-Id: <20181220012441.13694-5-viktor.prutyanov@phystech.edu> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-02-05contrib/elf2dmp: use GLib in PDB processingViktor Prutyanov
Replace POSIX mmap with GLib g_mapped_file_new in PDB processing stage to make elf2dmp cross-platform. There are no direct POSIX in elf2dmp after this patch. Signed-off-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu> Message-Id: <20181220012441.13694-4-viktor.prutyanov@phystech.edu> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-02-05contrib/elf2dmp: use GLib in ELF processingViktor Prutyanov
Replace POSIX mmap with GLib g_mapped_file_new in ELF processing module to make elf2dmp cross-platform. Signed-off-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu> Message-Id: <20181220012441.13694-3-viktor.prutyanov@phystech.edu> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>