[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 08/60] linux-user/elfload: Lock cpu list and mmap during elf_core
From: |
Richard Henderson |
Subject: |
[PATCH 08/60] linux-user/elfload: Lock cpu list and mmap during elf_core_dump |
Date: |
Fri, 1 Mar 2024 13:05:27 -1000 |
Do not allow changes to the set of cpus and memory regions
while we are dumping core.
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
linux-user/elfload.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 16dd08a828..6f9da721d7 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -4537,13 +4537,11 @@ static void fill_note_info(struct elf_note_info *info,
}
/* read and fill status of all threads */
- WITH_QEMU_LOCK_GUARD(&qemu_cpu_list_lock) {
- CPU_FOREACH(cpu) {
- if (cpu == thread_cpu) {
- continue;
- }
- fill_thread_info(info, cpu_env(cpu));
+ CPU_FOREACH(cpu) {
+ if (cpu == thread_cpu) {
+ continue;
}
+ fill_thread_info(info, cpu_env(cpu));
}
}
@@ -4643,6 +4641,9 @@ static int elf_core_dump(int signr, const CPUArchState
*env)
return 0;
}
+ cpu_list_lock();
+ mmap_lock();
+
/*
* Walk through target process memory mappings and
* set up structure containing this information. After
@@ -4760,6 +4761,8 @@ static int elf_core_dump(int signr, const CPUArchState
*env)
out:
ret = -errno;
+ mmap_unlock();
+ cpu_list_unlock();
free_note_info(&info);
vma_delete(&mm);
close(fd);
--
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 <=
- [PATCH 11/60] linux-user/elfload: Write process memory to core file in larger chunks, Richard Henderson, 2024/03/01
- [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