[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 11/60] linux-user/elfload: Write process memory to core file in l
From: |
Richard Henderson |
Subject: |
[PATCH 11/60] linux-user/elfload: Write process memory to core file in larger chunks |
Date: |
Fri, 1 Mar 2024 13:05:30 -1000 |
We do not need to copy pages from guest memory before writing
them out. Because vmas are contiguous in host memory, we can
write them in one go.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
linux-user/elfload.c | 27 ++++-----------------------
1 file changed, 4 insertions(+), 23 deletions(-)
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index b8d07d8054..491e754f72 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -4551,32 +4551,13 @@ static int elf_core_dump(int signr, const CPUArchState
*env)
}
/*
- * Finally we can dump process memory into corefile as well.
+ * Finally write process memory into the corefile as well.
*/
for (vma = vma_first(&mm); vma != NULL; vma = vma_next(vma)) {
- abi_ulong addr;
- abi_ulong end;
+ size_t size = vma_dump_size(vma);
- end = vma->vma_start + vma_dump_size(vma);
-
- for (addr = vma->vma_start; addr < end;
- addr += TARGET_PAGE_SIZE) {
- char page[TARGET_PAGE_SIZE];
- int error;
-
- /*
- * Read in page from target process memory and
- * write it to coredump file.
- */
- error = copy_from_user(page, addr, sizeof (page));
- if (error != 0) {
- (void) fprintf(stderr, "unable to dump " TARGET_ABI_FMT_lx
"\n",
- addr);
- errno = -error;
- goto out;
- }
- if (dump_write(fd, page, TARGET_PAGE_SIZE) < 0)
- goto out;
+ if (size && dump_write(fd, g2h_untagged(vma->vma_start), size) < 0) {
+ goto out;
}
}
errno = 0;
--
2.34.1
- [PATCH 00/60] linux-user and tcg patch queue, Richard Henderson, 2024/03/01
- [PATCH 01/60] linux-user/elfload: Disable core dump if getrlimit fails, Richard Henderson, 2024/03/01
- [PATCH 02/60] linux-user/elfload: Merge init_note_info and fill_note_info, Richard Henderson, 2024/03/01
- [PATCH 03/60] linux-user/elfload: Tidy fill_note_info and struct elf_note_info, Richard Henderson, 2024/03/01
- [PATCH 04/60] linux-user/elfload: Stack allocate struct mm_struct, Richard Henderson, 2024/03/01
- [PATCH 05/60] linux-user/elfload: Latch errno before cleanup in elf_core_dump, Richard Henderson, 2024/03/01
- [PATCH 08/60] linux-user/elfload: Lock cpu list and mmap during elf_core_dump, Richard Henderson, 2024/03/01
- [PATCH 11/60] linux-user/elfload: Write process memory to core file in larger chunks,
Richard Henderson <=
- [PATCH 13/60] linux-user/elfload: Rely on walk_memory_regions for vmas, Richard Henderson, 2024/03/01
- [PATCH 15/60] tcg/aarch64: Apple does not align __int128_t in even registers, Richard Henderson, 2024/03/01
- [PATCH 16/60] accel/tcg: Set can_do_io at at start of lookup_tb_ptr helper, Richard Henderson, 2024/03/01
- [PATCH 06/60] linux-user/elfload: Open core file after vma_init, Richard Henderson, 2024/03/01
- [PATCH 09/60] linux-user/elfload: Size corefile before opening, Richard Henderson, 2024/03/01
- [PATCH 14/60] linux-user/elfload: Unprotect regions before core dump, Richard Henderson, 2024/03/01
- [PATCH 25/60] linux-user: Remove qemu_host_page_size from elf_core_dump, Richard Henderson, 2024/03/01
- [PATCH 19/60] linux-user: Adjust SVr4 NULL page mapping, Richard Henderson, 2024/03/01
- [PATCH 12/60] linux-user/elfload: Simplify vma_dump_size, Richard Henderson, 2024/03/01
- [PATCH 18/60] accel/tcg: Remove qemu_host_page_size from page_protect/page_unprotect, Richard Henderson, 2024/03/01