]> git.proxmox.com Git - mirror_qemu.git/commit
qcow2: fix encryption during cow of sectors
authorDaniel P. Berrange <berrange@redhat.com>
Tue, 6 Sep 2016 14:26:37 +0000 (15:26 +0100)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Wed, 2 Nov 2016 21:51:20 +0000 (16:51 -0500)
commitf9856029d59f4c6a580ebbf03d81c4016c19696a
treed4228767deeb137fe30e1e0a711d287b556ba388
parenta3a254550b45500c42e30967a9733ae8d46ef0d6
qcow2: fix encryption during cow of sectors

Broken in previous commit:

  commit aaa4d20b4972bb1a811ce929502e6741835d584e
  Author: Kevin Wolf <kwolf@redhat.com>
  Date:   Wed Jun 1 15:21:05 2016 +0200

      qcow2: Make copy_sectors() byte based

The copy_sectors() code was originally using the 'sector'
parameter for encryption, which was passed in by the caller
from the QCowL2Meta.offset field (aka the guest logical
offset).

After the change, the code is using 'cluster_offset' which
was passed in from QCow2L2Meta.alloc_offset field (aka the
host physical offset).

This would cause the data to be encrypted using an incorrect
initialization vector which will in turn cause later reads
to return garbage.

Although current qcow2 built-in encryption is blocked from
usage in the emulator, one could still hit this if writing
to the file via qemu-{img,io,nbd} commands.

Cc: qemu-stable@nongnu.org
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit bb9f8dd0e15a9744b8d09d06ecb6a18ca3dcc173)
Conflicts:
tests/qemu-iotests/group

* drop context dependancy on non-2.7 iotest groups

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
block/qcow2-cluster.c
tests/qemu-iotests/158 [new file with mode: 0755]
tests/qemu-iotests/158.out [new file with mode: 0644]
tests/qemu-iotests/group