diff options
author | Richard Henderson <richard.henderson@linaro.org> | 2024-02-26 17:14:22 -1000 |
---|---|---|
committer | Richard Henderson <richard.henderson@linaro.org> | 2024-02-29 08:48:02 -1000 |
commit | b5262077655ab586d90f80a0f1b9a536bbc999ba (patch) | |
tree | bf18425edc4e70759fd6fd584c4eaac9439b7c00 /linux-user/elfload.c | |
parent | e0add9a835c6259df211eb4874d3d00d9d016796 (diff) | |
download | qemu-b5262077655ab586d90f80a0f1b9a536bbc999ba.zip qemu-b5262077655ab586d90f80a0f1b9a536bbc999ba.tar.gz qemu-b5262077655ab586d90f80a0f1b9a536bbc999ba.tar.bz2 |
linux-user/elfload: Lock cpu list and mmap during elf_core_dump
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>
Diffstat (limited to 'linux-user/elfload.c')
-rw-r--r-- | linux-user/elfload.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 16dd08a..6f9da72 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); |