Skip to content

Misc fixes and testing of qcow[2] encryption

Daniel P. Berrange qemu-devel 1 version Applied

Status from this message: Thanks, applied to the block branch.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 11 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/5qcow2/qcow: protect against uninitialized encryption keyblock/qcow.c block/qcow2-cluster.c block/qcow2.c+21 -101 reply
2/5util: move read_password method out of qemu-img into osdep/oslibinclude/qemu/osdep.h qemu-img.c util/oslib-posix.c +1 more+93 -921 reply
3/5util: allow \n to terminate password inpututil/oslib-posix.c+2 -11 reply
4/5qemu-io: prompt for encryption keys when requiredqemu-io.c+21 -03 replies
5/5tests: add test case for encrypted qcow2 read/writetests/qemu-iotests/131 tests/qemu-iotests/131.out tests/qemu-iotests/group+116 -04 replies

Reviews trailers per patch

All 5 patches have a Reviewed-by or Acked-by.

PatchEric Blake
1/5R-b
2/5R-b
3/5R-b
4/5R-b
5/5R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [Qemu-devel] [PATCH 0/5] Misc fixes and testing of qcow[2] encryption

I realize that qcow[2] encryption is a feature we have deprecated and will remove support for running it with the QEMU system emulators in this cycle. We do still need to make sure it continues to work for the sake of letting people run qemu-img convert to retrieve their data though.

Some of the other patches I'm working on which introduce a cypto cipher API touch this qcow2 code, thus I wanted to be able to test that it doesn't break anything.

I found that qemu-iotests didn't have any coverage of the qcow2 encryption code. For added fun, I then discovered that qemu-io doesn't check if an encryption key is required, so ends up writing plain text to the files instead of cipher, and returning cipher text for reads, instead of plain text. IOW qemu-io will corrupt encrypted qcow2 files on write.

This series adds some asserts that will protect against this kind of mistake, adds support for getting passwords to qemu-io (in the same manner that qemu-img supports), and finally adds a test case for reading/writing encrypted qcow2.

Daniel P. Berrange (5):
qcow2/qcow: protect against uninitialized encryption key
util: move read_password method out of qemu-img into osdep/oslib
util: allow \n to terminate password input
qemu-io: prompt for encryption keys when required
tests: add test case for encrypted qcow2 read/write

 block/qcow.c               | 10 +++--
 block/qcow2-cluster.c      |  3 +-
 block/qcow2.c              | 18 ++++++---
 include/qemu/osdep.h       |  2 +
 qemu-img.c                 | 93 +---------------------------------------------
 qemu-io.c                  | 21 +++++++++++
 tests/qemu-iotests/131     | 69 ++++++++++++++++++++++++++++++++++
 tests/qemu-iotests/131.out | 46 +++++++++++++++++++++++
 tests/qemu-iotests/group   |  1 +
 util/oslib-posix.c         | 67 +++++++++++++++++++++++++++++++++
 util/oslib-win32.c         | 24 ++++++++++++
 11 files changed, 252 insertions(+), 102 deletions(-)
 create mode 100755 tests/qemu-iotests/131
 create mode 100644 tests/qemu-iotests/131.out
Signature · 1 line
2.1.0