1
The following changes since commit 2ab09bf2f9f55b9fb8d2de6eb2ba2a8570e268e2:
1
The following changes since commit 73e0f70e097b7c92a5ce16ee35b53afe119b20d7:
2
2
3
Merge remote-tracking branch 'remotes/kraxel/tags/usb-20180612-pull-request' into staging (2018-06-12 15:34:34 +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
git://github.com/codyprime/qemu-kvm-jtc.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 b61acdecbf19c3c5a327baec1e8e4c06d0da68b7:
9
for you to fetch changes up to 4dd218fd0717ed3cddb69c01eeb9da630107d89d:
10
10
11
block: Ignore generated job QAPI files (2018-06-13 10:51:49 -0400)
11
iotests/149: Skip on unsupported ciphers (2021-11-23 15:39:12 +0100)
12
12
13
----------------------------------------------------------------
13
----------------------------------------------------------------
14
Block patch for .gitignore
14
Block patches for 6.2-rc2:
15
- Fix memory leak in vvfat when vvfat_open() fails
16
- iotest fixes for the gnutls crypto backend
17
15
----------------------------------------------------------------
18
----------------------------------------------------------------
19
Daniella Lee (1):
20
block/vvfat.c fix leak when failure occurs
16
21
17
Eric Blake (1):
22
Hanna Reitz (2):
18
block: Ignore generated job QAPI files
23
iotests: Use aes-128-cbc
24
iotests/149: Skip on unsupported ciphers
19
25
20
.gitignore | 4 ++++
26
block/vvfat.c | 16 ++++++++++++----
21
1 file changed, 4 insertions(+)
27
tests/qemu-iotests/149 | 23 ++++++++++++++++++-----
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(-)
22
33
23
--
34
--
24
2.13.6
35
2.33.1
25
36
26
37
diff view generated by jsdifflib
New patch
1
From: Daniella Lee <daniellalee111@gmail.com>
1
2
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
New 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.
1
5
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
From: Eric Blake <eblake@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
Commit bf42508f introduced new generated files; make sure they
5
We could taylor the algorithm list to what gnutls supports, but this is
4
don't get accidentally committed from an in-tree build.
6
a test that is run rather rarely anyway (because it requires
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.
5
10
6
Signed-off-by: Eric Blake <eblake@redhat.com>
11
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
7
Reviewed-by: Jeff Cody <jcody@redhat.com>
12
Message-Id: <20211117151707.52549-3-hreitz@redhat.com>
8
Reviewed-by: Max Reitz <mreitz@redhat.com>
13
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
9
Message-id: 20180531212435.165261-1-eblake@redhat.com
10
Signed-off-by: Jeff Cody <jcody@redhat.com>
11
---
14
---
12
.gitignore | 4 ++++
15
tests/qemu-iotests/149 | 23 ++++++++++++++++++-----
13
1 file changed, 4 insertions(+)
16
1 file changed, 18 insertions(+), 5 deletions(-)
14
17
15
diff --git a/.gitignore b/.gitignore
18
diff --git a/tests/qemu-iotests/149 b/tests/qemu-iotests/149
16
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100755
17
--- a/.gitignore
20
--- a/tests/qemu-iotests/149
18
+++ b/.gitignore
21
+++ b/tests/qemu-iotests/149
19
@@ -XXX,XX +XXX,XX @@
22
@@ -XXX,XX +XXX,XX @@ def create_image(config, size_mb):
20
/qapi/qapi-commands-common.[ch]
23
fn.truncate(size_mb * 1024 * 1024)
21
/qapi/qapi-commands-crypto.[ch]
24
22
/qapi/qapi-commands-introspect.[ch]
25
23
+/qapi/qapi-commands-job.[ch]
26
+def check_cipher_support(config, output):
24
/qapi/qapi-commands-migration.[ch]
27
+ """Check the output of qemu-img or qemu-io for mention of the respective
25
/qapi/qapi-commands-misc.[ch]
28
+ cipher algorithm being unsupported, and if so, skip this test.
26
/qapi/qapi-commands-net.[ch]
29
+ (Returns `output` for convenience.)"""
27
@@ -XXX,XX +XXX,XX @@
30
+
28
/qapi/qapi-events-common.[ch]
31
+ if 'Unsupported cipher algorithm' in output:
29
/qapi/qapi-events-crypto.[ch]
32
+ iotests.notrun('Unsupported cipher algorithm '
30
/qapi/qapi-events-introspect.[ch]
33
+ f'{config.cipher}-{config.keylen}-{config.mode}; '
31
+/qapi/qapi-events-job.[ch]
34
+ 'consider configuring qemu with a different crypto '
32
/qapi/qapi-events-migration.[ch]
35
+ 'backend')
33
/qapi/qapi-events-misc.[ch]
36
+ return output
34
/qapi/qapi-events-net.[ch]
37
+
35
@@ -XXX,XX +XXX,XX @@
38
def qemu_img_create(config, size_mb):
36
/qapi/qapi-types-common.[ch]
39
"""Create and format a disk image with LUKS using qemu-img"""
37
/qapi/qapi-types-crypto.[ch]
40
38
/qapi/qapi-types-introspect.[ch]
41
@@ -XXX,XX +XXX,XX @@ def qemu_img_create(config, size_mb):
39
+/qapi/qapi-types-job.[ch]
42
"%dM" % size_mb]
40
/qapi/qapi-types-migration.[ch]
43
41
/qapi/qapi-types-misc.[ch]
44
iotests.log("qemu-img " + " ".join(args), filters=[iotests.filter_test_dir])
42
/qapi/qapi-types-net.[ch]
45
- iotests.log(iotests.qemu_img_pipe(*args), filters=[iotests.filter_test_dir])
43
@@ -XXX,XX +XXX,XX @@
46
+ iotests.log(check_cipher_support(config, iotests.qemu_img_pipe(*args)),
44
/qapi/qapi-visit-common.[ch]
47
+ filters=[iotests.filter_test_dir])
45
/qapi/qapi-visit-crypto.[ch]
48
46
/qapi/qapi-visit-introspect.[ch]
49
def qemu_io_image_args(config, dev=False):
47
+/qapi/qapi-visit-job.[ch]
50
"""Get the args for access an image or device with qemu-io"""
48
/qapi/qapi-visit-migration.[ch]
51
@@ -XXX,XX +XXX,XX @@ def qemu_io_write_pattern(config, pattern, offset_mb, size_mb, dev=False):
49
/qapi/qapi-visit-misc.[ch]
52
args = ["-c", "write -P 0x%x %dM %dM" % (pattern, offset_mb, size_mb)]
50
/qapi/qapi-visit-net.[ch]
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):
51
--
73
--
52
2.13.6
74
2.33.1
53
75
54
76
diff view generated by jsdifflib