qemu/hw
Igor Druzhinin 3e81a71c9f xen-mapcache: avoid a race on memory map while using MAP_FIXED
When we're replacing the existing mapping there is possibility of a race
on memory map with other threads doing mmap operations - the address being
unmapped/re-mapped could be occupied by another thread in between.

Linux mmap man page recommends keeping the existing mappings in place to
reserve the place and instead utilize the fact that the next mmap operation
with MAP_FIXED flag passed will implicitly destroy the existing mappings
behind the chosen address. This behavior is guaranteed by POSIX / BSD and
therefore is portable.

Note that it wouldn't make the replacement atomic for parallel accesses to
the replaced region - those might still fail with SIGBUS due to
xenforeignmemory_map not being atomic. So we're still not expecting those.

Tested-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
Reviewed-by: Paul Durrant <paul@xen.org>
Message-Id: <1618889702-13104-1-git-send-email-igor.druzhinin@citrix.com>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
2021-05-10 13:43:58 +01:00
..
9pfs hw/9pfs/9p-synth: Replaced qemu_mutex_lock with QEMU_LOCK_GUARD 2021-03-16 11:41:49 +01:00
acpi Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
adc clock: Add ClockEvent parameter to callbacks 2021-03-08 17:20:01 +00:00
alpha Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
arm Trivial patches pull request 20210503 2021-05-05 13:52:00 +01:00
audio hw: Replace anti-social QOM type names 2021-03-19 15:18:43 +01:00
avr Do not include hw/boards.h if it's not really necessary 2021-05-02 17:24:51 +02:00
block Trivial patches pull request 20210503 2021-05-05 13:52:00 +01:00
char Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
core Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
cpu cpu/core: Fix "help" of CPU core device types 2021-04-09 16:05:16 -04:00
cris Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
display Do not include hw/boards.h if it's not really necessary 2021-05-02 17:24:51 +02:00
dma Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
gpio hw: gpio: implement gpio-pwr driver for qemu reset/poweroff 2021-01-29 10:47:28 +00:00
hppa Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
hyperv qdev: Move softmmu properties to qdev-properties-system.h 2020-12-18 15:20:17 -05:00
i2c Trivial patches pull request 20210503 2021-05-05 13:52:00 +01:00
i386 xen-mapcache: avoid a race on memory map while using MAP_FIXED 2021-05-10 13:43:58 +01:00
ide hw: Do not include hw/sysbus.h if it is not necessary 2021-05-02 17:24:50 +02:00
input Do not include sysemu/sysemu.h if it's not really necessary 2021-05-02 17:24:50 +02:00
intc ppc patch queue 2021-05-04 2021-05-05 20:29:14 +01:00
ipack Use OBJECT_DECLARE_SIMPLE_TYPE when possible 2020-09-18 14:12:32 -04:00
ipmi hw: Do not include qemu/log.h if it is not necessary 2021-05-02 17:24:50 +02:00
isa ppc patch queue 2021-05-04 2021-05-05 20:29:14 +01:00
lm32 Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
m68k Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
mem Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
microblaze Do not include sysemu/sysemu.h if it's not really necessary 2021-05-02 17:24:50 +02:00
mips Trivial patches pull request 20210503 2021-05-05 13:52:00 +01:00
misc Trivial patches pull request 20210503 2021-05-05 13:52:00 +01:00
moxie Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
net Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
nios2 Do not include cpu.h if it's not really necessary 2021-05-02 17:24:51 +02:00
nubus hw: Do not include hw/sysbus.h if it is not necessary 2021-05-02 17:24:50 +02:00
nvram Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
openrisc Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
pci Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
pci-bridge Kconfig: Compile PXB for ARM_VIRT 2021-01-17 06:42:54 -05:00
pci-host ppc patch queue 2021-05-04 2021-05-05 20:29:14 +01:00
pcmcia hw/pcmcia: Do not register PCMCIA type if not required 2021-05-02 17:24:50 +02:00
ppc ppc patch queue 2021-05-04 2021-05-05 20:29:14 +01:00
rdma pvrdma: wean code off pvrdma_ring.h kernel header 2021-03-15 16:41:22 +08:00
remote Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
riscv Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
rtc mc146818rtc: put it into the 'misc' category 2021-05-02 17:24:51 +02:00
rx hw/rx/rx-gdbsim: Do not accept invalid memory size 2021-05-03 10:07:41 +02:00
s390x Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
scsi Do not include cpu.h if it's not really necessary 2021-05-02 17:24:51 +02:00
sd hw: Do not include qemu/log.h if it is not necessary 2021-05-02 17:24:50 +02:00
sh4 Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
smbios i386: do not use ram_size global 2020-12-10 12:15:08 -05:00
sparc Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
sparc64 Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
ssi Trivial patches pull request 20210503 2021-05-05 13:52:00 +01:00
timer hw: Do not include hw/irq.h if it is not necessary 2021-05-02 17:24:50 +02:00
tpm Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
tricore Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
unicore32 meson: convert hw/arch* 2020-08-21 06:30:33 -04:00
usb hw: Do not include qemu/log.h if it is not necessary 2021-05-02 17:24:50 +02:00
vfio Do not include cpu.h if it's not really necessary 2021-05-02 17:24:51 +02:00
virtio Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
watchdog clock: Add ClockEvent parameter to callbacks 2021-03-08 17:20:01 +00:00
xen Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
xenpv meson: convert hw/arch* 2020-08-21 06:30:33 -04:00
xtensa Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
Kconfig semihosting: Move hw/semihosting/ -> semihosting/ 2021-03-10 15:34:12 +00:00
meson.build semihosting: Move hw/semihosting/ -> semihosting/ 2021-03-10 15:34:12 +00:00