1 | The following changes since commit 560009f2c8b57b7cdd31a5693ea86ab369382f49: | 1 | The following changes since commit 73e0f70e097b7c92a5ce16ee35b53afe119b20d7: |
---|---|---|---|
2 | 2 | ||
3 | Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2019-10-07 15:40:53 +0100) | 3 | Merge tag 'pull-lu-20211123' of https://gitlab.com/rth7680/qemu into staging (2021-11-23 11:33:14 +0100) |
4 | 4 | ||
5 | are available in the Git repository at: | 5 | are available in the Git repository at: |
6 | 6 | ||
7 | https://github.com/stefanha/qemu.git tags/block-pull-request | 7 | https://gitlab.com/hreitz/qemu.git tags/pull-block-2021-11-23 |
8 | 8 | ||
9 | for you to fetch changes up to 4d804b5305ffb4d5fa414c38d4f1bdfb987c8d0b: | 9 | for you to fetch changes up to 4dd218fd0717ed3cddb69c01eeb9da630107d89d: |
10 | 10 | ||
11 | iotests/262: Switch source/dest VM launch order (2019-10-08 14:28:25 +0100) | 11 | iotests/149: Skip on unsupported ciphers (2021-11-23 15:39:12 +0100) |
12 | 12 | ||
13 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
14 | Pull request | 14 | Block patches for 6.2-rc2: |
15 | 15 | - Fix memory leak in vvfat when vvfat_open() fails | |
16 | This pull request also contains the two commits from the previous pull request | 16 | - iotest fixes for the gnutls crypto backend |
17 | that was dropped due to a mingw compilation error. The compilation should now | ||
18 | be fixed. | ||
19 | 17 | ||
20 | ---------------------------------------------------------------- | 18 | ---------------------------------------------------------------- |
19 | Daniella Lee (1): | ||
20 | block/vvfat.c fix leak when failure occurs | ||
21 | 21 | ||
22 | Max Reitz (2): | 22 | Hanna Reitz (2): |
23 | block: Skip COR for inactive nodes | 23 | iotests: Use aes-128-cbc |
24 | iotests/262: Switch source/dest VM launch order | 24 | iotests/149: Skip on unsupported ciphers |
25 | 25 | ||
26 | Sergio Lopez (1): | 26 | block/vvfat.c | 16 ++++++++++++---- |
27 | virtio-blk: schedule virtio_notify_config to run on main context | 27 | tests/qemu-iotests/149 | 23 ++++++++++++++++++----- |
28 | 28 | tests/qemu-iotests/206 | 4 ++-- | |
29 | Vladimir Sementsov-Ogievskiy (1): | 29 | tests/qemu-iotests/206.out | 6 +++--- |
30 | util/ioc.c: try to reassure Coverity about qemu_iovec_init_extended | 30 | tests/qemu-iotests/210 | 4 ++-- |
31 | 31 | tests/qemu-iotests/210.out | 6 +++--- | |
32 | block/io.c | 41 +++++++++++++++++++++++++------------- | 32 | 6 files changed, 40 insertions(+), 19 deletions(-) |
33 | hw/block/virtio-blk.c | 16 ++++++++++++++- | ||
34 | util/iov.c | 5 +++-- | ||
35 | tests/qemu-iotests/262 | 12 +++++------ | ||
36 | tests/qemu-iotests/262.out | 6 +++--- | ||
37 | 5 files changed, 54 insertions(+), 26 deletions(-) | ||
38 | 33 | ||
39 | -- | 34 | -- |
40 | 2.21.0 | 35 | 2.33.1 |
41 | 36 | ||
42 | 37 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
2 | 1 | ||
3 | Make it more obvious, that filling qiov corresponds to qiov allocation, | ||
4 | which in turn corresponds to total_niov calculation, based on mid_niov | ||
5 | (not mid_len). Still add an assertion to show that there should be no | ||
6 | difference. | ||
7 | |||
8 | [Added mingw "error: 'mid_iov' may be used uninitialized in this | ||
9 | function" compiler error fix suggested by Vladimir. | ||
10 | --Stefan] | ||
11 | |||
12 | Reported-by: Coverity (CID 1405302) | ||
13 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
14 | Message-id: 20190910090310.14032-1-vsementsov@virtuozzo.com | ||
15 | Suggested-by: Peter Maydell <peter.maydell@linaro.org> | ||
16 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
17 | Message-Id: <20190910090310.14032-1-vsementsov@virtuozzo.com> | ||
18 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
19 | |||
20 | fixup! util/ioc.c: try to reassure Coverity about qemu_iovec_init_extended | ||
21 | --- | ||
22 | util/iov.c | 5 +++-- | ||
23 | 1 file changed, 3 insertions(+), 2 deletions(-) | ||
24 | |||
25 | diff --git a/util/iov.c b/util/iov.c | ||
26 | index XXXXXXX..XXXXXXX 100644 | ||
27 | --- a/util/iov.c | ||
28 | +++ b/util/iov.c | ||
29 | @@ -XXX,XX +XXX,XX @@ void qemu_iovec_init_extended( | ||
30 | { | ||
31 | size_t mid_head, mid_tail; | ||
32 | int total_niov, mid_niov = 0; | ||
33 | - struct iovec *p, *mid_iov; | ||
34 | + struct iovec *p, *mid_iov = NULL; | ||
35 | |||
36 | if (mid_len) { | ||
37 | mid_iov = qiov_slice(mid_qiov, mid_offset, mid_len, | ||
38 | @@ -XXX,XX +XXX,XX @@ void qemu_iovec_init_extended( | ||
39 | p++; | ||
40 | } | ||
41 | |||
42 | - if (mid_len) { | ||
43 | + assert(!mid_niov == !mid_len); | ||
44 | + if (mid_niov) { | ||
45 | memcpy(p, mid_iov, mid_niov * sizeof(*p)); | ||
46 | p[0].iov_base = (uint8_t *)p[0].iov_base + mid_head; | ||
47 | p[0].iov_len -= mid_head; | ||
48 | -- | ||
49 | 2.21.0 | ||
50 | |||
51 | diff view generated by jsdifflib |
1 | From: Sergio Lopez <slp@redhat.com> | 1 | From: Daniella Lee <daniellalee111@gmail.com> |
---|---|---|---|
2 | 2 | ||
3 | virtio_notify_config() needs to acquire the global mutex, which isn't | 3 | Function vvfat_open called function enable_write_target and init_directories, |
4 | allowed from an iothread, and may lead to a deadlock like this: | 4 | and these functions malloc new memory for BDRVVVFATState::qcow_filename, |
5 | BDRVVVFATState::used_clusters, and BDRVVVFATState::cluster_buff. | ||
5 | 6 | ||
6 | - main thead | 7 | When the specified folder does not exist ,it may contains memory leak. |
7 | * Has acquired: qemu_global_mutex. | 8 | After init_directories function is executed, the vvfat_open return -EIO, |
8 | * Is trying the acquire: iothread AioContext lock via | 9 | and bdrv_open_driver goto label open_failed, |
9 | AIO_WAIT_WHILE (after aio_poll). | 10 | the program use g_free(bs->opaque) to release BDRVVVFATState struct |
11 | without members mentioned. | ||
10 | 12 | ||
11 | - iothread | 13 | command line: |
12 | * Has acquired: AioContext lock. | 14 | qemu-system-x86_64 -hdb <vdisk qcow file> -usb -device usb-storage,drive=fat16 |
13 | * Is trying to acquire: qemu_global_mutex (via | 15 | -drive file=fat:rw:fat-type=16:"<path of a host folder does not exist>", |
14 | virtio_notify_config->prepare_mmio_access). | 16 | id=fat16,format=raw,if=none |
15 | 17 | ||
16 | If virtio_blk_resize() is called from an iothread, schedule | 18 | enable_write_target called: |
17 | virtio_notify_config() to be run in the main context BH. | 19 | (gdb) bt |
20 | at ../block/vvfat.c:3114 | ||
21 | flags=155650, errp=0x7fffffffd780) at ../block/vvfat.c:1236 | ||
22 | node_name=0x0, options=0x555556fa45d0, open_flags=155650, | ||
23 | errp=0x7fffffffd890) at ../block.c:1558 | ||
24 | errp=0x7fffffffd890) at ../block.c:1852 | ||
25 | reference=0x0, options=0x555556fa45d0, flags=40962, parent=0x555556f98cd0, | ||
26 | child_class=0x555556b1d6a0 <child_of_bds>, child_role=19, | ||
27 | errp=0x7fffffffda90) at ../block.c:3779 | ||
28 | options=0x555556f9cfc0, bdref_key=0x555556239bb8 "file", | ||
29 | parent=0x555556f98cd0, child_class=0x555556b1d6a0 <child_of_bds>, | ||
30 | child_role=19, allow_none=true, errp=0x7fffffffda90) at ../block.c:3419 | ||
31 | reference=0x0, options=0x555556f9cfc0, flags=8194, parent=0x0, | ||
32 | child_class=0x0, child_role=0, errp=0x555556c98c40 <error_fatal>) | ||
33 | at ../block.c:3726 | ||
34 | options=0x555556f757b0, flags=0, errp=0x555556c98c40 <error_fatal>) | ||
35 | at ../block.c:3872 | ||
36 | options=0x555556f757b0, flags=0, errp=0x555556c98c40 <error_fatal>) | ||
37 | at ../block/block-backend.c:436 | ||
38 | bs_opts=0x555556f757b0, errp=0x555556c98c40 <error_fatal>) | ||
39 | at ../blockdev.c:608 | ||
40 | errp=0x555556c98c40 <error_fatal>) at ../blockdev.c:992 | ||
41 | ...... | ||
18 | 42 | ||
19 | [Removed unnecessary newline as suggested by Kevin Wolf | 43 | Signed-off-by: Daniella Lee <daniellalee111@gmail.com> |
20 | <kwolf@redhat.com>. | 44 | Message-Id: <20211119112553.352222-1-daniellalee111@gmail.com> |
21 | --Stefan] | 45 | [hreitz: Took commit message from v1] |
46 | Signed-off-by: Hanna Reitz <hreitz@redhat.com> | ||
47 | --- | ||
48 | block/vvfat.c | 16 ++++++++++++---- | ||
49 | 1 file changed, 12 insertions(+), 4 deletions(-) | ||
22 | 50 | ||
23 | Signed-off-by: Sergio Lopez <slp@redhat.com> | 51 | diff --git a/block/vvfat.c b/block/vvfat.c |
24 | Reviewed-by: Kevin Wolf <kwolf@redhat.com> | ||
25 | Message-id: 20190916112411.21636-1-slp@redhat.com | ||
26 | Message-Id: <20190916112411.21636-1-slp@redhat.com> | ||
27 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
28 | --- | ||
29 | hw/block/virtio-blk.c | 16 +++++++++++++++- | ||
30 | 1 file changed, 15 insertions(+), 1 deletion(-) | ||
31 | |||
32 | diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c | ||
33 | index XXXXXXX..XXXXXXX 100644 | 52 | index XXXXXXX..XXXXXXX 100644 |
34 | --- a/hw/block/virtio-blk.c | 53 | --- a/block/vvfat.c |
35 | +++ b/hw/block/virtio-blk.c | 54 | +++ b/block/vvfat.c |
36 | @@ -XXX,XX +XXX,XX @@ | 55 | @@ -XXX,XX +XXX,XX @@ static int vvfat_open(BlockDriverState *bs, QDict *options, int flags, |
37 | #include "qemu/iov.h" | 56 | |
38 | #include "qemu/module.h" | 57 | qemu_co_mutex_init(&s->lock); |
39 | #include "qemu/error-report.h" | 58 | |
40 | +#include "qemu/main-loop.h" | 59 | - ret = 0; |
41 | #include "trace.h" | 60 | + qemu_opts_del(opts); |
42 | #include "hw/block/block.h" | 61 | + |
43 | #include "hw/qdev-properties.h" | 62 | + return 0; |
44 | @@ -XXX,XX +XXX,XX @@ static int virtio_blk_load_device(VirtIODevice *vdev, QEMUFile *f, | 63 | + |
64 | fail: | ||
65 | + g_free(s->qcow_filename); | ||
66 | + s->qcow_filename = NULL; | ||
67 | + g_free(s->cluster_buffer); | ||
68 | + s->cluster_buffer = NULL; | ||
69 | + g_free(s->used_clusters); | ||
70 | + s->used_clusters = NULL; | ||
71 | + | ||
72 | qemu_opts_del(opts); | ||
73 | return ret; | ||
74 | } | ||
75 | @@ -XXX,XX +XXX,XX @@ static int enable_write_target(BlockDriverState *bs, Error **errp) | ||
76 | int size = sector2cluster(s, s->sector_count); | ||
77 | QDict *options; | ||
78 | |||
79 | - s->used_clusters = calloc(size, 1); | ||
80 | + s->used_clusters = g_malloc0(size); | ||
81 | |||
82 | array_init(&(s->commits), sizeof(commit_t)); | ||
83 | |||
84 | @@ -XXX,XX +XXX,XX @@ static int enable_write_target(BlockDriverState *bs, Error **errp) | ||
45 | return 0; | 85 | return 0; |
86 | |||
87 | err: | ||
88 | - g_free(s->qcow_filename); | ||
89 | - s->qcow_filename = NULL; | ||
90 | return ret; | ||
46 | } | 91 | } |
47 | 92 | ||
48 | +static void virtio_resize_cb(void *opaque) | ||
49 | +{ | ||
50 | + VirtIODevice *vdev = opaque; | ||
51 | + | ||
52 | + assert(qemu_get_current_aio_context() == qemu_get_aio_context()); | ||
53 | + virtio_notify_config(vdev); | ||
54 | +} | ||
55 | + | ||
56 | static void virtio_blk_resize(void *opaque) | ||
57 | { | ||
58 | VirtIODevice *vdev = VIRTIO_DEVICE(opaque); | ||
59 | |||
60 | - virtio_notify_config(vdev); | ||
61 | + /* | ||
62 | + * virtio_notify_config() needs to acquire the global mutex, | ||
63 | + * so it can't be called from an iothread. Instead, schedule | ||
64 | + * it to be run in the main context BH. | ||
65 | + */ | ||
66 | + aio_bh_schedule_oneshot(qemu_get_aio_context(), virtio_resize_cb, vdev); | ||
67 | } | ||
68 | |||
69 | static const BlockDevOps virtio_block_ops = { | ||
70 | -- | 93 | -- |
71 | 2.21.0 | 94 | 2.33.1 |
72 | 95 | ||
73 | 96 | diff view generated by jsdifflib |
1 | From: Max Reitz <mreitz@redhat.com> | 1 | Our gnutls crypto backend (which is the default as of 8bd0931f6) |
---|---|---|---|
2 | supports neither twofish-128 nor the CTR mode. CBC and aes-128 are | ||
3 | supported by all of our backends (as far as I can tell), so use | ||
4 | aes-128-cbc in our iotests. | ||
2 | 5 | ||
3 | Launching the destination VM before the source VM gives us a regression | 6 | (We could also use e.g. aes-256-cbc, but the different key sizes would |
4 | test for HEAD^: | 7 | lead to different key slot offsets and so change the reference output |
8 | more, which is why I went with aes-128.) | ||
5 | 9 | ||
6 | The guest device causes a read from the disk image through | 10 | Signed-off-by: Hanna Reitz <hreitz@redhat.com> |
7 | guess_disk_lchs(). This will not work if the first sector (containing | 11 | Message-Id: <20211117151707.52549-2-hreitz@redhat.com> |
8 | the partition table) is yet unallocated, we use COR, and the node is | 12 | Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> |
9 | inactive. | 13 | Tested-by: Thomas Huth <thuth@redhat.com> |
14 | --- | ||
15 | tests/qemu-iotests/206 | 4 ++-- | ||
16 | tests/qemu-iotests/206.out | 6 +++--- | ||
17 | tests/qemu-iotests/210 | 4 ++-- | ||
18 | tests/qemu-iotests/210.out | 6 +++--- | ||
19 | 4 files changed, 10 insertions(+), 10 deletions(-) | ||
10 | 20 | ||
11 | By launching the source VM before the destination, however, the COR | 21 | diff --git a/tests/qemu-iotests/206 b/tests/qemu-iotests/206 |
12 | filter on the source will allocate that area in the image shared between | ||
13 | both VMs, thus the problem will not become apparent. | ||
14 | |||
15 | Switching the launch order causes the sector to still be unallocated | ||
16 | when guess_disk_lchs() runs on the inactive node in the destination VM, | ||
17 | and thus we get our test case. | ||
18 | |||
19 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
20 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
21 | Message-id: 20191001174827.11081-3-mreitz@redhat.com | ||
22 | Message-Id: <20191001174827.11081-3-mreitz@redhat.com> | ||
23 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
24 | --- | ||
25 | tests/qemu-iotests/262 | 12 ++++++------ | ||
26 | tests/qemu-iotests/262.out | 6 +++--- | ||
27 | 2 files changed, 9 insertions(+), 9 deletions(-) | ||
28 | |||
29 | diff --git a/tests/qemu-iotests/262 b/tests/qemu-iotests/262 | ||
30 | index XXXXXXX..XXXXXXX 100755 | 22 | index XXXXXXX..XXXXXXX 100755 |
31 | --- a/tests/qemu-iotests/262 | 23 | --- a/tests/qemu-iotests/206 |
32 | +++ b/tests/qemu-iotests/262 | 24 | +++ b/tests/qemu-iotests/206 |
33 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('img') as img_path, \ | 25 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.qcow2') as disk_path, \ |
34 | 26 | 'encrypt': { | |
35 | os.mkfifo(fifo) | 27 | 'format': 'luks', |
36 | 28 | 'key-secret': 'keysec0', | |
37 | - iotests.log('Launching source VM...') | 29 | - 'cipher-alg': 'twofish-128', |
38 | - add_opts(vm_a) | 30 | - 'cipher-mode': 'ctr', |
39 | - vm_a.launch() | 31 | + 'cipher-alg': 'aes-128', |
40 | - | 32 | + 'cipher-mode': 'cbc', |
41 | - vm_a.enable_migration_events('A') | 33 | 'ivgen-alg': 'plain64', |
42 | - | 34 | 'ivgen-hash-alg': 'md5', |
43 | iotests.log('Launching destination VM...') | 35 | 'hash-alg': 'sha1', |
44 | add_opts(vm_b) | 36 | diff --git a/tests/qemu-iotests/206.out b/tests/qemu-iotests/206.out |
45 | vm_b.add_incoming("exec: cat '%s'" % (fifo)) | ||
46 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('img') as img_path, \ | ||
47 | |||
48 | vm_b.enable_migration_events('B') | ||
49 | |||
50 | + iotests.log('Launching source VM...') | ||
51 | + add_opts(vm_a) | ||
52 | + vm_a.launch() | ||
53 | + | ||
54 | + vm_a.enable_migration_events('A') | ||
55 | + | ||
56 | iotests.log('Starting migration to B...') | ||
57 | iotests.log(vm_a.qmp('migrate', uri='exec:cat >%s' % (fifo))) | ||
58 | with iotests.Timeout(3, 'Migration does not complete'): | ||
59 | diff --git a/tests/qemu-iotests/262.out b/tests/qemu-iotests/262.out | ||
60 | index XXXXXXX..XXXXXXX 100644 | 37 | index XXXXXXX..XXXXXXX 100644 |
61 | --- a/tests/qemu-iotests/262.out | 38 | --- a/tests/qemu-iotests/206.out |
62 | +++ b/tests/qemu-iotests/262.out | 39 | +++ b/tests/qemu-iotests/206.out |
63 | @@ -XXX,XX +XXX,XX @@ | 40 | @@ -XXX,XX +XXX,XX @@ Format specific information: |
64 | -Launching source VM... | 41 | |
65 | -Enabling migration QMP events on A... | 42 | === Successful image creation (encrypted) === |
66 | -{"return": {}} | 43 | |
67 | Launching destination VM... | 44 | -{"execute": "blockdev-create", "arguments": {"job-id": "job0", "options": {"driver": "qcow2", "encrypt": {"cipher-alg": "twofish-128", "cipher-mode": "ctr", "format": "luks", "hash-alg": "sha1", "iter-time": 10, "ivgen-alg": "plain64", "ivgen-hash-alg": "md5", "key-secret": "keysec0"}, "file": {"driver": "file", "filename": "TEST_DIR/PID-t.qcow2"}, "size": 33554432}}} |
68 | Enabling migration QMP events on B... | 45 | +{"execute": "blockdev-create", "arguments": {"job-id": "job0", "options": {"driver": "qcow2", "encrypt": {"cipher-alg": "aes-128", "cipher-mode": "cbc", "format": "luks", "hash-alg": "sha1", "iter-time": 10, "ivgen-alg": "plain64", "ivgen-hash-alg": "md5", "key-secret": "keysec0"}, "file": {"driver": "file", "filename": "TEST_DIR/PID-t.qcow2"}, "size": 33554432}}} |
69 | {"return": {}} | 46 | {"return": {}} |
70 | +Launching source VM... | 47 | {"execute": "job-dismiss", "arguments": {"id": "job0"}} |
71 | +Enabling migration QMP events on A... | ||
72 | +{"return": {}} | ||
73 | Starting migration to B... | ||
74 | {"return": {}} | 48 | {"return": {}} |
75 | {"data": {"status": "setup"}, "event": "MIGRATION", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} | 49 | @@ -XXX,XX +XXX,XX @@ Format specific information: |
50 | encrypt: | ||
51 | ivgen alg: plain64 | ||
52 | hash alg: sha1 | ||
53 | - cipher alg: twofish-128 | ||
54 | + cipher alg: aes-128 | ||
55 | uuid: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX | ||
56 | format: luks | ||
57 | - cipher mode: ctr | ||
58 | + cipher mode: cbc | ||
59 | slots: | ||
60 | [0]: | ||
61 | active: true | ||
62 | diff --git a/tests/qemu-iotests/210 b/tests/qemu-iotests/210 | ||
63 | index XXXXXXX..XXXXXXX 100755 | ||
64 | --- a/tests/qemu-iotests/210 | ||
65 | +++ b/tests/qemu-iotests/210 | ||
66 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.luks') as disk_path, \ | ||
67 | }, | ||
68 | 'size': size, | ||
69 | 'key-secret': 'keysec0', | ||
70 | - 'cipher-alg': 'twofish-128', | ||
71 | - 'cipher-mode': 'ctr', | ||
72 | + 'cipher-alg': 'aes-128', | ||
73 | + 'cipher-mode': 'cbc', | ||
74 | 'ivgen-alg': 'plain64', | ||
75 | 'ivgen-hash-alg': 'md5', | ||
76 | 'hash-alg': 'sha1', | ||
77 | diff --git a/tests/qemu-iotests/210.out b/tests/qemu-iotests/210.out | ||
78 | index XXXXXXX..XXXXXXX 100644 | ||
79 | --- a/tests/qemu-iotests/210.out | ||
80 | +++ b/tests/qemu-iotests/210.out | ||
81 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
82 | {"execute": "job-dismiss", "arguments": {"id": "job0"}} | ||
83 | {"return": {}} | ||
84 | |||
85 | -{"execute": "blockdev-create", "arguments": {"job-id": "job0", "options": {"cipher-alg": "twofish-128", "cipher-mode": "ctr", "driver": "luks", "file": {"driver": "file", "filename": "TEST_DIR/PID-t.luks"}, "hash-alg": "sha1", "iter-time": 10, "ivgen-alg": "plain64", "ivgen-hash-alg": "md5", "key-secret": "keysec0", "size": 67108864}}} | ||
86 | +{"execute": "blockdev-create", "arguments": {"job-id": "job0", "options": {"cipher-alg": "aes-128", "cipher-mode": "cbc", "driver": "luks", "file": {"driver": "file", "filename": "TEST_DIR/PID-t.luks"}, "hash-alg": "sha1", "iter-time": 10, "ivgen-alg": "plain64", "ivgen-hash-alg": "md5", "key-secret": "keysec0", "size": 67108864}}} | ||
87 | {"return": {}} | ||
88 | {"execute": "job-dismiss", "arguments": {"id": "job0"}} | ||
89 | {"return": {}} | ||
90 | @@ -XXX,XX +XXX,XX @@ encrypted: yes | ||
91 | Format specific information: | ||
92 | ivgen alg: plain64 | ||
93 | hash alg: sha1 | ||
94 | - cipher alg: twofish-128 | ||
95 | + cipher alg: aes-128 | ||
96 | uuid: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX | ||
97 | - cipher mode: ctr | ||
98 | + cipher mode: cbc | ||
99 | slots: | ||
100 | [0]: | ||
101 | active: true | ||
76 | -- | 102 | -- |
77 | 2.21.0 | 103 | 2.33.1 |
78 | 104 | ||
79 | 105 | diff view generated by jsdifflib |
1 | From: Max Reitz <mreitz@redhat.com> | 1 | Whenever qemu-img or qemu-io report that some cipher is unsupported, |
---|---|---|---|
2 | skip the whole test, because that is probably because qemu has been | ||
3 | configured with the gnutls crypto backend. | ||
2 | 4 | ||
3 | We must not write data to inactive nodes, and a COR is certainly | 5 | We could taylor the algorithm list to what gnutls supports, but this is |
4 | something we can simply not do without upsetting anyone. So skip COR | 6 | a test that is run rather rarely anyway (because it requires |
5 | operations on inactive nodes. | 7 | password-less sudo), and so it seems better and easier to skip it. When |
8 | this test is intentionally run to check LUKS compatibility, it seems | ||
9 | better not to limit the algorithms but keep the list extensive. | ||
6 | 10 | ||
7 | Signed-off-by: Max Reitz <mreitz@redhat.com> | 11 | Signed-off-by: Hanna Reitz <hreitz@redhat.com> |
8 | Reviewed-by: Eric Blake <eblake@redhat.com> | 12 | Message-Id: <20211117151707.52549-3-hreitz@redhat.com> |
9 | Message-id: 20191001174827.11081-2-mreitz@redhat.com | 13 | Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> |
10 | Message-Id: <20191001174827.11081-2-mreitz@redhat.com> | ||
11 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
12 | --- | 14 | --- |
13 | block/io.c | 41 +++++++++++++++++++++++++++-------------- | 15 | tests/qemu-iotests/149 | 23 ++++++++++++++++++----- |
14 | 1 file changed, 27 insertions(+), 14 deletions(-) | 16 | 1 file changed, 18 insertions(+), 5 deletions(-) |
15 | 17 | ||
16 | diff --git a/block/io.c b/block/io.c | 18 | diff --git a/tests/qemu-iotests/149 b/tests/qemu-iotests/149 |
17 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100755 |
18 | --- a/block/io.c | 20 | --- a/tests/qemu-iotests/149 |
19 | +++ b/block/io.c | 21 | +++ b/tests/qemu-iotests/149 |
20 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn bdrv_co_do_copy_on_readv(BdrvChild *child, | 22 | @@ -XXX,XX +XXX,XX @@ def create_image(config, size_mb): |
21 | int max_transfer = MIN_NON_ZERO(bs->bl.max_transfer, | 23 | fn.truncate(size_mb * 1024 * 1024) |
22 | BDRV_REQUEST_MAX_BYTES); | 24 | |
23 | unsigned int progress = 0; | 25 | |
24 | + bool skip_write; | 26 | +def check_cipher_support(config, output): |
25 | 27 | + """Check the output of qemu-img or qemu-io for mention of the respective | |
26 | if (!drv) { | 28 | + cipher algorithm being unsupported, and if so, skip this test. |
27 | return -ENOMEDIUM; | 29 | + (Returns `output` for convenience.)""" |
28 | } | ||
29 | |||
30 | + /* | ||
31 | + * Do not write anything when the BDS is inactive. That is not | ||
32 | + * allowed, and it would not help. | ||
33 | + */ | ||
34 | + skip_write = (bs->open_flags & BDRV_O_INACTIVE); | ||
35 | + | 30 | + |
36 | /* FIXME We cannot require callers to have write permissions when all they | 31 | + if 'Unsupported cipher algorithm' in output: |
37 | * are doing is a read request. If we did things right, write permissions | 32 | + iotests.notrun('Unsupported cipher algorithm ' |
38 | * would be obtained anyway, but internally by the copy-on-read code. As | 33 | + f'{config.cipher}-{config.keylen}-{config.mode}; ' |
39 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn bdrv_co_do_copy_on_readv(BdrvChild *child, | 34 | + 'consider configuring qemu with a different crypto ' |
40 | while (cluster_bytes) { | 35 | + 'backend') |
41 | int64_t pnum; | 36 | + return output |
42 | 37 | + | |
43 | - ret = bdrv_is_allocated(bs, cluster_offset, | 38 | def qemu_img_create(config, size_mb): |
44 | - MIN(cluster_bytes, max_transfer), &pnum); | 39 | """Create and format a disk image with LUKS using qemu-img""" |
45 | - if (ret < 0) { | 40 | |
46 | - /* Safe to treat errors in querying allocation as if | 41 | @@ -XXX,XX +XXX,XX @@ def qemu_img_create(config, size_mb): |
47 | - * unallocated; we'll probably fail again soon on the | 42 | "%dM" % size_mb] |
48 | - * read, but at least that will set a decent errno. | 43 | |
49 | - */ | 44 | iotests.log("qemu-img " + " ".join(args), filters=[iotests.filter_test_dir]) |
50 | + if (skip_write) { | 45 | - iotests.log(iotests.qemu_img_pipe(*args), filters=[iotests.filter_test_dir]) |
51 | + ret = 1; /* "already allocated", so nothing will be copied */ | 46 | + iotests.log(check_cipher_support(config, iotests.qemu_img_pipe(*args)), |
52 | pnum = MIN(cluster_bytes, max_transfer); | 47 | + filters=[iotests.filter_test_dir]) |
53 | - } | 48 | |
54 | + } else { | 49 | def qemu_io_image_args(config, dev=False): |
55 | + ret = bdrv_is_allocated(bs, cluster_offset, | 50 | """Get the args for access an image or device with qemu-io""" |
56 | + MIN(cluster_bytes, max_transfer), &pnum); | 51 | @@ -XXX,XX +XXX,XX @@ def qemu_io_write_pattern(config, pattern, offset_mb, size_mb, dev=False): |
57 | + if (ret < 0) { | 52 | args = ["-c", "write -P 0x%x %dM %dM" % (pattern, offset_mb, size_mb)] |
58 | + /* | 53 | args.extend(qemu_io_image_args(config, dev)) |
59 | + * Safe to treat errors in querying allocation as if | 54 | iotests.log("qemu-io " + " ".join(args), filters=[iotests.filter_test_dir]) |
60 | + * unallocated; we'll probably fail again soon on the | 55 | - iotests.log(iotests.qemu_io(*args), filters=[iotests.filter_test_dir, |
61 | + * read, but at least that will set a decent errno. | 56 | - iotests.filter_qemu_io]) |
62 | + */ | 57 | + iotests.log(check_cipher_support(config, iotests.qemu_io(*args)), |
63 | + pnum = MIN(cluster_bytes, max_transfer); | 58 | + filters=[iotests.filter_test_dir, iotests.filter_qemu_io]) |
64 | + } | 59 | |
65 | 60 | ||
66 | - /* Stop at EOF if the image ends in the middle of the cluster */ | 61 | def qemu_io_read_pattern(config, pattern, offset_mb, size_mb, dev=False): |
67 | - if (ret == 0 && pnum == 0) { | 62 | @@ -XXX,XX +XXX,XX @@ def qemu_io_read_pattern(config, pattern, offset_mb, size_mb, dev=False): |
68 | - assert(progress >= bytes); | 63 | args = ["-c", "read -P 0x%x %dM %dM" % (pattern, offset_mb, size_mb)] |
69 | - break; | 64 | args.extend(qemu_io_image_args(config, dev)) |
70 | - } | 65 | iotests.log("qemu-io " + " ".join(args), filters=[iotests.filter_test_dir]) |
71 | + /* Stop at EOF if the image ends in the middle of the cluster */ | 66 | - iotests.log(iotests.qemu_io(*args), filters=[iotests.filter_test_dir, |
72 | + if (ret == 0 && pnum == 0) { | 67 | - iotests.filter_qemu_io]) |
73 | + assert(progress >= bytes); | 68 | + iotests.log(check_cipher_support(config, iotests.qemu_io(*args)), |
74 | + break; | 69 | + filters=[iotests.filter_test_dir, iotests.filter_qemu_io]) |
75 | + } | 70 | |
76 | 71 | ||
77 | - assert(skip_bytes < pnum); | 72 | def test_once(config, qemu_img=False): |
78 | + assert(skip_bytes < pnum); | ||
79 | + } | ||
80 | |||
81 | if (ret <= 0) { | ||
82 | QEMUIOVector local_qiov; | ||
83 | -- | 73 | -- |
84 | 2.21.0 | 74 | 2.33.1 |
85 | 75 | ||
86 | 76 | diff view generated by jsdifflib |