All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] qcow2: Get the request alignment for encrypted images from QCryptoBlock
@ 2018-10-11 10:58 Alberto Garcia
  2018-10-11 11:01 ` Daniel P. Berrangé
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Alberto Garcia @ 2018-10-11 10:58 UTC (permalink / raw)
  To: qemu-devel
  Cc: Alberto Garcia, qemu-block, Kevin Wolf, Max Reitz,
	Daniel P . Berrangé

This doesn't have any practical effect at the moment because the
values of BDRV_SECTOR_SIZE, QCRYPTO_BLOCK_LUKS_SECTOR_SIZE and
QCRYPTO_BLOCK_QCOW_SECTOR_SIZE are all the same (512 bytes), but
future encryption methods could have different requirements.

Signed-off-by: Alberto Garcia <berto@igalia.com>
---
 block/qcow2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/qcow2.c b/block/qcow2.c
index 7277feda13..010a1b3924 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -1627,7 +1627,7 @@ static void qcow2_refresh_limits(BlockDriverState *bs, Error **errp)
 
     if (bs->encrypted) {
         /* Encryption works on a sector granularity */
-        bs->bl.request_alignment = BDRV_SECTOR_SIZE;
+        bs->bl.request_alignment = qcrypto_block_get_sector_size(s->crypto);
     }
     bs->bl.pwrite_zeroes_alignment = s->cluster_size;
     bs->bl.pdiscard_alignment = s->cluster_size;
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] qcow2: Get the request alignment for encrypted images from QCryptoBlock
  2018-10-11 10:58 [Qemu-devel] [PATCH] qcow2: Get the request alignment for encrypted images from QCryptoBlock Alberto Garcia
@ 2018-10-11 11:01 ` Daniel P. Berrangé
  2018-10-11 16:02 ` Kevin Wolf
  2018-10-15 16:38 ` Max Reitz
  2 siblings, 0 replies; 5+ messages in thread
From: Daniel P. Berrangé @ 2018-10-11 11:01 UTC (permalink / raw)
  To: Alberto Garcia; +Cc: qemu-devel, qemu-block, Kevin Wolf, Max Reitz

On Thu, Oct 11, 2018 at 01:58:02PM +0300, Alberto Garcia wrote:
> This doesn't have any practical effect at the moment because the
> values of BDRV_SECTOR_SIZE, QCRYPTO_BLOCK_LUKS_SECTOR_SIZE and
> QCRYPTO_BLOCK_QCOW_SECTOR_SIZE are all the same (512 bytes), but
> future encryption methods could have different requirements.

Yep, this matches what we do in block/crypto.c

> 
> Signed-off-by: Alberto Garcia <berto@igalia.com>
> ---
>  block/qcow2.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] qcow2: Get the request alignment for encrypted images from QCryptoBlock
  2018-10-11 10:58 [Qemu-devel] [PATCH] qcow2: Get the request alignment for encrypted images from QCryptoBlock Alberto Garcia
  2018-10-11 11:01 ` Daniel P. Berrangé
@ 2018-10-11 16:02 ` Kevin Wolf
  2018-10-15 16:38 ` Max Reitz
  2 siblings, 0 replies; 5+ messages in thread
From: Kevin Wolf @ 2018-10-11 16:02 UTC (permalink / raw)
  To: Alberto Garcia
  Cc: qemu-devel, qemu-block, Max Reitz, Daniel P . Berrangé

Am 11.10.2018 um 12:58 hat Alberto Garcia geschrieben:
> This doesn't have any practical effect at the moment because the
> values of BDRV_SECTOR_SIZE, QCRYPTO_BLOCK_LUKS_SECTOR_SIZE and
> QCRYPTO_BLOCK_QCOW_SECTOR_SIZE are all the same (512 bytes), but
> future encryption methods could have different requirements.
> 
> Signed-off-by: Alberto Garcia <berto@igalia.com>

Thanks, applied to the block branch.

Kevin

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] qcow2: Get the request alignment for encrypted images from QCryptoBlock
  2018-10-11 10:58 [Qemu-devel] [PATCH] qcow2: Get the request alignment for encrypted images from QCryptoBlock Alberto Garcia
  2018-10-11 11:01 ` Daniel P. Berrangé
  2018-10-11 16:02 ` Kevin Wolf
@ 2018-10-15 16:38 ` Max Reitz
  2018-10-16 10:32   ` Daniel P. Berrangé
  2 siblings, 1 reply; 5+ messages in thread
From: Max Reitz @ 2018-10-15 16:38 UTC (permalink / raw)
  To: Alberto Garcia, qemu-devel
  Cc: qemu-block, Kevin Wolf, Daniel P . Berrangé

[-- Attachment #1: Type: text/plain, Size: 1028 bytes --]

On 11.10.18 12:58, Alberto Garcia wrote:
> This doesn't have any practical effect at the moment because the
> values of BDRV_SECTOR_SIZE, QCRYPTO_BLOCK_LUKS_SECTOR_SIZE and
> QCRYPTO_BLOCK_QCOW_SECTOR_SIZE are all the same (512 bytes), but
> future encryption methods could have different requirements.
> 
> Signed-off-by: Alberto Garcia <berto@igalia.com>
> ---
>  block/qcow2.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

This breaks non-LUKS encryption:

$ ./qemu-img create -f qcow2 -o encryption=on,encrypt.key-secret=secret
--object secret,id=secret,data=foo foo.qcow2 64M
Formatting 'foo.qcow2', fmt=qcow2 size=67108864 encryption=on
encrypt.key-secret=secret cluster_size=65536 lazy_refcounts=off
refcount_bits=16
qemu-img: block.c:1248: bdrv_open_driver: Assertion
`is_power_of_2(bs->bl.request_alignment)' failed.
[1]    13589 abort (core dumped)  ./qemu-img create -f qcow2 -o
encryption=on,encrypt.key-secret=secret --objec

(As seen in iotests 049, 087, 134, and 158.)

Max


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] qcow2: Get the request alignment for encrypted images from QCryptoBlock
  2018-10-15 16:38 ` Max Reitz
@ 2018-10-16 10:32   ` Daniel P. Berrangé
  0 siblings, 0 replies; 5+ messages in thread
From: Daniel P. Berrangé @ 2018-10-16 10:32 UTC (permalink / raw)
  To: Max Reitz; +Cc: Alberto Garcia, qemu-devel, qemu-block, Kevin Wolf

On Mon, Oct 15, 2018 at 06:38:14PM +0200, Max Reitz wrote:
> On 11.10.18 12:58, Alberto Garcia wrote:
> > This doesn't have any practical effect at the moment because the
> > values of BDRV_SECTOR_SIZE, QCRYPTO_BLOCK_LUKS_SECTOR_SIZE and
> > QCRYPTO_BLOCK_QCOW_SECTOR_SIZE are all the same (512 bytes), but
> > future encryption methods could have different requirements.
> > 
> > Signed-off-by: Alberto Garcia <berto@igalia.com>
> > ---
> >  block/qcow2.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> This breaks non-LUKS encryption:
> 
> $ ./qemu-img create -f qcow2 -o encryption=on,encrypt.key-secret=secret
> --object secret,id=secret,data=foo foo.qcow2 64M
> Formatting 'foo.qcow2', fmt=qcow2 size=67108864 encryption=on
> encrypt.key-secret=secret cluster_size=65536 lazy_refcounts=off
> refcount_bits=16
> qemu-img: block.c:1248: bdrv_open_driver: Assertion
> `is_power_of_2(bs->bl.request_alignment)' failed.
> [1]    13589 abort (core dumped)  ./qemu-img create -f qcow2 -o
> encryption=on,encrypt.key-secret=secret --objec
> 
> (As seen in iotests 049, 087, 134, and 158.)

We failed to set sector size in the crypto backend when opening with
the NO_IO flag set. I just sent a fix for that. Feel free to queue it
as part of the block layer rather than waiting for my next crypto layer
pull request.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-10-16 10:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-11 10:58 [Qemu-devel] [PATCH] qcow2: Get the request alignment for encrypted images from QCryptoBlock Alberto Garcia
2018-10-11 11:01 ` Daniel P. Berrangé
2018-10-11 16:02 ` Kevin Wolf
2018-10-15 16:38 ` Max Reitz
2018-10-16 10:32   ` Daniel P. Berrangé

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.