diff options
author | Igor Druzhinin <igor.druzhinin@citrix.com> | 2021-04-20 04:35:02 +0100 |
---|---|---|
committer | Anthony PERARD <anthony.perard@citrix.com> | 2021-05-10 13:43:58 +0100 |
commit | 3e81a71c9f3d23002b1e0dfff902c155d6c8d224 (patch) | |
tree | 9a51bf09b674592b4feb6e78d47611b36dff1f39 /pc-bios/edk2-arm-vars.fd.bz2 | |
parent | 4cc10cae64c51e17844dc4358481c393d7bf1ed4 (diff) | |
download | qemu-3e81a71c9f3d23002b1e0dfff902c155d6c8d224.zip qemu-3e81a71c9f3d23002b1e0dfff902c155d6c8d224.tar.gz qemu-3e81a71c9f3d23002b1e0dfff902c155d6c8d224.tar.bz2 |
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>
Diffstat (limited to 'pc-bios/edk2-arm-vars.fd.bz2')
0 files changed, 0 insertions, 0 deletions