1
The following changes since commit 285278ca785f5fa9a570927e1c0958a2ca2b2150:
1
The following changes since commit a2376507f615495b1d16685449ce0ea78c2caf9d:
2
2
3
Merge remote-tracking branch 'remotes/famz/tags/testing-pull-request' into staging (2018-10-27 19:55:08 +0100)
3
Merge remote-tracking branch 'remotes/bonzini-gitlab/tags/for-upstream' into staging (2021-07-24 11:04:57 +0100)
4
4
5
are available in the Git repository at:
5
are available in the Git repository at:
6
6
7
git://github.com/stefanha/qemu.git tags/block-pull-request
7
https://gitlab.com/stefanha/qemu.git tags/block-pull-request
8
8
9
for you to fetch changes up to bd54b11062c4baa7d2e4efadcf71b8cfd55311fd:
9
for you to fetch changes up to 15a730e7a3aaac180df72cd5730e0617bcf44a5a:
10
10
11
nvdimm: Add docs hint for Linux driver name (2018-10-29 13:35:22 +0000)
11
block/nvme: Fix VFIO_MAP_DMA failed: No space left on device (2021-07-26 09:38:12 +0100)
12
12
13
----------------------------------------------------------------
13
----------------------------------------------------------------
14
Pull request
14
Pull request
15
15
16
No changelog-worthy entries, just small tweaks.
16
Phil's block/nvme.c ENOSPC fix for newer Linux kernels that return this errno.
17
17
18
----------------------------------------------------------------
18
----------------------------------------------------------------
19
19
20
Kees Cook (1):
20
Philippe Mathieu-Daudé (1):
21
nvdimm: Add docs hint for Linux driver name
21
block/nvme: Fix VFIO_MAP_DMA failed: No space left on device
22
22
23
Li Qiang (1):
23
block/nvme.c | 22 ++++++++++++++++++++++
24
util: aio-posix: fix a typo
24
1 file changed, 22 insertions(+)
25
26
docs/nvdimm.txt | 5 +++--
27
util/aio-posix.c | 2 +-
28
2 files changed, 4 insertions(+), 3 deletions(-)
29
25
30
--
26
--
31
2.17.2
27
2.31.1
32
28
33
diff view generated by jsdifflib
Deleted patch
1
From: Li Qiang <liq3ea@gmail.com>
2
1
3
Cc: qemu-trivial@nongnu.org
4
Signed-off-by: Li Qiang <liq3ea@gmail.com>
5
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Fam Zheng <famz@redhat.com>
7
Message-id: 1538964972-3223-1-git-send-email-liq3ea@gmail.com
8
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9
---
10
util/aio-posix.c | 2 +-
11
1 file changed, 1 insertion(+), 1 deletion(-)
12
13
diff --git a/util/aio-posix.c b/util/aio-posix.c
14
index XXXXXXX..XXXXXXX 100644
15
--- a/util/aio-posix.c
16
+++ b/util/aio-posix.c
17
@@ -XXX,XX +XXX,XX @@ struct AioHandler
18
19
#ifdef CONFIG_EPOLL_CREATE1
20
21
-/* The fd number threashold to switch to epoll */
22
+/* The fd number threshold to switch to epoll */
23
#define EPOLL_ENABLE_THRESHOLD 64
24
25
static void aio_epoll_disable(AioContext *ctx)
26
--
27
2.17.2
28
29
diff view generated by jsdifflib
1
From: Kees Cook <keescook@chromium.org>
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
2
2
3
I spent way too much time trying to figure out why the emulated NVDIMM
3
When the NVMe block driver was introduced (see commit bdd6a90a9e5,
4
was missing under Linux. In an effort to help others who might be looking
4
January 2018), Linux VFIO_IOMMU_MAP_DMA ioctl was only returning
5
for these kinds of things in the future, include a hint.
5
-ENOMEM in case of error. The driver was correctly handling the
6
error path to recycle its volatile IOVA mappings.
6
7
7
Signed-off-by: Kees Cook <keescook@chromium.org>
8
To fix CVE-2019-3882, Linux commit 492855939bdb ("vfio/type1: Limit
8
Message-id: 20181018201351.GA25286@beast
9
DMA mappings per container", April 2019) added the -ENOSPC error to
10
signal the user exhausted the DMA mappings available for a container.
11
12
The block driver started to mis-behave:
13
14
qemu-system-x86_64: VFIO_MAP_DMA failed: No space left on device
15
(qemu)
16
(qemu) info status
17
VM status: paused (io-error)
18
(qemu) c
19
VFIO_MAP_DMA failed: No space left on device
20
(qemu) c
21
VFIO_MAP_DMA failed: No space left on device
22
23
(The VM is not resumable from here, hence stuck.)
24
25
Fix by handling the new -ENOSPC error (when DMA mappings are
26
exhausted) without any distinction to the current -ENOMEM error,
27
so we don't change the behavior on old kernels where the CVE-2019-3882
28
fix is not present.
29
30
An easy way to reproduce this bug is to restrict the DMA mapping
31
limit (65535 by default) when loading the VFIO IOMMU module:
32
33
# modprobe vfio_iommu_type1 dma_entry_limit=666
34
35
Cc: qemu-stable@nongnu.org
36
Cc: Fam Zheng <fam@euphon.net>
37
Cc: Maxim Levitsky <mlevitsk@redhat.com>
38
Cc: Alex Williamson <alex.williamson@redhat.com>
39
Reported-by: Michal Prívozník <mprivozn@redhat.com>
40
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
41
Message-id: 20210723195843.1032825-1-philmd@redhat.com
42
Fixes: bdd6a90a9e5 ("block: Add VFIO based NVMe driver")
43
Buglink: https://bugs.launchpad.net/qemu/+bug/1863333
44
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/65
45
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
9
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
46
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10
---
47
---
11
docs/nvdimm.txt | 5 +++--
48
block/nvme.c | 22 ++++++++++++++++++++++
12
1 file changed, 3 insertions(+), 2 deletions(-)
49
1 file changed, 22 insertions(+)
13
50
14
diff --git a/docs/nvdimm.txt b/docs/nvdimm.txt
51
diff --git a/block/nvme.c b/block/nvme.c
15
index XXXXXXX..XXXXXXX 100644
52
index XXXXXXX..XXXXXXX 100644
16
--- a/docs/nvdimm.txt
53
--- a/block/nvme.c
17
+++ b/docs/nvdimm.txt
54
+++ b/block/nvme.c
18
@@ -XXX,XX +XXX,XX @@ Multiple vNVDIMM devices can be created if multiple pairs of "-object"
55
@@ -XXX,XX +XXX,XX @@ try_map:
19
and "-device" are provided.
56
r = qemu_vfio_dma_map(s->vfio,
20
57
qiov->iov[i].iov_base,
21
For above command line options, if the guest OS has the proper NVDIMM
58
len, true, &iova);
22
-driver, it should be able to detect a NVDIMM device which is in the
59
+ if (r == -ENOSPC) {
23
-persistent memory mode and whose size is $NVDIMM_SIZE.
60
+ /*
24
+driver (e.g. "CONFIG_ACPI_NFIT=y" under Linux), it should be able to
61
+ * In addition to the -ENOMEM error, the VFIO_IOMMU_MAP_DMA
25
+detect a NVDIMM device which is in the persistent memory mode and whose
62
+ * ioctl returns -ENOSPC to signal the user exhausted the DMA
26
+size is $NVDIMM_SIZE.
63
+ * mappings available for a container since Linux kernel commit
27
64
+ * 492855939bdb ("vfio/type1: Limit DMA mappings per container",
28
Note:
65
+ * April 2019, see CVE-2019-3882).
29
66
+ *
67
+ * This block driver already handles this error path by checking
68
+ * for the -ENOMEM error, so we directly replace -ENOSPC by
69
+ * -ENOMEM. Beside, -ENOSPC has a specific meaning for blockdev
70
+ * coroutines: it triggers BLOCKDEV_ON_ERROR_ENOSPC and
71
+ * BLOCK_ERROR_ACTION_STOP which stops the VM, asking the operator
72
+ * to add more storage to the blockdev. Not something we can do
73
+ * easily with an IOMMU :)
74
+ */
75
+ r = -ENOMEM;
76
+ }
77
if (r == -ENOMEM && retry) {
78
+ /*
79
+ * We exhausted the DMA mappings available for our container:
80
+ * recycle the volatile IOVA mappings.
81
+ */
82
retry = false;
83
trace_nvme_dma_flush_queue_wait(s);
84
if (s->dma_map_count) {
30
--
85
--
31
2.17.2
86
2.31.1
32
87
33
diff view generated by jsdifflib