1 | The following changes since commit 73e0f70e097b7c92a5ce16ee35b53afe119b20d7: | 1 | The following changes since commit 99fc08366b06282614daeda989d2fde6ab8a707f: |
---|---|---|---|
2 | 2 | ||
3 | Merge tag 'pull-lu-20211123' of https://gitlab.com/rth7680/qemu into staging (2021-11-23 11:33:14 +0100) | 3 | Merge tag 'seabios-20211203-pull-request' of git://git.kraxel.org/qemu into staging (2021-12-03 05:26:40 -0800) |
4 | 4 | ||
5 | are available in the Git repository at: | 5 | are available in the Git repository at: |
6 | 6 | ||
7 | https://gitlab.com/hreitz/qemu.git tags/pull-block-2021-11-23 | 7 | https://gitlab.com/stefanha/qemu.git tags/block-pull-request |
8 | 8 | ||
9 | for you to fetch changes up to 4dd218fd0717ed3cddb69c01eeb9da630107d89d: | 9 | for you to fetch changes up to 5b807181c27a940a3a7ad1f221a2e76a132cbdc0: |
10 | 10 | ||
11 | iotests/149: Skip on unsupported ciphers (2021-11-23 15:39:12 +0100) | 11 | virtio-blk: Fix clean up of host notifiers for single MR transaction. (2021-12-06 14:21:14 +0000) |
12 | 12 | ||
13 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
14 | Block patches for 6.2-rc2: | 14 | Pull request |
15 | - Fix memory leak in vvfat when vvfat_open() fails | ||
16 | - iotest fixes for the gnutls crypto backend | ||
17 | 15 | ||
18 | ---------------------------------------------------------------- | 16 | ---------------------------------------------------------------- |
19 | Daniella Lee (1): | ||
20 | block/vvfat.c fix leak when failure occurs | ||
21 | 17 | ||
22 | Hanna Reitz (2): | 18 | Mark Mielke (1): |
23 | iotests: Use aes-128-cbc | 19 | virtio-blk: Fix clean up of host notifiers for single MR transaction. |
24 | iotests/149: Skip on unsupported ciphers | ||
25 | 20 | ||
26 | block/vvfat.c | 16 ++++++++++++---- | 21 | hw/block/dataplane/virtio-blk.c | 2 +- |
27 | tests/qemu-iotests/149 | 23 ++++++++++++++++++----- | 22 | 1 file changed, 1 insertion(+), 1 deletion(-) |
28 | tests/qemu-iotests/206 | 4 ++-- | ||
29 | tests/qemu-iotests/206.out | 6 +++--- | ||
30 | tests/qemu-iotests/210 | 4 ++-- | ||
31 | tests/qemu-iotests/210.out | 6 +++--- | ||
32 | 6 files changed, 40 insertions(+), 19 deletions(-) | ||
33 | 23 | ||
34 | -- | 24 | -- |
35 | 2.33.1 | 25 | 2.33.1 |
36 | 26 | ||
37 | 27 | ||
28 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Daniella Lee <daniellalee111@gmail.com> | ||
2 | 1 | ||
3 | Function vvfat_open called function enable_write_target and init_directories, | ||
4 | and these functions malloc new memory for BDRVVVFATState::qcow_filename, | ||
5 | BDRVVVFATState::used_clusters, and BDRVVVFATState::cluster_buff. | ||
6 | |||
7 | When the specified folder does not exist ,it may contains memory leak. | ||
8 | After init_directories function is executed, the vvfat_open return -EIO, | ||
9 | and bdrv_open_driver goto label open_failed, | ||
10 | the program use g_free(bs->opaque) to release BDRVVVFATState struct | ||
11 | without members mentioned. | ||
12 | |||
13 | command line: | ||
14 | qemu-system-x86_64 -hdb <vdisk qcow file> -usb -device usb-storage,drive=fat16 | ||
15 | -drive file=fat:rw:fat-type=16:"<path of a host folder does not exist>", | ||
16 | id=fat16,format=raw,if=none | ||
17 | |||
18 | enable_write_target called: | ||
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 | ...... | ||
42 | |||
43 | Signed-off-by: Daniella Lee <daniellalee111@gmail.com> | ||
44 | Message-Id: <20211119112553.352222-1-daniellalee111@gmail.com> | ||
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(-) | ||
50 | |||
51 | diff --git a/block/vvfat.c b/block/vvfat.c | ||
52 | index XXXXXXX..XXXXXXX 100644 | ||
53 | --- a/block/vvfat.c | ||
54 | +++ b/block/vvfat.c | ||
55 | @@ -XXX,XX +XXX,XX @@ static int vvfat_open(BlockDriverState *bs, QDict *options, int flags, | ||
56 | |||
57 | qemu_co_mutex_init(&s->lock); | ||
58 | |||
59 | - ret = 0; | ||
60 | + qemu_opts_del(opts); | ||
61 | + | ||
62 | + return 0; | ||
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) | ||
85 | return 0; | ||
86 | |||
87 | err: | ||
88 | - g_free(s->qcow_filename); | ||
89 | - s->qcow_filename = NULL; | ||
90 | return ret; | ||
91 | } | ||
92 | |||
93 | -- | ||
94 | 2.33.1 | ||
95 | |||
96 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
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. | ||
5 | 1 | ||
6 | (We could also use e.g. aes-256-cbc, but the different key sizes would | ||
7 | lead to different key slot offsets and so change the reference output | ||
8 | more, which is why I went with aes-128.) | ||
9 | |||
10 | Signed-off-by: Hanna Reitz <hreitz@redhat.com> | ||
11 | Message-Id: <20211117151707.52549-2-hreitz@redhat.com> | ||
12 | Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> | ||
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(-) | ||
20 | |||
21 | diff --git a/tests/qemu-iotests/206 b/tests/qemu-iotests/206 | ||
22 | index XXXXXXX..XXXXXXX 100755 | ||
23 | --- a/tests/qemu-iotests/206 | ||
24 | +++ b/tests/qemu-iotests/206 | ||
25 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.qcow2') as disk_path, \ | ||
26 | 'encrypt': { | ||
27 | 'format': 'luks', | ||
28 | 'key-secret': 'keysec0', | ||
29 | - 'cipher-alg': 'twofish-128', | ||
30 | - 'cipher-mode': 'ctr', | ||
31 | + 'cipher-alg': 'aes-128', | ||
32 | + 'cipher-mode': 'cbc', | ||
33 | 'ivgen-alg': 'plain64', | ||
34 | 'ivgen-hash-alg': 'md5', | ||
35 | 'hash-alg': 'sha1', | ||
36 | diff --git a/tests/qemu-iotests/206.out b/tests/qemu-iotests/206.out | ||
37 | index XXXXXXX..XXXXXXX 100644 | ||
38 | --- a/tests/qemu-iotests/206.out | ||
39 | +++ b/tests/qemu-iotests/206.out | ||
40 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
41 | |||
42 | === Successful image creation (encrypted) === | ||
43 | |||
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}}} | ||
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}}} | ||
46 | {"return": {}} | ||
47 | {"execute": "job-dismiss", "arguments": {"id": "job0"}} | ||
48 | {"return": {}} | ||
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 | ||
102 | -- | ||
103 | 2.33.1 | ||
104 | |||
105 | diff view generated by jsdifflib |
1 | Whenever qemu-img or qemu-io report that some cipher is unsupported, | 1 | From: Mark Mielke <mark.mielke@gmail.com> |
---|---|---|---|
2 | skip the whole test, because that is probably because qemu has been | ||
3 | configured with the gnutls crypto backend. | ||
4 | 2 | ||
5 | We could taylor the algorithm list to what gnutls supports, but this is | 3 | The code that introduced "virtio-blk: Configure all host notifiers in |
6 | a test that is run rather rarely anyway (because it requires | 4 | a single MR transaction" introduced a second loop variable to perform |
7 | password-less sudo), and so it seems better and easier to skip it. When | 5 | cleanup in second loop, but mistakenly still refers to the first |
8 | this test is intentionally run to check LUKS compatibility, it seems | 6 | loop variable within the second loop body. |
9 | better not to limit the algorithms but keep the list extensive. | ||
10 | 7 | ||
11 | Signed-off-by: Hanna Reitz <hreitz@redhat.com> | 8 | Fixes: d0267da61489 ("virtio-blk: Configure all host notifiers in a single MR transaction") |
12 | Message-Id: <20211117151707.52549-3-hreitz@redhat.com> | 9 | Signed-off-by: Mark Mielke <mark.mielke@gmail.com> |
13 | Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> | 10 | Message-id: CALm7yL08qarOu0dnQkTN+pa=BSRC92g31YpQQNDeAiT4yLZWQQ@mail.gmail.com |
11 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
14 | --- | 12 | --- |
15 | tests/qemu-iotests/149 | 23 ++++++++++++++++++----- | 13 | hw/block/dataplane/virtio-blk.c | 2 +- |
16 | 1 file changed, 18 insertions(+), 5 deletions(-) | 14 | 1 file changed, 1 insertion(+), 1 deletion(-) |
17 | 15 | ||
18 | diff --git a/tests/qemu-iotests/149 b/tests/qemu-iotests/149 | 16 | diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c |
19 | index XXXXXXX..XXXXXXX 100755 | 17 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/tests/qemu-iotests/149 | 18 | --- a/hw/block/dataplane/virtio-blk.c |
21 | +++ b/tests/qemu-iotests/149 | 19 | +++ b/hw/block/dataplane/virtio-blk.c |
22 | @@ -XXX,XX +XXX,XX @@ def create_image(config, size_mb): | 20 | @@ -XXX,XX +XXX,XX @@ int virtio_blk_data_plane_start(VirtIODevice *vdev) |
23 | fn.truncate(size_mb * 1024 * 1024) | 21 | memory_region_transaction_commit(); |
24 | 22 | ||
25 | 23 | while (j--) { | |
26 | +def check_cipher_support(config, output): | 24 | - virtio_bus_cleanup_host_notifier(VIRTIO_BUS(qbus), i); |
27 | + """Check the output of qemu-img or qemu-io for mention of the respective | 25 | + virtio_bus_cleanup_host_notifier(VIRTIO_BUS(qbus), j); |
28 | + cipher algorithm being unsupported, and if so, skip this test. | 26 | } |
29 | + (Returns `output` for convenience.)""" | 27 | goto fail_host_notifiers; |
30 | + | 28 | } |
31 | + if 'Unsupported cipher algorithm' in output: | ||
32 | + iotests.notrun('Unsupported cipher algorithm ' | ||
33 | + f'{config.cipher}-{config.keylen}-{config.mode}; ' | ||
34 | + 'consider configuring qemu with a different crypto ' | ||
35 | + 'backend') | ||
36 | + return output | ||
37 | + | ||
38 | def qemu_img_create(config, size_mb): | ||
39 | """Create and format a disk image with LUKS using qemu-img""" | ||
40 | |||
41 | @@ -XXX,XX +XXX,XX @@ def qemu_img_create(config, size_mb): | ||
42 | "%dM" % size_mb] | ||
43 | |||
44 | iotests.log("qemu-img " + " ".join(args), filters=[iotests.filter_test_dir]) | ||
45 | - iotests.log(iotests.qemu_img_pipe(*args), filters=[iotests.filter_test_dir]) | ||
46 | + iotests.log(check_cipher_support(config, iotests.qemu_img_pipe(*args)), | ||
47 | + filters=[iotests.filter_test_dir]) | ||
48 | |||
49 | def qemu_io_image_args(config, dev=False): | ||
50 | """Get the args for access an image or device with qemu-io""" | ||
51 | @@ -XXX,XX +XXX,XX @@ def qemu_io_write_pattern(config, pattern, offset_mb, size_mb, dev=False): | ||
52 | args = ["-c", "write -P 0x%x %dM %dM" % (pattern, offset_mb, size_mb)] | ||
53 | args.extend(qemu_io_image_args(config, dev)) | ||
54 | iotests.log("qemu-io " + " ".join(args), filters=[iotests.filter_test_dir]) | ||
55 | - iotests.log(iotests.qemu_io(*args), filters=[iotests.filter_test_dir, | ||
56 | - iotests.filter_qemu_io]) | ||
57 | + iotests.log(check_cipher_support(config, iotests.qemu_io(*args)), | ||
58 | + filters=[iotests.filter_test_dir, iotests.filter_qemu_io]) | ||
59 | |||
60 | |||
61 | def qemu_io_read_pattern(config, pattern, offset_mb, size_mb, dev=False): | ||
62 | @@ -XXX,XX +XXX,XX @@ def qemu_io_read_pattern(config, pattern, offset_mb, size_mb, dev=False): | ||
63 | args = ["-c", "read -P 0x%x %dM %dM" % (pattern, offset_mb, size_mb)] | ||
64 | args.extend(qemu_io_image_args(config, dev)) | ||
65 | iotests.log("qemu-io " + " ".join(args), filters=[iotests.filter_test_dir]) | ||
66 | - iotests.log(iotests.qemu_io(*args), filters=[iotests.filter_test_dir, | ||
67 | - iotests.filter_qemu_io]) | ||
68 | + iotests.log(check_cipher_support(config, iotests.qemu_io(*args)), | ||
69 | + filters=[iotests.filter_test_dir, iotests.filter_qemu_io]) | ||
70 | |||
71 | |||
72 | def test_once(config, qemu_img=False): | ||
73 | -- | 29 | -- |
74 | 2.33.1 | 30 | 2.33.1 |
75 | 31 | ||
76 | 32 | diff view generated by jsdifflib |