qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
	qemu-devel@nongnu.org, qemu-block@nongnu.org
Cc: kwolf@redhat.com, mreitz@redhat.com,
	"Daniel P. Berrange" <berrange@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 1/2] qcow2: add overlap check for bitmap directory
Date: Fri, 1 Dec 2017 11:59:46 -0600	[thread overview]
Message-ID: <2f4391f0-bbe1-07d9-83eb-82672c5583a9@redhat.com> (raw)
In-Reply-To: <20171130164750.47320-2-vsementsov@virtuozzo.com>

[adding Dan in cc]

On 11/30/2017 10:47 AM, Vladimir Sementsov-Ogievskiy wrote:
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
>   block/qcow2.h          |  7 +++++--
>   block/qcow2-refcount.c | 12 ++++++++++++
>   block/qcow2.c          |  6 ++++++
>   3 files changed, 23 insertions(+), 2 deletions(-)
> 

Does the LUKS encryption header need similar overlap protection checks?

> diff --git a/block/qcow2.h b/block/qcow2.h
> index 6f0ff15dd0..8f226a3609 100644
> --- a/block/qcow2.h
> +++ b/block/qcow2.h

> +++ b/block/qcow2-refcount.c
> @@ -2585,6 +2585,18 @@ int qcow2_check_metadata_overlap(BlockDriverState *bs, int ign, int64_t offset,
>           }
>       }
>   
> +    if ((chk & QCOW2_OL_BITMAP_DIRECTORY) &&
> +        (s->autoclear_features & QCOW2_AUTOCLEAR_BITMAPS))
> +    {
> +        /* update_ext_header_and_dir_in_place firstly drop autoclear flag,
> +         * so it will not fail */

Wording is awkward, how about:

The autoclear flag was previously dropped by 
update_ext_header_and_dir_in_place, so this will not fail

but I'm not sure if that is the intended meaning.

> +        if (overlaps_with(s->bitmap_directory_offset,
> +                          s->bitmap_directory_size))
> +        {
> +            return QCOW2_OL_BITMAP_DIRECTORY;
> +        }
> +    }
> +
>       return 0;
>   }

Do we need to add/update any iotests to cover this?

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

  reply	other threads:[~2017-12-01 17:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-30 16:47 [Qemu-devel] [PATCH for-2.12 0/2] qcow2: add overlap check for bitmap directory Vladimir Sementsov-Ogievskiy
2017-11-30 16:47 ` [Qemu-devel] [PATCH 1/2] " Vladimir Sementsov-Ogievskiy
2017-12-01 17:59   ` Eric Blake [this message]
2017-12-06 22:56   ` [Qemu-devel] [Qemu-block] " John Snow
     [not found]     ` <2af21d5f-3ad9-3492-03ea-c720929c4e36@virtuozzo.com>
2017-12-07 17:03       ` John Snow
2018-01-29 15:34   ` [Qemu-devel] " Max Reitz
2018-02-02 12:07     ` Vladimir Sementsov-Ogievskiy
2018-02-02 13:00       ` Max Reitz
2018-02-02 13:48         ` Vladimir Sementsov-Ogievskiy
2018-02-02 13:53           ` Max Reitz
2018-02-02 14:28             ` Vladimir Sementsov-Ogievskiy
2017-11-30 16:47 ` [Qemu-devel] [PATCH 2/2] qcow2: fix indentation after previous patch Vladimir Sementsov-Ogievskiy
2017-12-01 17:56   ` Eric Blake
2017-12-08 18:53   ` [Qemu-devel] [Qemu-block] " John Snow
2018-03-16 22:21 ` [Qemu-devel] [Qemu-block] [PATCH for-2.12 0/2] qcow2: add overlap check for bitmap directory John Snow
2018-03-19  6:49   ` Vladimir Sementsov-Ogievskiy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2f4391f0-bbe1-07d9-83eb-82672c5583a9@redhat.com \
    --to=eblake@redhat.com \
    --cc=berrange@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=vsementsov@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).