1 | The following changes since commit 285278ca785f5fa9a570927e1c0958a2ca2b2150: | 1 | The following changes since commit 33f18cf7dca7741d3647d514040904ce83edd73d: |
---|---|---|---|
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/kraxel/tags/audio-20190821-pull-request' into staging (2019-08-21 15:18:50 +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://github.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 5d4c1ed3d46d7e2010b389fe5f3376f605182ab0: |
10 | 10 | ||
11 | nvdimm: Add docs hint for Linux driver name (2018-10-29 13:35:22 +0000) | 11 | vhost-user-scsi: prevent using uninitialized vqs (2019-08-22 16:52:23 +0100) |
12 | 12 | ||
13 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
14 | Pull request | 14 | Pull request |
15 | 15 | ||
16 | No changelog-worthy entries, just small tweaks. | ||
17 | |||
18 | ---------------------------------------------------------------- | 16 | ---------------------------------------------------------------- |
19 | 17 | ||
20 | Kees Cook (1): | 18 | Raphael Norwitz (1): |
21 | nvdimm: Add docs hint for Linux driver name | 19 | vhost-user-scsi: prevent using uninitialized vqs |
22 | 20 | ||
23 | Li Qiang (1): | 21 | Stefan Hajnoczi (1): |
24 | util: aio-posix: fix a typo | 22 | util/async: hold AioContext ref to prevent use-after-free |
25 | 23 | ||
26 | docs/nvdimm.txt | 5 +++-- | 24 | hw/scsi/vhost-user-scsi.c | 2 +- |
27 | util/aio-posix.c | 2 +- | 25 | util/async.c | 8 ++++++++ |
28 | 2 files changed, 4 insertions(+), 3 deletions(-) | 26 | 2 files changed, 9 insertions(+), 1 deletion(-) |
29 | 27 | ||
30 | -- | 28 | -- |
31 | 2.17.2 | 29 | 2.21.0 |
32 | 30 | ||
33 | 31 | diff view generated by jsdifflib |
1 | From: Kees Cook <keescook@chromium.org> | 1 | The tests/test-bdrv-drain /bdrv-drain/iothread/drain test case does the |
---|---|---|---|
2 | following: | ||
2 | 3 | ||
3 | I spent way too much time trying to figure out why the emulated NVDIMM | 4 | 1. The preadv coroutine calls aio_bh_schedule_oneshot() and then yields. |
4 | was missing under Linux. In an effort to help others who might be looking | 5 | 2. The one-shot BH executes in another AioContext. All it does is call |
5 | for these kinds of things in the future, include a hint. | 6 | aio_co_wakeup(preadv_co). |
7 | 3. The preadv coroutine is re-entered and returns. | ||
6 | 8 | ||
7 | Signed-off-by: Kees Cook <keescook@chromium.org> | 9 | There is a race condition in aio_co_wake() where the preadv coroutine |
8 | Message-id: 20181018201351.GA25286@beast | 10 | returns and the test case destroys the preadv IOThread. aio_co_wake() |
11 | can still be running in the other AioContext and it performs an access | ||
12 | to the freed IOThread AioContext. | ||
13 | |||
14 | Here is the race in aio_co_schedule(): | ||
15 | |||
16 | QSLIST_INSERT_HEAD_ATOMIC(&ctx->scheduled_coroutines, | ||
17 | co, co_scheduled_next); | ||
18 | <-- race: co may execute before we invoke qemu_bh_schedule()! | ||
19 | qemu_bh_schedule(ctx->co_schedule_bh); | ||
20 | |||
21 | So if co causes ctx to be freed then we're in trouble. Fix this problem | ||
22 | by holding a reference to ctx. | ||
23 | |||
24 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
25 | Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> | ||
26 | Message-id: 20190723190623.21537-1-stefanha@redhat.com | ||
27 | Message-Id: <20190723190623.21537-1-stefanha@redhat.com> | ||
9 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | 28 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> |
10 | --- | 29 | --- |
11 | docs/nvdimm.txt | 5 +++-- | 30 | util/async.c | 8 ++++++++ |
12 | 1 file changed, 3 insertions(+), 2 deletions(-) | 31 | 1 file changed, 8 insertions(+) |
13 | 32 | ||
14 | diff --git a/docs/nvdimm.txt b/docs/nvdimm.txt | 33 | diff --git a/util/async.c b/util/async.c |
15 | index XXXXXXX..XXXXXXX 100644 | 34 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/docs/nvdimm.txt | 35 | --- a/util/async.c |
17 | +++ b/docs/nvdimm.txt | 36 | +++ b/util/async.c |
18 | @@ -XXX,XX +XXX,XX @@ Multiple vNVDIMM devices can be created if multiple pairs of "-object" | 37 | @@ -XXX,XX +XXX,XX @@ void aio_co_schedule(AioContext *ctx, Coroutine *co) |
19 | and "-device" are provided. | 38 | abort(); |
20 | 39 | } | |
21 | For above command line options, if the guest OS has the proper NVDIMM | 40 | |
22 | -driver, it should be able to detect a NVDIMM device which is in the | 41 | + /* The coroutine might run and release the last ctx reference before we |
23 | -persistent memory mode and whose size is $NVDIMM_SIZE. | 42 | + * invoke qemu_bh_schedule(). Take a reference to keep ctx alive until |
24 | +driver (e.g. "CONFIG_ACPI_NFIT=y" under Linux), it should be able to | 43 | + * we're done. |
25 | +detect a NVDIMM device which is in the persistent memory mode and whose | 44 | + */ |
26 | +size is $NVDIMM_SIZE. | 45 | + aio_context_ref(ctx); |
27 | 46 | + | |
28 | Note: | 47 | QSLIST_INSERT_HEAD_ATOMIC(&ctx->scheduled_coroutines, |
29 | 48 | co, co_scheduled_next); | |
49 | qemu_bh_schedule(ctx->co_schedule_bh); | ||
50 | + | ||
51 | + aio_context_unref(ctx); | ||
52 | } | ||
53 | |||
54 | void aio_co_wake(struct Coroutine *co) | ||
30 | -- | 55 | -- |
31 | 2.17.2 | 56 | 2.21.0 |
32 | 57 | ||
33 | 58 | diff view generated by jsdifflib |
1 | From: Li Qiang <liq3ea@gmail.com> | 1 | From: Raphael Norwitz <raphael.norwitz@nutanix.com> |
---|---|---|---|
2 | 2 | ||
3 | Cc: qemu-trivial@nongnu.org | 3 | Of the 3 virtqueues, seabios only sets cmd, leaving ctrl |
4 | Signed-off-by: Li Qiang <liq3ea@gmail.com> | 4 | and event without a physical address. This can cause |
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 5 | vhost_verify_ring_part_mapping to return ENOMEM, causing |
6 | Reviewed-by: Fam Zheng <famz@redhat.com> | 6 | the following logs: |
7 | Message-id: 1538964972-3223-1-git-send-email-liq3ea@gmail.com | 7 | |
8 | qemu-system-x86_64: Unable to map available ring for ring 0 | ||
9 | qemu-system-x86_64: Verify ring failure on region 0 | ||
10 | |||
11 | The qemu commit e6cc11d64fc998c11a4dfcde8fda3fc33a74d844 | ||
12 | has already resolved the issue for vhost scsi devices but | ||
13 | the fix was never applied to vhost-user scsi devices. | ||
14 | |||
15 | Signed-off-by: Raphael Norwitz <raphael.norwitz@nutanix.com> | ||
16 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
17 | Message-id: 1560299717-177734-1-git-send-email-raphael.norwitz@nutanix.com | ||
18 | Message-Id: <1560299717-177734-1-git-send-email-raphael.norwitz@nutanix.com> | ||
8 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | 19 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> |
9 | --- | 20 | --- |
10 | util/aio-posix.c | 2 +- | 21 | hw/scsi/vhost-user-scsi.c | 2 +- |
11 | 1 file changed, 1 insertion(+), 1 deletion(-) | 22 | 1 file changed, 1 insertion(+), 1 deletion(-) |
12 | 23 | ||
13 | diff --git a/util/aio-posix.c b/util/aio-posix.c | 24 | diff --git a/hw/scsi/vhost-user-scsi.c b/hw/scsi/vhost-user-scsi.c |
14 | index XXXXXXX..XXXXXXX 100644 | 25 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/util/aio-posix.c | 26 | --- a/hw/scsi/vhost-user-scsi.c |
16 | +++ b/util/aio-posix.c | 27 | +++ b/hw/scsi/vhost-user-scsi.c |
17 | @@ -XXX,XX +XXX,XX @@ struct AioHandler | 28 | @@ -XXX,XX +XXX,XX @@ static void vhost_user_scsi_realize(DeviceState *dev, Error **errp) |
18 | 29 | } | |
19 | #ifdef CONFIG_EPOLL_CREATE1 | 30 | |
20 | 31 | vsc->dev.nvqs = 2 + vs->conf.num_queues; | |
21 | -/* The fd number threashold to switch to epoll */ | 32 | - vsc->dev.vqs = g_new(struct vhost_virtqueue, vsc->dev.nvqs); |
22 | +/* The fd number threshold to switch to epoll */ | 33 | + vsc->dev.vqs = g_new0(struct vhost_virtqueue, vsc->dev.nvqs); |
23 | #define EPOLL_ENABLE_THRESHOLD 64 | 34 | vsc->dev.vq_index = 0; |
24 | 35 | vsc->dev.backend_features = 0; | |
25 | static void aio_epoll_disable(AioContext *ctx) | 36 | vqs = vsc->dev.vqs; |
26 | -- | 37 | -- |
27 | 2.17.2 | 38 | 2.21.0 |
28 | 39 | ||
29 | 40 | diff view generated by jsdifflib |