- Aug 07, 2023
-
-
Dongli Zhang authored
The kdump-zlib data pages are not dumped from aarch64 host when the 'pvtime' is involved, that is, when the block->target_end is not aligned to page_size. In the below example, it is expected to dump two blocks. (qemu) info mtree -f ... ... 00000000090a0000-00000000090a0fff (prio 0, ram): pvtime KVM ... ... 0000000040000000-00000001bfffffff (prio 0, ram): mach-virt.ram KVM ... ... However, there is an issue with get_next_page() so that the pages for "mach-virt.ram" will not be dumped. At line 1296, although we have reached at the end of the 'pvtime' block, since it is not aligned to the page_size (e.g., 0x10000), it will not break at line 1298. 1255 static bool get_next_page(GuestPhysBlock **blockptr, uint64_t *pfnptr, 1256 uint8_t **bufptr, DumpState *s) ... ... 1294 memcpy(buf + addr % page_size, hbuf, n); 1295 addr += n; 1296 if (addr % page_size == 0) { 1297 /* we filled up the page */ 1298 break; 1299 } As a result, get_next_page() will continue to the next block ("mach-virt.ram"). Finally, when get_next_page() returns to the caller: - 'pfnptr' is referring to the 'pvtime' - but 'blockptr' is referring to the "mach-virt.ram" When get_next_page() is called the next time, "*pfnptr += 1" still refers to the prior 'pvtime'. It will exit immediately because it is out of the range of the current "mach-virt.ram". The fix is to break when it is time to come to the next block, so that both 'pfnptr' and 'blockptr' refer to the same block. Fixes: 94d78840 ("dump: fix kdump to work over non-aligned blocks") Cc: Joe Jin <joe.jin@oracle.com> Signed-off-by:
Dongli Zhang <dongli.zhang@oracle.com> Reviewed-by:
Marc-André Lureau <marcandre.lureau@redhat.com> Message-ID: <20230713055819.30497-1-dongli.zhang@oracle.com>
-
- Jun 20, 2023
-
-
Philippe Mathieu-Daudé authored
We use the user_ss[] array to hold the user emulation sources, and the softmmu_ss[] array to hold the system emulation ones. Hold the latter in the 'system_ss[]' array for parity with user emulation. Mechanical change doing: $ sed -i -e s/softmmu_ss/system_ss/g $(git grep -l softmmu_ss) Signed-off-by:
Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230613133347.82210-10-philmd@linaro.org> Signed-off-by:
Richard Henderson <richard.henderson@linaro.org>
-
Philippe Mathieu-Daudé authored
Since we *might* have user emulation with softmmu, use the clearer 'CONFIG_SYSTEM_ONLY' key to check for system emulation. Signed-off-by:
Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230613133347.82210-9-philmd@linaro.org> Signed-off-by:
Richard Henderson <richard.henderson@linaro.org>
-
- Mar 22, 2023
-
-
Richard Henderson authored
This had been pulled in via qemu/plugin.h from hw/core/cpu.h, but that will be removed. Signed-off-by:
Richard Henderson <richard.henderson@linaro.org> Reviewed-by:
Philippe Mathieu-Daudé <philmd@linaro.org> Message-Id: <20230310195252.210956-5-richard.henderson@linaro.org> [AJB: add various additional cases shown by CI] Signed-off-by:
Alex Bennée <alex.bennee@linaro.org> Message-Id: <20230315174331.2959-15-alex.bennee@linaro.org> Reviewed-by:
Emilio Cota <cota@braap.org>
-
- Feb 27, 2023
-
-
Philippe Mathieu-Daudé authored
Implement the non-x86 create_win_dump(). We can remove the last TARGET_X86_64 #ifdef'ry in dump.c, which thus becomes target-independent. Update meson accordingly. Reviewed-by:
Richard Henderson <richard.henderson@linaro.org> Reviewed-by:
Thomas Huth <thuth@redhat.com> Signed-off-by:
Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by:
Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20230225094903.53167-6-philmd@linaro.org>
-
Philippe Mathieu-Daudé authored
To make dump.c less target dependent, move the TARGET_X86_64 #ifdef'ry from dump.c to win_dump.c (introducing a win_dump_available() method there). By doing so we can build win_dump.c on any target, and simplify the meson rule. Reviewed-by:
Richard Henderson <richard.henderson@linaro.org> Reviewed-by:
Thomas Huth <thuth@redhat.com> Signed-off-by:
Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by:
Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20230225094903.53167-5-philmd@linaro.org>
-
Philippe Mathieu-Daudé authored
"qemu/win_dump_defs.h" is only required by win_dump.c, but win_dump.h requires "sysemu/dump.h" which declares the DumpState type. Remove various unused headers. Reviewed-by:
Richard Henderson <richard.henderson@linaro.org> Reviewed-by:
Thomas Huth <thuth@redhat.com> Signed-off-by:
Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by:
Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20230225094903.53167-4-philmd@linaro.org>
-
Philippe Mathieu-Daudé authored
TARGET_PAGE_SIZE is target specific. In preparation of making dump.c target-agnostic, replace the compile-time TARGET_PAGE_SIZE definition by runtime qemu_target_page_size(). Signed-off-by:
Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org> Reviewed-by:
Thomas Huth <thuth@redhat.com> Reviewed-by:
Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20230225094903.53167-3-philmd@linaro.org>
-
Philippe Mathieu-Daudé authored
All uses of tswap in that file are wrong, and should be using cpu_to_dumpN, which correctly tests the endianness of the output. Reported-by:
Richard Henderson <richard.henderson@linaro.org> Suggested-by:
Richard Henderson <richard.henderson@linaro.org> Signed-off-by:
Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org> Reviewed-by:
Thomas Huth <thuth@redhat.com> Reviewed-by:
Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20230225094903.53167-2-philmd@linaro.org>
-
- Feb 23, 2023
-
-
Markus Armbruster authored
The only way cpu_get_note_size() can return a negative value is integer overflow in the non-stub versions, which is a programming error. The stub version is not actually reachable, because the cpu_get_dump_info() stub will fail first. Use assert(). This gets rid of another use of QERR_UNSUPPORTED. Signed-off-by:
Markus Armbruster <armbru@redhat.com> Message-Id: <20230207075115.1525-4-armbru@redhat.com> Reviewed-by:
Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by:
Juan Quintela <quintela@redhat.com>
-
Markus Armbruster authored
The QERR_ macros are leftovers from the days of "rich" error objects. We've been trying to reduce their remaining use. Get rid of a use of QERR_UNSUPPORTED, and improve the rather vague error message (qemu) dump-guest-memory mumble Error: this feature or command is not currently supported to Error: dumping guest memory is not supported on this target Signed-off-by:
Markus Armbruster <armbru@redhat.com> Message-Id: <20230207075115.1525-3-armbru@redhat.com> Reviewed-by:
Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by:
Juan Quintela <quintela@redhat.com> [Error message tweaked]
-
- Dec 14, 2022
-
-
Markus Armbruster authored
The has_FOO for pointer-valued FOO are redundant, except for arrays. They are also a nuisance to work with. Recent commit "qapi: Start to elide redundant has_FOO in generated C" provided the means to elide them step by step. This is the step for qapi/dump.json. Said commit explains the transformation in more detail. The invariant violations mentioned there do not occur here. Cc: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by:
Markus Armbruster <armbru@redhat.com> Message-Id: <20221104160712.3005652-14-armbru@redhat.com> Reviewed-by:
Philippe Mathieu-Daudé <philmd@linaro.org>
-
Markus Armbruster authored
include/qapi/error.h on ERRP_GUARD(): * It must be used when the function dereferences @errp or passes * @errp to error_prepend(), error_vprepend(), or error_append_hint(). * It is safe to use even when it's not needed, but please avoid * cluttering the source with useless code. Clean up some of this clutter. Signed-off-by:
Markus Armbruster <armbru@redhat.com> Message-Id: <20221121085054.683122-3-armbru@redhat.com>
-
- Oct 26, 2022
-
-
Viktor Prutyanov authored
When number of CPUs utilized by guest Windows is less than defined in QEMU (i.e., desktop versions of Windows severely limits number of CPU sockets), patch_and_save_context routine accesses non-existent PRCB and fails. So, limit number of processed PRCBs by NumberProcessors taken from guest Windows driver. Signed-off-by:
Viktor Prutyanov <viktor.prutyanov@redhat.com> Reviewed-by:
Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20221019235948.656411-1-viktor.prutyanov@redhat.com>
-
Janosch Frank authored
Sometimes dumping a guest from the outside is the only way to get the data that is needed. This can be the case if a dumping mechanism like KDUMP hasn't been configured or data needs to be fetched at a specific point. Dumping a protected guest from the outside without help from fw/hw doesn't yield sufficient data to be useful. Hence we now introduce PV dump support. The PV dump support works by integrating the firmware into the dump process. New Ultravisor calls are used to initiate the dump process, dump cpu data, dump memory state and lastly complete the dump process. The UV calls are exposed by KVM via the new KVM_PV_DUMP command and its subcommands. The guest's data is fully encrypted and can only be decrypted by the entity that owns the customer communication key for the dumped guest. Also dumping needs to be allowed via a flag in the SE header. On the QEMU side of things we store the PV dump data in the newly introduced architecture ELF sections (storage state and completion data) and the cpu notes (for cpu dump data). Users can use the zgetdump tool to convert the encrypted QEMU dump to an unencrypted one. Signed-off-by:
Janosch Frank <frankja@linux.ibm.com> Reviewed-by:
Steffen Eiden <seiden@linux.ibm.com> Message-Id: <20221017083822.43118-11-frankja@linux.ibm.com>
-
- Oct 24, 2022
-
-
Janosch Frank authored
Add hooks which architectures can use to add arbitrary data to custom sections. Also add a section name string table in order to identify section contents Signed-off-by:
Janosch Frank <frankja@linux.ibm.com> Reviewed-by:
Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20221017113210.41674-1-frankja@linux.ibm.com>
-
Janosch Frank authored
section_offset will later be used to store the offset to the section data which will be stored last. For now memory_offset is only needed to make section_offset look nicer. Signed-off-by:
Janosch Frank <frankja@linux.ibm.com> Reviewed-by:
Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20221017083822.43118-5-frankja@linux.ibm.com>
-
Janosch Frank authored
Let's start bundling the writes of the headers and of the data so we have a clear ordering between them. Since the ELF header uses offsets to the headers we can freely order them. Signed-off-by:
Janosch Frank <frankja@linux.ibm.com> Reviewed-by:
Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20221017083822.43118-3-frankja@linux.ibm.com>
-
Janosch Frank authored
Currently we're writing the NULL section header if we overflow the physical header number in the ELF header. But in the future we'll add custom section headers AND section data. To facilitate this we need to rearange section handling a bit. As with the other ELF headers we split the code into a prepare and a write step. Signed-off-by:
Janosch Frank <frankja@linux.ibm.com> Reviewed-by:
Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20221017083822.43118-2-frankja@linux.ibm.com>
-
- Oct 06, 2022
-
-
Marc-André Lureau authored
Rewrite get_next_page() to work over non-aligned blocks. When it encounters non aligned addresses, it will try to fill a page provided by the caller. This solves a kdump crash with "tpm-crb-cmd" RAM memory region, qemu-kvm: ../dump/dump.c:1162: _Bool get_next_page(GuestPhysBlock **, uint64_t *, uint8_t **, DumpState *): Assertion `(block->target_start & ~target_page_mask) == 0' failed. because: guest_phys_block_add_section: target_start=00000000fed40080 target_end=00000000fed41000: added (count: 4) Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2120480 Signed-off-by:
Marc-André Lureau <marcandre.lureau@redhat.com> Acked-by:
David Hildenbrand <david@redhat.com>
-
Marc-André Lureau authored
This should be functionally equivalent, but slightly easier to read, with simplified paths and checks at the end of the function. The following patch is a major rewrite to get rid of the assert(). Signed-off-by:
Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by:
David Hildenbrand <david@redhat.com>
-
Janosch Frank authored
The functions in question do not actually write to the file descriptor they set up a buffer which is later written to the fd. Signed-off-by:
Janosch Frank <frankja@linux.ibm.com> Reviewed-by:
Janis Schoetterl-Glausch <scgl@linux.ibm.com> Reviewed-by:
Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220811121111.9878-9-frankja@linux.ibm.com>
-
Janosch Frank authored
Let's split the write from the modification of the elf header so we can consolidate the write of the data in one function. Signed-off-by:
Janosch Frank <frankja@linux.ibm.com> Reviewed-by:
Janis Schoetterl-Glausch <scgl@linux.ibm.com> Reviewed-by:
Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220811121111.9878-8-frankja@linux.ibm.com>
-
Janosch Frank authored
dump_calculate_size() sums up all the sizes of the guest memory blocks. Since we already have a function that calculates the size of a single memory block (dump_get_memblock_size()) we can simply iterate over the blocks and use the function instead of calculating the size ourselves. Signed-off-by:
Janosch Frank <frankja@linux.ibm.com> Reviewed-by:
Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by:
Janis Schoetterl-Glausch <scgl@linux.ibm.com> Message-Id: <20220811121111.9878-7-frankja@linux.ibm.com>
-
Janosch Frank authored
While the DumpState begin and length variables directly mirror the API variable names they are not very descriptive. So let's add a "filter_area_" prefix and make has_filter a function checking length > 0. Signed-off-by:
Janosch Frank <frankja@linux.ibm.com> Reviewed-by:
Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220811121111.9878-6-frankja@linux.ibm.com>
-
Janosch Frank authored
get_start_block() returns the start address of the first memory block or -1. With the GuestPhysBlock iterator conversion we don't need to set the start address and can therefore remove that code and the "start" DumpState struct member. The only functionality left is the validation of the start block so it only makes sense to re-name the function to validate_start_block() Signed-off-by:
Janosch Frank <frankja@linux.ibm.com> Reviewed-by:
Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by:
Janis Schoetterl-Glausch <scgl@linux.ibm.com> Message-Id: <20220811121111.9878-5-frankja@linux.ibm.com>
-
Janosch Frank authored
The iteration over the memblocks in dump_iterate() is hard to understand so it's about time to clean it up. Instead of manually grabbing the next memblock we can use QTAILQ_FOREACH to iterate over all memblocks. Additionally we move the calculation of the offset and length out by introducing and using the dump_filter_memblock_*() functions. These functions will later be used to cleanup other parts of dump.c. Signed-off-by:
Janosch Frank <frankja@linux.ibm.com> Reviewed-by:
Janis Schoetterl-Glausch <scgl@linux.ibm.com> Reviewed-by:
Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220811121111.9878-4-frankja@linux.ibm.com>
-
Janosch Frank authored
Let's make it a bit clearer that we write the program headers of the PT_LOAD type. Signed-off-by:
Janosch Frank <frankja@linux.ibm.com> Reviewed-by:
Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by:
Janis Schoetterl-Glausch <scgl@linux.ibm.com> Reviewed-by:
Steffen Eiden <seiden@ibm.linux.com> Message-Id: <20220811121111.9878-3-frankja@linux.ibm.com>
-
- Apr 22, 2022
-
-
Viktor Prutyanov authored
Before this patch, 'dump-guest-memory -w' was accepting only 64-bit dump header provided by guest through vmcoreinfo and thus was unable to produce 32-bit guest Windows dump. So, add 32-bit guest Windows dumping support. Signed-off-by:
Viktor Prutyanov <viktor.prutyanov@redhat.com> Reviewed-by:
Philippe Mathieu-Daudé <f4bug@amsat.org> [ misc error handling fixes to avoid compiler warning ] Reviewed-by:
Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220406171558.199263-5-viktor.prutyanov@redhat.com>
-
Viktor Prutyanov authored
Perform read access to Windows dump header fields via helper macros. This is preparation for the next 32-bit guest Windows dump support. Signed-off-by:
Viktor Prutyanov <viktor.prutyanov@redhat.com> Reviewed-by:
Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220406171558.199263-3-viktor.prutyanov@redhat.com>
-
Viktor Prutyanov authored
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>
-
Janosch Frank authored
Just like with the other write functions let's move the 32/64 bit elf handling to a function to improve readability. Signed-off-by:
Janosch Frank <frankja@linux.ibm.com> Reviewed-by:
Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220330123603.107120-10-frankja@linux.ibm.com>
-
Janosch Frank authored
There's no need to have a gigantic if in there let's move the elf 32/64 bit logic into the section, segment or note code. Signed-off-by:
Janosch Frank <frankja@linux.ibm.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org> Reviewed-by:
Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220330123603.107120-9-frankja@linux.ibm.com>
-
Janosch Frank authored
There's no need to have two write functions. Let's rather have two functions that set the data for elf 32/64 and then write it in a common function. Signed-off-by:
Janosch Frank <frankja@linux.ibm.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org> Reviewed-by:
Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220330123603.107120-8-frankja@linux.ibm.com>
-
Janosch Frank authored
Checking d_class in dump_info leads to lengthy conditionals so let's shorten things a bit by introducing a helper function. Signed-off-by:
Janosch Frank <frankja@linux.ibm.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org> Reviewed-by:
Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220330123603.107120-7-frankja@linux.ibm.com>
-
Janosch Frank authored
Offset calculations are easy enough to get wrong. Let's add a few variables to make moving around elf headers and data sections easier. Signed-off-by:
Janosch Frank <frankja@linux.ibm.com> Reviewed-by:
Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org> Message-Id: <20220330123603.107120-6-frankja@linux.ibm.com>
-
Janosch Frank authored
When s->shdr_num is 0 we'll add 0 bytes of section headers which is equivalent to not adding section headers but with the multiplication we can remove a if/else. Signed-off-by:
Janosch Frank <frankja@linux.ibm.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org> Reviewed-by:
Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220330123603.107120-5-frankja@linux.ibm.com>
-
Janosch Frank authored
Let's move from a boolean to a int variable which will later enable us to store the number of sections that are in the dump file. Signed-off-by:
Janosch Frank <frankja@linux.ibm.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org> Reviewed-by:
Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220330123603.107120-4-frankja@linux.ibm.com>
-
Janosch Frank authored
There's no need to have phdr_num and sh_info at the same time. We can make phdr_num 32 bit and set PN_XNUM when we write the header if phdr_num >= PN_XNUM. Signed-off-by:
Janosch Frank <frankja@linux.ibm.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org> Reviewed-by:
Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220407094824.5074-1-frankja@linux.ibm.com>
-
Janosch Frank authored
Let's move to the new way of handling errors before changing the dump code. This patch has mostly been generated by the coccinelle script scripts/coccinelle/errp-guard.cocci. Signed-off-by:
Janosch Frank <frankja@linux.ibm.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org> Reviewed-by:
Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220330123603.107120-2-frankja@linux.ibm.com>
-