qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 3e81a7: xen-mapcache: avoid a race on memory


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] 3e81a7: xen-mapcache: avoid a race on memory map while usi...
Date: Wed, 12 May 2021 04:04:54 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 3e81a71c9f3d23002b1e0dfff902c155d6c8d224
      
https://github.com/qemu/qemu/commit/3e81a71c9f3d23002b1e0dfff902c155d6c8d224
  Author: Igor Druzhinin <igor.druzhinin@citrix.com>
  Date:   2021-05-10 (Mon, 10 May 2021)

  Changed paths:
    M hw/i386/xen/xen-mapcache.c

  Log Message:
  -----------
  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>


  Commit: f1e43b6026500690fc402828fa7cc735175b93b6
      
https://github.com/qemu/qemu/commit/f1e43b6026500690fc402828fa7cc735175b93b6
  Author: Anthony PERARD <anthony.perard@citrix.com>
  Date:   2021-05-10 (Mon, 10 May 2021)

  Changed paths:
    M hw/i386/xen/xen-hvm.c
    M include/hw/xen/xen_common.h

  Log Message:
  -----------
  xen: Free xenforeignmemory_resource at exit

Because Coverity complains about it and this is one leak that Valgrind
reports.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Paul Durrant <paul@xen.org>
Message-Id: <20210430163742.469739-1-anthony.perard@citrix.com>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>


  Commit: 1898293990702c5601e225dac9afd2402fc46e2d
      
https://github.com/qemu/qemu/commit/1898293990702c5601e225dac9afd2402fc46e2d
  Author: Anthony PERARD <anthony.perard@citrix.com>
  Date:   2021-05-10 (Mon, 10 May 2021)

  Changed paths:
    M hw/block/xen-block.c

  Log Message:
  -----------
  xen-block: Use specific blockdev driver

... when a xen-block backend instance is created via xenstore.

Following 8d17adf34f50 ("block: remove support for using "file" driver
with block/char devices"), using the "file" blockdev driver for
everything doesn't work anymore, we need to use the "host_device"
driver when the disk image is a block device and "file" driver when it
is a regular file.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Paul Durrant <paul@xen.org>
Message-Id: <20210430163432.468894-1-anthony.perard@citrix.com>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>


  Commit: 4f24f774ba83e4c4a3179929d5f2ee183ce4fd2f
      
https://github.com/qemu/qemu/commit/4f24f774ba83e4c4a3179929d5f2ee183ce4fd2f
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2021-05-12 (Wed, 12 May 2021)

  Changed paths:
    M hw/block/xen-block.c
    M hw/i386/xen/xen-hvm.c
    M hw/i386/xen/xen-mapcache.c
    M include/hw/xen/xen_common.h

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/aperard/tags/pull-xen-20210510' into 
staging

Xen patches

- Avoid mmap race involving Xen's mapcache
- Fix xenforeignmemory_resource leak at exit
- Fix xen-block to choose a driver for the disk image when created via
  xenstore.

# gpg: Signature made Mon 10 May 2021 13:49:40 BST
# gpg:                using RSA key F80C006308E22CFD8A92E7980CF5572FD7FB55AF
# gpg: Good signature from "Anthony PERARD <anthony.perard@gmail.com>" [unknown]
# gpg:                 aka "Anthony PERARD <anthony.perard@citrix.com>" 
[unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 5379 2F71 024C 600F 778A  7161 D8D5 7199 DF83 42C8
#      Subkey fingerprint: F80C 0063 08E2 2CFD 8A92  E798 0CF5 572F D7FB 55AF

* remotes/aperard/tags/pull-xen-20210510:
  xen-block: Use specific blockdev driver
  xen: Free xenforeignmemory_resource at exit
  xen-mapcache: avoid a race on memory map while using MAP_FIXED

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


Compare: https://github.com/qemu/qemu/compare/7c7cb752d7e7...4f24f774ba83



reply via email to

[Prev in Thread] Current Thread [Next in Thread]