xemu/softmmu
David Hildenbrand a8749d7cc9 memory: Make memory_region_readd_subregion() properly handle mapped aliases
memory_region_readd_subregion() wants to readd a region by first
removing it and then readding it. For readding, it doesn't use one of
the memory_region_add_*() variants, which is why fail to re-increment the
mr->mapped_via_alias counters, resulting in the
assert(alias->mapped_via_alias >= 0) in memory_region_del_subregion()
triggering the next time we call memory_region_readd_subregion().

Fix it by using memory_region_add_subregion_common() for readding the
region.

Reported-by: Niek Linnenbank <nieklinnenbank@gmail.com>
Fixes: 5ead62185d ("memory: Make memory_region_is_mapped() succeed when mapped via an alias")
Tested-by: Niek Linnenbank <nieklinnenbank@gmail.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Peter Xu <peterx@redhat.com>
Cc: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20220201100940.47788-1-david@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
2022-03-29 00:44:40 +02:00
..
arch_init.c softmmu: Add qemu_init_arch_modules() 2022-03-06 13:15:42 +01:00
balloon.c qapi: Restrict balloon-related commands to machine code 2020-09-29 15:41:35 +02:00
bootdevice.c Use g_new() & friends where that makes obvious sense 2022-03-21 15:44:44 +01:00
cpu-throttle.c cpu-throttle: Remove timer_mod() from cpu_throttle_set() 2021-02-08 15:15:32 +01:00
cpu-timers.c softmmu/cpu-timers: Remove unused 'exec/exec-all.h' header 2022-03-06 13:15:42 +01:00
cpus.c softmmu: List CPU types again 2022-03-16 08:43:10 +01:00
datadir.c vl: extract softmmu/datadir.c 2020-12-10 12:15:18 -05:00
device_tree.c softmmu/device_tree: Remove redundant pointer assignment 2022-01-21 15:52:56 +10:00
dma-helpers.c Use g_new() & friends where that makes obvious sense 2022-03-21 15:44:44 +01:00
globals.c softmmu/globals: Remove unused 'hw/i386/*' headers 2022-03-06 13:15:42 +01:00
icount.c icount: get rid of static variable 2021-04-01 09:40:45 +02:00
ioport.c softmmu: Add missing trace-events file 2020-09-09 17:15:18 +01:00
main.c meson: move SDL and SDL-image detection to meson 2020-08-21 06:30:44 -04:00
memory_mapping.c Use g_new() & friends where that makes obvious sense 2022-03-21 15:44:44 +01:00
memory.c memory: Make memory_region_readd_subregion() properly handle mapped aliases 2022-03-29 00:44:40 +02:00
meson.build softmmu: Build target-agnostic objects once 2022-03-06 13:15:42 +01:00
physmem.c softmmu/physmem: Introduce MemTxAttrs::memory field and MEMTX_ACCESS_ERROR 2022-03-21 10:10:58 +01:00
qdev-monitor.c Check and report for incomplete 'global' option format 2022-03-07 19:00:05 +01:00
qemu-seccomp.c seccomp: block setns, unshare and execveat syscalls 2022-02-16 18:52:40 +00:00
qtest.c Replace GCC_FMT_ATTR with G_GNUC_PRINTF 2022-03-22 14:40:51 +04:00
rtc.c rtc: Move RTC function prototypes to their own header 2022-01-28 14:29:46 +00:00
runstate-action.c runstate: cleanup reboot and panic actions 2021-01-21 13:00:41 +01:00
runstate.c exec/exec-all: Move 'qemu/log.h' include in units requiring it 2022-02-21 10:18:06 +01:00
timers-state.h qemu/atomic: Add aligned_{int64,uint64}_t types 2021-07-21 07:45:38 -10:00
tpm.c qapi: More complex uses of QAPI_LIST_APPEND 2021-01-28 08:08:45 +01:00
trace-events memory: make global_dirty_tracking a bitmask 2021-11-01 22:56:43 +01:00
trace.h softmmu: Add missing trace-events file 2020-09-09 17:15:18 +01:00
vl.c error: use GLib to remember the program name 2022-03-22 14:46:18 +04:00