Skip to content
Snippets Groups Projects
Commit 35133781 authored by Richard Henderson's avatar Richard Henderson
Browse files

Merge tag 'pull-block-2021-11-23' of https://gitlab.com/hreitz/qemu into staging

Block patches for 6.2-rc2:
- Fix memory leak in vvfat when vvfat_open() fails
- iotest fixes for the gnutls crypto backend

# gpg: Signature made Tue 23 Nov 2021 04:58:05 PM CET
# gpg:                using RSA key CB62D7A0EE3829E45F004D34A1FA40D098019CDF
# gpg:                issuer "hreitz@redhat.com"
# gpg: Good signature from "Hanna Reitz <hreitz@redhat.com>" [marginal]
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: CB62 D7A0 EE38 29E4 5F00  4D34 A1FA 40D0 9801 9CDF

* tag 'pull-block-2021-11-23' of https://gitlab.com/hreitz/qemu

:
  iotests/149: Skip on unsupported ciphers
  iotests: Use aes-128-cbc
  block/vvfat.c fix leak when failure occurs

Signed-off-by: default avatarRichard Henderson <richard.henderson@linaro.org>
parents 73e0f70e 4dd218fd
No related branches found
No related tags found
No related merge requests found
...@@ -1279,8 +1279,18 @@ static int vvfat_open(BlockDriverState *bs, QDict *options, int flags, ...@@ -1279,8 +1279,18 @@ static int vvfat_open(BlockDriverState *bs, QDict *options, int flags,
qemu_co_mutex_init(&s->lock); qemu_co_mutex_init(&s->lock);
ret = 0; qemu_opts_del(opts);
return 0;
fail: fail:
g_free(s->qcow_filename);
s->qcow_filename = NULL;
g_free(s->cluster_buffer);
s->cluster_buffer = NULL;
g_free(s->used_clusters);
s->used_clusters = NULL;
qemu_opts_del(opts); qemu_opts_del(opts);
return ret; return ret;
} }
...@@ -3118,7 +3128,7 @@ static int enable_write_target(BlockDriverState *bs, Error **errp) ...@@ -3118,7 +3128,7 @@ static int enable_write_target(BlockDriverState *bs, Error **errp)
int size = sector2cluster(s, s->sector_count); int size = sector2cluster(s, s->sector_count);
QDict *options; QDict *options;
s->used_clusters = calloc(size, 1); s->used_clusters = g_malloc0(size);
array_init(&(s->commits), sizeof(commit_t)); array_init(&(s->commits), sizeof(commit_t));
...@@ -3166,8 +3176,6 @@ static int enable_write_target(BlockDriverState *bs, Error **errp) ...@@ -3166,8 +3176,6 @@ static int enable_write_target(BlockDriverState *bs, Error **errp)
return 0; return 0;
err: err:
g_free(s->qcow_filename);
s->qcow_filename = NULL;
return ret; return ret;
} }
......
...@@ -230,6 +230,18 @@ def create_image(config, size_mb): ...@@ -230,6 +230,18 @@ def create_image(config, size_mb):
fn.truncate(size_mb * 1024 * 1024) fn.truncate(size_mb * 1024 * 1024)
def check_cipher_support(config, output):
"""Check the output of qemu-img or qemu-io for mention of the respective
cipher algorithm being unsupported, and if so, skip this test.
(Returns `output` for convenience.)"""
if 'Unsupported cipher algorithm' in output:
iotests.notrun('Unsupported cipher algorithm '
f'{config.cipher}-{config.keylen}-{config.mode}; '
'consider configuring qemu with a different crypto '
'backend')
return output
def qemu_img_create(config, size_mb): def qemu_img_create(config, size_mb):
"""Create and format a disk image with LUKS using qemu-img""" """Create and format a disk image with LUKS using qemu-img"""
...@@ -253,7 +265,8 @@ def qemu_img_create(config, size_mb): ...@@ -253,7 +265,8 @@ def qemu_img_create(config, size_mb):
"%dM" % size_mb] "%dM" % size_mb]
iotests.log("qemu-img " + " ".join(args), filters=[iotests.filter_test_dir]) iotests.log("qemu-img " + " ".join(args), filters=[iotests.filter_test_dir])
iotests.log(iotests.qemu_img_pipe(*args), filters=[iotests.filter_test_dir]) iotests.log(check_cipher_support(config, iotests.qemu_img_pipe(*args)),
filters=[iotests.filter_test_dir])
def qemu_io_image_args(config, dev=False): def qemu_io_image_args(config, dev=False):
"""Get the args for access an image or device with qemu-io""" """Get the args for access an image or device with qemu-io"""
...@@ -279,8 +292,8 @@ def qemu_io_write_pattern(config, pattern, offset_mb, size_mb, dev=False): ...@@ -279,8 +292,8 @@ def qemu_io_write_pattern(config, pattern, offset_mb, size_mb, dev=False):
args = ["-c", "write -P 0x%x %dM %dM" % (pattern, offset_mb, size_mb)] args = ["-c", "write -P 0x%x %dM %dM" % (pattern, offset_mb, size_mb)]
args.extend(qemu_io_image_args(config, dev)) args.extend(qemu_io_image_args(config, dev))
iotests.log("qemu-io " + " ".join(args), filters=[iotests.filter_test_dir]) iotests.log("qemu-io " + " ".join(args), filters=[iotests.filter_test_dir])
iotests.log(iotests.qemu_io(*args), filters=[iotests.filter_test_dir, iotests.log(check_cipher_support(config, iotests.qemu_io(*args)),
iotests.filter_qemu_io]) filters=[iotests.filter_test_dir, iotests.filter_qemu_io])
def qemu_io_read_pattern(config, pattern, offset_mb, size_mb, dev=False): def qemu_io_read_pattern(config, pattern, offset_mb, size_mb, dev=False):
...@@ -291,8 +304,8 @@ def qemu_io_read_pattern(config, pattern, offset_mb, size_mb, dev=False): ...@@ -291,8 +304,8 @@ def qemu_io_read_pattern(config, pattern, offset_mb, size_mb, dev=False):
args = ["-c", "read -P 0x%x %dM %dM" % (pattern, offset_mb, size_mb)] args = ["-c", "read -P 0x%x %dM %dM" % (pattern, offset_mb, size_mb)]
args.extend(qemu_io_image_args(config, dev)) args.extend(qemu_io_image_args(config, dev))
iotests.log("qemu-io " + " ".join(args), filters=[iotests.filter_test_dir]) iotests.log("qemu-io " + " ".join(args), filters=[iotests.filter_test_dir])
iotests.log(iotests.qemu_io(*args), filters=[iotests.filter_test_dir, iotests.log(check_cipher_support(config, iotests.qemu_io(*args)),
iotests.filter_qemu_io]) filters=[iotests.filter_test_dir, iotests.filter_qemu_io])
def test_once(config, qemu_img=False): def test_once(config, qemu_img=False):
......
...@@ -162,8 +162,8 @@ with iotests.FilePath('t.qcow2') as disk_path, \ ...@@ -162,8 +162,8 @@ with iotests.FilePath('t.qcow2') as disk_path, \
'encrypt': { 'encrypt': {
'format': 'luks', 'format': 'luks',
'key-secret': 'keysec0', 'key-secret': 'keysec0',
'cipher-alg': 'twofish-128', 'cipher-alg': 'aes-128',
'cipher-mode': 'ctr', 'cipher-mode': 'cbc',
'ivgen-alg': 'plain64', 'ivgen-alg': 'plain64',
'ivgen-hash-alg': 'md5', 'ivgen-hash-alg': 'md5',
'hash-alg': 'sha1', 'hash-alg': 'sha1',
......
...@@ -97,7 +97,7 @@ Format specific information: ...@@ -97,7 +97,7 @@ Format specific information:
=== Successful image creation (encrypted) === === Successful image creation (encrypted) ===
{"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}}} {"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}}}
{"return": {}} {"return": {}}
{"execute": "job-dismiss", "arguments": {"id": "job0"}} {"execute": "job-dismiss", "arguments": {"id": "job0"}}
{"return": {}} {"return": {}}
...@@ -115,10 +115,10 @@ Format specific information: ...@@ -115,10 +115,10 @@ Format specific information:
encrypt: encrypt:
ivgen alg: plain64 ivgen alg: plain64
hash alg: sha1 hash alg: sha1
cipher alg: twofish-128 cipher alg: aes-128
uuid: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX uuid: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
format: luks format: luks
cipher mode: ctr cipher mode: cbc
slots: slots:
[0]: [0]:
active: true active: true
......
...@@ -83,8 +83,8 @@ with iotests.FilePath('t.luks') as disk_path, \ ...@@ -83,8 +83,8 @@ with iotests.FilePath('t.luks') as disk_path, \
}, },
'size': size, 'size': size,
'key-secret': 'keysec0', 'key-secret': 'keysec0',
'cipher-alg': 'twofish-128', 'cipher-alg': 'aes-128',
'cipher-mode': 'ctr', 'cipher-mode': 'cbc',
'ivgen-alg': 'plain64', 'ivgen-alg': 'plain64',
'ivgen-hash-alg': 'md5', 'ivgen-hash-alg': 'md5',
'hash-alg': 'sha1', 'hash-alg': 'sha1',
......
...@@ -59,7 +59,7 @@ Format specific information: ...@@ -59,7 +59,7 @@ Format specific information:
{"execute": "job-dismiss", "arguments": {"id": "job0"}} {"execute": "job-dismiss", "arguments": {"id": "job0"}}
{"return": {}} {"return": {}}
{"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}}} {"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}}}
{"return": {}} {"return": {}}
{"execute": "job-dismiss", "arguments": {"id": "job0"}} {"execute": "job-dismiss", "arguments": {"id": "job0"}}
{"return": {}} {"return": {}}
...@@ -71,9 +71,9 @@ encrypted: yes ...@@ -71,9 +71,9 @@ encrypted: yes
Format specific information: Format specific information:
ivgen alg: plain64 ivgen alg: plain64
hash alg: sha1 hash alg: sha1
cipher alg: twofish-128 cipher alg: aes-128
uuid: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX uuid: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
cipher mode: ctr cipher mode: cbc
slots: slots:
[0]: [0]:
active: true active: true
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment