[PATCH v2 0/2] qcow2: Fix image corruption bug in 4.1

Kevin Wolf posted 2 patches 4 years, 5 months ago
Test asan passed
Test checkpatch passed
Test FreeBSD passed
Test docker-mingw@fedora passed
Test docker-clang@ubuntu passed
Test docker-quick@centos7 passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20191024142658.22306-1-kwolf@redhat.com
Maintainers: Stefan Hajnoczi <stefanha@redhat.com>, Kevin Wolf <kwolf@redhat.com>, Max Reitz <mreitz@redhat.com>
include/qemu/coroutine.h | 15 +++++++++++++++
block/qcow2-refcount.c   |  2 ++
block/qcow2.c            |  3 ++-
3 files changed, 19 insertions(+), 1 deletion(-)
[PATCH v2 0/2] qcow2: Fix image corruption bug in 4.1
Posted by Kevin Wolf 4 years, 5 months ago
This series fixes an image corruption bug that was introduced in commit
69f47505e ('block: avoid recursive block_status call if possible'),
first contained in the QEMU 4.1.0 release.

This bug was reported by Michael Weiser on Launchpad:
https://bugs.launchpad.net/qemu/+bug/1846427

v2:

- Dropped the assertion in qcow2_cache_do_get() for now. Making sure
  that it actually holds true for all callers requires more work and
  getting the corruption fix in quickly is important.

- Use atomic_read() and add comment to qemu_co_mutex_assert_locked()
  implementation [Denis]

Kevin Wolf (2):
  coroutine: Add qemu_co_mutex_assert_locked()
  qcow2: Fix corruption bug in qcow2_detect_metadata_preallocation()

 include/qemu/coroutine.h | 15 +++++++++++++++
 block/qcow2-refcount.c   |  2 ++
 block/qcow2.c            |  3 ++-
 3 files changed, 19 insertions(+), 1 deletion(-)

-- 
2.20.1


Re: [PATCH v2 0/2] qcow2: Fix image corruption bug in 4.1
Posted by Max Reitz 4 years, 5 months ago
On 24.10.19 16:26, Kevin Wolf wrote:
> This series fixes an image corruption bug that was introduced in commit
> 69f47505e ('block: avoid recursive block_status call if possible'),
> first contained in the QEMU 4.1.0 release.
> 
> This bug was reported by Michael Weiser on Launchpad:
> https://bugs.launchpad.net/qemu/+bug/1846427
> 
> v2:
> 
> - Dropped the assertion in qcow2_cache_do_get() for now. Making sure
>   that it actually holds true for all callers requires more work and
>   getting the corruption fix in quickly is important.
> 
> - Use atomic_read() and add comment to qemu_co_mutex_assert_locked()
>   implementation [Denis]
> 
> Kevin Wolf (2):
>   coroutine: Add qemu_co_mutex_assert_locked()
>   qcow2: Fix corruption bug in qcow2_detect_metadata_preallocation()
> 
>  include/qemu/coroutine.h | 15 +++++++++++++++
>  block/qcow2-refcount.c   |  2 ++
>  block/qcow2.c            |  3 ++-
>  3 files changed, 19 insertions(+), 1 deletion(-)

Reviewed-by: Max Reitz <mreitz@redhat.com>

Re: [PATCH v2 0/2] qcow2: Fix image corruption bug in 4.1
Posted by Michael Weiser 4 years, 5 months ago
Hello Kevin,

On Thu, Oct 24, 2019 at 04:26:56PM +0200, Kevin Wolf wrote:

> Kevin Wolf (2):
>   coroutine: Add qemu_co_mutex_assert_locked()
>   qcow2: Fix corruption bug in qcow2_detect_metadata_preallocation()

Tested-by: Michael Weiser <michael.weiser@gmx.de>

with offending 69f47505e and today's master
(58560ad254fbda71d4daa6622d71683190070ee2).

Corruption does not happen with series applied.
Assertion tiggers as expected if lock is not taken.

FWIW: Reviewed-by: Michael Weiser <michael.weiser@gmx.de>
-- 
Thanks,
Michael