Re: [Qemu-block] [PATCH v2 6/7] curl: Handle success in multi_check_completion

2019-09-13 Thread Maxim Levitsky
On Fri, 2019-09-13 at 13:20 +0200, Max Reitz wrote: > On 10.09.19 18:13, Maxim Levitsky wrote: > > On Tue, 2019-09-10 at 14:41 +0200, Max Reitz wrote: > > > Background: As of cURL 7.59.0, it verifies that several functions are > > > not called from within a callback

Re: [Qemu-block] [PATCH v3 3/3] qemu-iotests: Add test for bz #1745922

2019-09-13 Thread Maxim Levitsky
On Fri, 2019-09-13 at 13:01 +0200, Max Reitz wrote: > On 13.09.19 00:37, Maxim Levitsky wrote: > > Signed-off-by: Maxim Levitsky > > --- > > tests/qemu-iotests/263 | 91 ++ > > tests/qemu-iotests/263.out | 40 + &g

[Qemu-block] [PATCH v4 0/3] Fix qcow2+luks corruption introduced by commit 8ac0f15f335

2019-09-13 Thread Maxim Levitsky
simplifies everything. Best regards, Maxim Levitsky Maxim Levitsky (3): block/qcow2: refactoring of threaded encryption code block/qcow2: fix the corruption when rebasing luks encrypted files qemu-iotests: Add test for bz #1745922 block/qcow2-cluster.c | 29 +++- b

[Qemu-block] [PATCH v4 1/3] block/qcow2: refactoring of threaded encryption code

2019-09-13 Thread Maxim Levitsky
This commit tries to clarify few function arguments, and add comments describing the encrypt/decrypt interface Signed-off-by: Maxim Levitsky --- block/qcow2-cluster.c | 9 --- block/qcow2-threads.c | 62 ++- block/qcow2.c | 5 ++-- block

[Qemu-block] [PATCH v4 3/3] qemu-iotests: Add test for bz #1745922

2019-09-13 Thread Maxim Levitsky
Signed-off-by: Maxim Levitsky --- tests/qemu-iotests/263 | 91 ++ tests/qemu-iotests/263.out | 40 + tests/qemu-iotests/group | 1 + 3 files changed, 132 insertions(+) create mode 100755 tests/qemu-iotests/263 create mode 100644 tests

[Qemu-block] [PATCH v4 2/3] block/qcow2: fix the corruption when rebasing luks encrypted files

2019-09-13 Thread Maxim Levitsky
uch writes, and causes some files with zero areas to contain garbage there instead. But as described above it can happen elsewhere as well Signed-off-by: Maxim Levitsky Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz --- block/qcow2-cluster.c | 30 +---

Re: [Qemu-block] [PATCH v3 1/3] block/qcow2: refactoring of threaded encryption code

2019-09-13 Thread Maxim Levitsky
On Fri, 2019-09-13 at 12:37 +0200, Max Reitz wrote: > On 13.09.19 00:37, Maxim Levitsky wrote: > > This commit tries to clarify few function arguments, > > and add comments describing the encrypt/decrypt interface > > > > Signed-off-by: Maxim Levitsky > > --

Re: [Qemu-block] [Qemu-devel] [PATCH 1/2] block/nvme: add support for write zeros

2019-09-13 Thread Maxim Levitsky
is correct or working without a unit test, a spec, or > some instructions to help me verify any of this does what it looks like > it does. > > On 8/25/19 3:15 AM, Maxim Levitsky wrote: > > Signed-off-by: Maxim Levitsky > > --- > > block/nvme.c | 72

[Qemu-block] [PATCH v2 2/2] block/nvme: add support for discard

2019-09-13 Thread Maxim Levitsky
Signed-off-by: Maxim Levitsky --- block/nvme.c | 83 ++ block/trace-events | 2 ++ 2 files changed, 85 insertions(+) diff --git a/block/nvme.c b/block/nvme.c index d95265fae4..c17edd6aae 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -112,6

[Qemu-block] [PATCH v2 0/2] block/nvme: add support for write zeros and discard

2019-09-13 Thread Maxim Levitsky
This is the second part of the patches I prepared for this driver back when I worked on mdev-nvme. V2: addressed review feedback, no major changes Best regards, Maxim Levitsky Maxim Levitsky (2): block/nvme: add support for write zeros block/nvme: add support for discard block

[Qemu-block] [PATCH v2 1/2] block/nvme: add support for write zeros

2019-09-13 Thread Maxim Levitsky
Signed-off-by: Maxim Levitsky --- block/nvme.c | 72 +++- block/trace-events | 1 + include/block/nvme.h | 19 +++- 3 files changed, 90 insertions(+), 2 deletions(-) diff --git a/block/nvme.c b/block/nvme.c index 5be3a39b63..d95265fae4

Re: [Qemu-block] [Qemu-devel] [PATCH v4 1/3] block/qcow2: refactoring of threaded encryption code

2019-09-13 Thread Maxim Levitsky
On Fri, 2019-09-13 at 14:01 +, Vladimir Sementsov-Ogievskiy wrote: > 13.09.2019 15:59, Maxim Levitsky wrote: > > This commit tries to clarify few function arguments, > > and add comments describing the encrypt/decrypt interface > > > > Signed-off-by: Maxim Levitsky

Re: [Qemu-block] [Qemu-devel] [PATCH v4 1/3] block/qcow2: refactoring of threaded encryption code

2019-09-13 Thread Maxim Levitsky
On Fri, 2019-09-13 at 16:24 +0200, Kevin Wolf wrote: > Am 13.09.2019 um 16:07 hat Maxim Levitsky geschrieben: > > On Fri, 2019-09-13 at 14:01 +, Vladimir Sementsov-Ogievskiy wrote: > > > 13.09.2019 15:59, Maxim Levitsky wrote: > > > > This commit tries to

[Qemu-block] [PATCH v5 0/3] Fix qcow2+luks corruption introduced by commit 8ac0f15f335

2019-09-13 Thread Maxim Levitsky
simplifies everything. V5: reworked the patches so one of them fixes the bug only and other one is just refactoring Best regards, Maxim Levitsky Maxim Levitsky (3): Fix qcow2+luks corruption introduced by commit 8ac0f15f335 block/qcow2: refactor threaded encryption code qemu-io

[Qemu-block] [PATCH v5 1/3] Fix qcow2+luks corruption introduced by commit 8ac0f15f335

2019-09-13 Thread Maxim Levitsky
s. In the bugreport that was triggered by rebasing a luks image to new, zero filled base, which lot of such writes, and causes some files with zero areas to contain garbage there instead. But as described above it can happen elsewhere as well Signed-off-by: Maxim Levitsky --- block/qcow2-clu

[Qemu-block] [PATCH v5 3/3] qemu-iotests: Add test for bz #1745922

2019-09-13 Thread Maxim Levitsky
Signed-off-by: Maxim Levitsky --- tests/qemu-iotests/263 | 91 ++ tests/qemu-iotests/263.out | 40 + tests/qemu-iotests/group | 2 + 3 files changed, 133 insertions(+) create mode 100755 tests/qemu-iotests/263 create mode 100644 tests

[Qemu-block] [PATCH v5 2/3] block/qcow2: refactor threaded encryption code

2019-09-13 Thread Maxim Levitsky
qcow2_co_encrypt arguments to prevent that bug from happening again Signed-off-by: Maxim Levitsky --- block/qcow2-cluster.c | 30 - block/qcow2-threads.c | 62 ++- block/qcow2.c | 5 ++-- block/qcow2.h | 8 +++--- 4

Re: [Qemu-block] [PATCH v5 2/3] block/qcow2: refactor threaded encryption code

2019-09-13 Thread Maxim Levitsky
On Fri, 2019-09-13 at 16:11 +, Vladimir Sementsov-Ogievskiy wrote: > 13.09.2019 18:28, Maxim Levitsky wrote: > > Change do_perform_cow_encrypt and its callee qcow2_co_encrypt > > to just receive full host and guest offsets and in pariticular > > remove the offset_in

Re: [Qemu-block] [PATCH v5 3/3] qemu-iotests: Add test for bz #1745922

2019-09-13 Thread Maxim Levitsky
On Fri, 2019-09-13 at 16:27 +, Vladimir Sementsov-Ogievskiy wrote: > 13.09.2019 18:28, Maxim Levitsky wrote: > > Signed-off-by: Maxim Levitsky > > --- > > tests/qemu-iotests/263 | 91 ++ > > test

Re: [Qemu-block] [PATCH v5 3/3] qemu-iotests: Add test for bz #1745922

2019-09-13 Thread Maxim Levitsky
On Fri, 2019-09-13 at 16:57 +, Vladimir Sementsov-Ogievskiy wrote: > 13.09.2019 19:39, Maxim Levitsky wrote: > > On Fri, 2019-09-13 at 16:27 +, Vladimir Sementsov-Ogievskiy wrote: > > > 13.09.2019 18:28, Maxim Levitsky wrote: > > > >

[Qemu-block] [PATCH v6 0/3] Fix qcow2+luks corruption introduced by commit 8ac0f15f335

2019-09-13 Thread Maxim Levitsky
simplifies everything. V5: reworked the patches so one of them fixes the bug only and other one is just refactoring V6: removed do_perform_cow_encrypt Best regards, Maxim Levitsky Maxim Levitsky (3): Fix qcow2+luks corruption introduced by commit 8ac0f15f335 block/qcow2: refacto

[Qemu-block] [PATCH v6 2/3] block/qcow2: refactor threaded encryption code

2019-09-13 Thread Maxim Levitsky
qcow2_co_encrypt Also document the qcow2_co_encrypt arguments to prevent that bug from happening again Signed-off-by: Maxim Levitsky Reviewed-by: Vladimir Sementsov-Ogievskiy --- block/qcow2-cluster.c | 35 +-- block/qcow2-threads.c | 81

[Qemu-block] [PATCH v6 3/3] qemu-iotests: Add test for bz #1745922

2019-09-13 Thread Maxim Levitsky
Signed-off-by: Maxim Levitsky Tested-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/263 | 91 ++ tests/qemu-iotests/263.out | 40 + tests/qemu-iotests/group | 1 + 3 files changed, 132 insertions(+) create mode 100755 tests

[Qemu-block] [PATCH v6 1/3] Fix qcow2+luks corruption introduced by commit 8ac0f15f335

2019-09-13 Thread Maxim Levitsky
s. In the bugreport that was triggered by rebasing a luks image to new, zero filled base, which lot of such writes, and causes some files with zero areas to contain garbage there instead. But as described above it can happen elsewhere as well Signed-off-by: Maxim Levitsky Reviewed-by: Vladimir

Re: [Qemu-block] [Qemu-devel] [PATCH v6 2/3] block/qcow2: refactor threaded encryption code

2019-09-13 Thread Maxim Levitsky
On Fri, 2019-09-13 at 17:51 +, Vladimir Sementsov-Ogievskiy wrote: > 13.09.2019 20:27, Maxim Levitsky wrote: > > Change the qcow2_co_encrypt to just receive full host and > > guest offsets and in pariticular remove the > > offset_in_cluster parameter of do_perform_cow_enc

[Qemu-block] [PATCH v7 2/3] block/qcow2: refactor encryption code

2019-09-15 Thread Maxim Levitsky
{encrypt|decrypt} arguments to prevent the bug fixed in former commit from hopefully happening again. Signed-off-by: Maxim Levitsky --- block/qcow2-cluster.c | 41 ++-- block/qcow2-threads.c | 63 +-- block/qcow2.c | 5

[Qemu-block] [PATCH v7 0/3] Fix qcow2+luks corruption introduced by commit 8ac0f15f335

2019-09-15 Thread Maxim Levitsky
bit Best regards, Maxim Levitsky Maxim Levitsky (3): block/qcow2: Fix corruption introduced by commit 8ac0f15f335 block/qcow2: refactor encryption code qemu-iotests: Add test for bz #1745922 block/qcow2-cluster.c | 40 ++--- block/qcow2-threads.c

[Qemu-block] [PATCH v7 1/3] block/qcow2: Fix corruption introduced by commit 8ac0f15f335

2019-09-15 Thread Maxim Levitsky
avoid all these assumptions. In the bugreport that was triggered by rebasing a luks image to new, zero filled base, which lot of such writes, and causes some files with zero areas to contain garbage there instead. But as described above it can happen elsewhere as well Signed-off-by: Maxim Levitsky

[Qemu-block] [PATCH v7 3/3] qemu-iotests: Add test for bz #1745922

2019-09-15 Thread Maxim Levitsky
Signed-off-by: Maxim Levitsky Tested-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/263 | 91 ++ tests/qemu-iotests/263.out | 40 + tests/qemu-iotests/group | 1 + 3 files changed, 132 insertions(+) create mode 100755 tests

Re: [Qemu-block] [PATCH v7 0/3] Fix qcow2+luks corruption introduced by commit 8ac0f15f335

2019-09-16 Thread Maxim Levitsky
On Mon, 2019-09-16 at 15:39 +0200, Max Reitz wrote: > On 15.09.19 22:36, Maxim Levitsky wrote: > > Commit 8ac0f15f335 accidently broke the COW of non changed areas > > of newly allocated clusters, when the write spans multiple clusters, > > and needs COW both prior and afte

Re: [Qemu-block] [PATCH v7 0/3] Fix qcow2+luks corruption introduced by commit 8ac0f15f335

2019-09-16 Thread Maxim Levitsky
On Mon, 2019-09-16 at 16:59 +0300, Maxim Levitsky wrote: > On Mon, 2019-09-16 at 15:39 +0200, Max Reitz wrote: > > On 15.09.19 22:36, Maxim Levitsky wrote: > > > Commit 8ac0f15f335 accidently broke the COW of non changed areas > > > of newly allocated clusters, wh

Re: [Qemu-block] [PATCH 1/8] block: Handle filter truncation like native impl.

2019-09-18 Thread Maxim Levitsky
s, but I myself don't mind this :-) > ret = refresh_total_sectors(bs, offset >> BDRV_SECTOR_BITS); > if (ret < 0) { > error_setg_errno(errp, -ret, "Could not refresh total sector count"); Looks all right to me, although I don't know the block filters well yet. Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky

Re: [Qemu-block] [PATCH 2/8] block/cor: Drop cor_co_truncate()

2019-09-18 Thread Maxim Levitsky
> .bdrv_child_perm= cor_child_perm, > > .bdrv_getlength = cor_getlength, > -.bdrv_co_truncate = cor_co_truncate, > > .bdrv_co_preadv = cor_co_preadv, > .bdrv_co_pwritev= cor_co_pwritev, Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky

Re: [Qemu-block] [PATCH 5/8] block: Evaluate @exact in protocol drivers

2019-09-18 Thread Maxim Levitsky
amp;& exact) { > + error_setg(errp, "Cannot resize iSCSI devices"); > +return -ENOTSUP; > +} else if (offset > cur_length) { > error_setg(errp, "Cannot grow iSCSI devices"); > return -EINVAL; > } Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky

Re: [Qemu-block] [PATCH 3/8] block: Do not truncate file node when formatting

2019-09-18 Thread Maxim Levitsky
goto out; > -} > - > /* Write the header */ > QEMU_BUILD_BUG_ON((1 << MIN_CLUSTER_BITS) < sizeof(*header)); > header = g_malloc0(cluster_size); As long as bdrv_co_create_ops still creates the underlying file with bdrv_create_file or so, I also don't see a reason to truncate it to 0 afterward. Especially for block devices... So, Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky

Re: [Qemu-block] [PATCH 6/8] block: Let format drivers pass @exact

2019-09-18 Thread Maxim Levitsky
at.c > @@ -387,7 +387,7 @@ static int coroutine_fn raw_co_truncate(BlockDriverState > *bs, int64_t offset, > > s->size = offset; > offset += s->offset; > -return bdrv_co_truncate(bs->file, offset, false, prealloc, errp); > +return bdrv_co_truncate(bs->file, offset, exact, prealloc, errp); > } > > static void raw_eject(BlockDriverState *bs, bool eject_flag) Looks all right. Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky

Re: [Qemu-block] [PATCH 8/8] Revert "qemu-img: Check post-truncation size"

2019-09-18 Thread Maxim Levitsky
ed-by: Maxim Levitsky Best regards, Maxim Levitsky

Re: [Qemu-block] [PATCH 4/8] block: Add @exact parameter to bdrv_co_truncate()

2019-09-18 Thread Maxim Levitsky
ations evaluate it, so that > this patch does not change existing behavior. Future patches take care > of that. > > Suggested-by: Maxim Levitsky > Signed-off-by: Max Reitz > --- > include/block/block.h | 6 +++--- > include/block/block_int.h | 17 +

Re: [Qemu-block] [PATCH 7/8] block: Pass truncate exact=true where reasonable

2019-09-18 Thread Maxim Levitsky
rgv) > return offset; > } > > -ret = blk_truncate(blk, offset, false, PREALLOC_MODE_OFF, &local_err); > +/* > + * qemu-io is a debugging tool, so let us be strict here and pass > + * exact=true. It is better to err on the "emit more errors" side > + * than to be overly permissive. > + */ Also agree. > +ret = blk_truncate(blk, offset, true, PREALLOC_MODE_OFF, &local_err); > if (ret < 0) { > error_report_err(local_err); > return ret; Other than few nitpicks which probably aren't important, Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky

Re: [Qemu-devel] [PATCH v2 00/11] RFC crypto/luks: encryption key managment using amend interface

2019-09-22 Thread Maxim Levitsky
On Fri, 2019-09-20 at 17:14 -0400, John Snow wrote: > > On 9/12/19 6:30 PM, Maxim Levitsky wrote: > > This patch series is continuation of my work to add encryption > > key managment to luks/qcow2 with luks. > > > > This is second version of this patch set. > &g

Re: [PATCH v2 01/11] qcrypto: add suport for amend options

2019-09-23 Thread Maxim Levitsky
On Mon, 2019-09-23 at 08:08 -0500, Eric Blake wrote: > On 9/12/19 5:30 PM, Maxim Levitsky wrote: > > This adds the qcrypto_amend_options and corresponding > > crypto driver callbacks for the for encrypted > > grammar is off, did you miss a word where that double space is? &

[PATCH] qemu-pr-helper: fix crash in mpath_reconstruct_sense

2019-09-23 Thread Maxim Levitsky
d to do so. However qemu-pr-helper should not crash in this case. Signed-off-by: Maxim Levitsky --- scsi/qemu-pr-helper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scsi/qemu-pr-helper.c b/scsi/qemu-pr-helper.c index a8a74d1dba..debb18f4aa 100644 --- a/scsi/qemu-pr-help

[PATCH v2 00/13] crypto/luks: preparation for encryption key managment

2019-09-25 Thread Maxim Levitsky
an open bug that waits to be closed. Its also is form of refactoring, and thus I guess it makes sense to include it here. Best regards, Maxim Levitsky Maxim Levitsky (13): block-crypto: misc refactoring qcrypto-luks: rename some fields in QCryptoBlockLUKSHeader qcrypto-luks: don&#

[PATCH v2 01/13] block-crypto: misc refactoring

2019-09-25 Thread Maxim Levitsky
* rename the write_func to create_write_func, and init_func to create_init_func this is preparation for other write_func that will be used to update the encryption keys. No functional changes Signed-off-by: Maxim Levitsky Reviewed-by: Daniel P. Berrangé --- block/crypto.c | 12

[PATCH v2 03/13] qcrypto-luks: don't overwrite cipher_mode in header

2019-09-25 Thread Maxim Levitsky
This way we can store the header we loaded, which will be used in key management code Signed-off-by: Maxim Levitsky Reviewed-by: Daniel P. Berrangé --- crypto/block-luks.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/crypto/block-luks.c b/crypto/block-luks.c

[PATCH v2 02/13] qcrypto-luks: rename some fields in QCryptoBlockLUKSHeader

2019-09-25 Thread Maxim Levitsky
* key_bytes -> master_key_len * payload_offset = payload_offset_sector (to emphasise that this isn't byte offset) * key_offset -> key_offset_sector - same as above for luks slots Signed-off-by: Maxim Levitsky Reviewed-by: Daniel P. Berrangé --- crypto/block-

[PATCH v2 06/13] qcrypto-luks: use the parsed encryption settings in QCryptoBlockLUKS

2019-09-25 Thread Maxim Levitsky
Prior to that patch, the parsed encryption settings were already stored into the QCryptoBlockLUKS but not used anywhere but in qcrypto_block_luks_get_info Using them simplifies the code Signed-off-by: Maxim Levitsky Reviewed-by: Daniel P. Berrangé --- crypto/block-luks.c | 169

[PATCH v2 09/13] qcrypto-luks: extract check and parse header

2019-09-25 Thread Maxim Levitsky
This is just to make qcrypto_block_luks_open more reasonable in size. Signed-off-by: Maxim Levitsky Reviewed-by: Daniel P. Berrangé --- crypto/block-luks.c | 223 +--- 1 file changed, 125 insertions(+), 98 deletions(-) diff --git a/crypto/block-luks.c b

[PATCH v2 08/13] qcrypto-luks: extract store and load header

2019-09-25 Thread Maxim Levitsky
Signed-off-by: Maxim Levitsky Reviewed-by: Daniel P. Berrangé --- crypto/block-luks.c | 155 ++-- 1 file changed, 93 insertions(+), 62 deletions(-) diff --git a/crypto/block-luks.c b/crypto/block-luks.c index b8f9b9c20a..47371edf13 100644 --- a/crypto

[PATCH v2 10/13] qcrypto-luks: extract store key function

2019-09-25 Thread Maxim Levitsky
This function will be used later to store new keys to the luks metadata Signed-off-by: Maxim Levitsky Reviewed-by: Daniel P. Berrangé --- crypto/block-luks.c | 304 ++-- 1 file changed, 181 insertions(+), 123 deletions(-) diff --git a/crypto/block

[PATCH v2 04/13] qcrypto-luks: simplify masterkey and masterkey length

2019-09-25 Thread Maxim Levitsky
Let the caller allocate masterkey Always use master key len from the header Signed-off-by: Maxim Levitsky Reviewed-by: Daniel P. Berrangé --- crypto/block-luks.c | 44 +--- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/crypto/block

[PATCH v2 11/13] qcrypto-luks: simplify the math used for keyslot locations

2019-09-25 Thread Maxim Levitsky
Signed-off-by: Maxim Levitsky Reviewed-by: Daniel P. Berrangé --- crypto/block-luks.c | 63 - 1 file changed, 40 insertions(+), 23 deletions(-) diff --git a/crypto/block-luks.c b/crypto/block-luks.c index 6d4e9eb348..a53d5d1916 100644 --- a/crypto

[PATCH v2 05/13] qcrypto-luks: pass keyslot index rather that pointer to the keyslot

2019-09-25 Thread Maxim Levitsky
Another minor refactoring Signed-off-by: Maxim Levitsky Reviewed-by: Daniel P. Berrangé --- crypto/block-luks.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crypto/block-luks.c b/crypto/block-luks.c index 9e59a791a6..b759cc8d19 100644 --- a/crypto/block-luks.c

[PATCH v2 07/13] qcrypto-luks: purge unused error codes from open callback

2019-09-25 Thread Maxim Levitsky
These values are not used by generic crypto code anyway Signed-off-by: Maxim Levitsky --- crypto/block-luks.c | 45 + 1 file changed, 13 insertions(+), 32 deletions(-) diff --git a/crypto/block-luks.c b/crypto/block-luks.c index f3bfc921b2

[PATCH v2 13/13] LUKS: better error message when creating too large files

2019-09-25 Thread Maxim Levitsky
etter, we can make luks driver, detect -EFBIG and in this case present a better error message, which is what this patch does The new error message is: qemu-img: error creating test.luks: The requested file size is too large Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1534898 Signed-off-b

[PATCH v2 12/13] qcrypto-luks: more rigorous header checking

2019-09-25 Thread Maxim Levitsky
Check that keyslots don't overlap with the data, and check that keyslots don't overlap with each other. (this is done using naive O(n^2) nested loops, but since there are just 8 keyslots, this doesn't really matter. Signed-off-by: Maxim Levitsky Reviewed-by: Daniel P. Berrangé --

Re: [PATCH] tests: fix I/O test for hosts defaulting to LUKSv2

2019-09-27 Thread Maxim Levitsky
-- open [--type ] [] - open device as mapping close - close device (remove mapping) I guess the documentation was not updated? I tested both by running the iotest 149, and by doing manually: dd if=/dev/zero bs=4K count=1000 of=./test cryptsetup -q -v luksFormat --type luks1 --cipher aes-xts-plain64 --key-size 512 --hash sha1 --key-slot 0 --key-file - --iter-time 10 ./test Tested-by: Maxim Levitsky Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky

Re: [PATCH v2 01/13] block-crypto: misc refactoring

2019-09-27 Thread Maxim Levitsky
On Fri, 2019-09-27 at 11:15 +0100, Daniel P. Berrangé wrote: > On Thu, Sep 26, 2019 at 12:35:15AM +0300, Maxim Levitsky wrote: > > * rename the write_func to create_write_func, > > and init_func to create_init_func > > this is preparation for other write_func that will &g

[PATCH 0/1] LUKS: Fix error message when underlying fs don't support large enough files

2020-04-16 Thread Maxim Levitsky
This is a repost of the same trivial patch I already, which fell through the cracks. Could someone queue it up so I close the bugzilla I have for this? Best regards, Maxim Levitsky Maxim Levitsky (1): block/crypto: better error message when creating too large files block/crypto.c

[PATCH 1/1] block/crypto: better error message when creating too large files

2020-04-16 Thread Maxim Levitsky
etter, we can make luks driver, detect -EFBIG and in this case present a better error message, which is what this patch does The new error message is: qemu-img: error creating test.luks: The requested file size is too large Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1534898 Signed-off-by: Maxim

Re: [PATCH 0/1] LUKS: Fix error message when underlying fs don't support large enough files

2020-04-16 Thread Maxim Levitsky
On Thu, 2020-04-16 at 12:50 +0300, Maxim Levitsky wrote: > This is a repost of the same trivial patch I already, which fell through the > cracks. > Could someone queue it up so I close the bugzilla I have for this? I a word - need more coffee :-) I mean I already posted this patch few m

Re: [PATCH 1/1] block/crypto: better error message when creating too large files

2020-04-20 Thread Maxim Levitsky
On Mon, 2020-04-20 at 11:02 +0200, Kevin Wolf wrote: > Am 16.04.2020 um 11:50 hat Maxim Levitsky geschrieben: > > Currently if you attampt to create too large file with luks you > > get the following error message: > > > > Formatting 'test.luks', fmt=luk

[PATCH v2 0/1] LUKS: Fix error message when underlying fs don't support large enough files

2020-04-20 Thread Maxim Levitsky
This is a repost of the same trivial patch I already, which fell through the cracks. Could someone queue it up so I close the bugzilla I have for this? V2: fixed usage of local_err Best regards, Maxim Levitsky Maxim Levitsky (1): block/crypto: better error message when creating too

[PATCH v2 1/1] block/crypto: better error message when creating too large files

2020-04-20 Thread Maxim Levitsky
etter, we can make luks driver, detect -EFBIG and in this case present a better error message, which is what this patch does The new error message is: qemu-img: error creating test.luks: The requested file size is too large Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1534898 Signed-off-b

Re: [PATCH v2 01/16] nvme: fix pci doorbell size calculation

2020-04-21 Thread Maxim Levitsky
;num_queues * > > NVME_DB_SIZE); > > Unrelated to this change, but it would be cleaner to initialize reg_size > using MAX_NUM_QUEUES, then in the I/O handler log GUEST_ERROR when > registers > n->num_queues accessed. This would model closer to the hardware. Agree. Also k

Re: [PATCH v2 02/16] nvme: rename trace events to pci_nvme

2020-04-21 Thread Maxim Levitsky
e_err_invalid_setfeat(uint32_t dw10) "invalid set features, > dw10=0x%"PRIx32"

Re: [PATCH v2 06/16] nvme: refactor nvme_addr_read

2020-04-21 Thread Maxim Levitsky
_dma_read(&n->parent_obj, addr, buf, size); > } > > static int nvme_check_sqid(NvmeCtrl *n, uint16_t sqid) Looks like I forgot to add reviewed-by to the patch from V6, but it looks all right after our discussion so, Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky

Re: [PATCH v2 08/16] nvme: remove redundant cmbloc/cmbsz members

2020-04-21 Thread Maxim Levitsky
me.h b/hw/block/nvme.h > index 1617787af2e9..7eecfd3a50f6 100644 > --- a/hw/block/nvme.h > +++ b/hw/block/nvme.h > @@ -88,8 +88,6 @@ typedef struct NvmeCtrl { > uint32_tnum_namespaces; > uint32_tmax_q_ents; > uint64_tns_size; > -uint32_tcmbsz; > -uint32_tcmbloc; > uint8_t *cmbuf; > uint64_tirq_status; > uint64_thost_timestamp; /* Timestamp sent by the > host */ Reviewed-by: Maxim Levitsky Best regards, Maxim levitsky

Re: [PATCH v2 09/16] nvme: factor out property/constraint checks

2020-04-21 Thread Maxim Levitsky
gt; + > bs_size = blk_getlength(n->conf.blk); > if (bs_size < 0) { > error_setg(errp, "could not get backing file size"); > return; > } > > - if (!n->params.serial) { > -error_setg(errp, "serial property not set"); > -return; > -} > blkconf_blocksizes(&n->conf); > if (!blkconf_apply_backend_options(&n->conf, > blk_is_read_only(n->conf.blk), > false, errp)) { Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky

Re: [PATCH v2 10/16] nvme: factor out device state setup

2020-04-21 Thread Maxim Levitsky
->num_namespaces; > > -n->namespaces = g_new0(NvmeNamespace, n->num_namespaces); > -n->sq = g_new0(NvmeSQueue *, n->params.max_ioqpairs + 1); > - n->cq = g_new0(NvmeCQueue *, n->params.max_ioqpairs + 1); > - > memory_region_init_io(&n->iomem, OBJECT(n), &nvme_mmio_ops, n, >"nvme", n->reg_size); > pci_register_bar(pci_dev, 0, Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky

Re: [PATCH v2 11/16] nvme: factor out block backend setup

2020-04-21 Thread Maxim Levitsky
; blk_is_read_only(n->conf.blk), > - false, errp)) { > +nvme_init_blk(n, &err); > + if (err) { > +error_propagate(errp, err); > return; > } > Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky

Re: [PATCH v2 12/16] nvme: add namespace helpers

2020-04-21 Thread Maxim Levitsky
rl; > > +static inline uint64_t nvme_ns_nlbas(NvmeCtrl *n, NvmeNamespace *ns) > +{ > +return n->ns_size >> nvme_ns_lbads(ns); > +} > + > #endif /* HW_NVME_H */ Nitpick: On second thought, these function names do sound quite cryptic, so maybe at least for nvme_n

Re: [PATCH v2 13/16] nvme: factor out namespace setup

2020-04-21 Thread Maxim Levitsky
dpc = 0; > -id_ns->dps = 0; > - id_ns->lbaf[0].ds = BDRV_SECTOR_BITS; > -id_ns->ncap = id_ns->nuse = id_ns->nsze = > -cpu_to_le64(nvme_ns_nlbas(n, ns)); > +nvme_init_namespace(n, &n->namespaces[i], &err); > +if (err) { > +error_propagate(errp, err); > +return; > +} > } > } > Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky

Re: [PATCH v2 14/16] nvme: factor out pci setup

2020-04-21 Thread Maxim Levitsky
> -PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_TYPE_64, > -&n->iomem); > -msix_init_exclusive_bar(pci_dev, n->params.max_ioqpairs + 1, 4, NULL); > - > id->vid = cpu_to_le16(pci_get_word(pci_conf + PCI_VENDOR_ID)); > id->ssvid = cpu_to_le16(pci_get_word(pci_conf + > PCI_SUBSYSTEM_VENDOR_ID)); > strpadcpy((char *)id->mn, sizeof(id->mn), "QEMU NVMe Ctrl", ' '); Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky

Re: [PATCH v2 15/16] nvme: factor out cmb setup

2020-04-21 Thread Maxim Levitsky
/ > -NVME_CMBSZ_SET_SZ(n->bar.cmbsz, n->params.cmb_size_mb); > - > -n->cmbuf = g_malloc0(NVME_CMBSZ_GETSIZE(n->bar.cmbsz)); > -memory_region_init_io(&n->ctrl_mem, OBJECT(n), &nvme_cmb_ops, n, > - "nvme-cmb", NVME_CMBSZ_GETSIZE(n->

Re: [PATCH v2 16/16] nvme: factor out controller identify setup

2020-04-21 Thread Maxim Levitsky
rror_propagate(errp, err); > +return; > +} > + > + > +nvme_init_state(n); > +nvme_init_blk(n, &err); > +if (err) { > +error_propagate(errp, err); > + return; > +} > + > +nvme_init_pci(n, pci_dev); > +nvme_init_ctrl(n, pci_dev); > + > for (i = 0; i < n->num_namespaces; i++) { > nvme_init_namespace(n, &n->namespaces[i], &err); > if (err) { Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky

Re: [PATCH v2 00/16] nvme: refactoring and cleanups

2020-04-21 Thread Maxim Levitsky
y setup > > hw/block/nvme.c | 433 -- > hw/block/nvme.h | 36 +++- > hw/block/trace-events | 172 - > include/block/nvme.h | 8 + > 4 files changed, 372 insertions(+), 277 deletions(-) > Should I also review the V7 series or I should wait for V8 which will not include these cleanups? Best regards, Maxim Levitsky

Re: [PATCH v3 04/16] nvme: move device parameters to separate struct

2020-04-22 Thread Maxim Levitsky
PROP_LINK("pmrdev", _state, pmrdev, TYPE_MEMORY_BACKEND, \ > + HostMemoryBackend *) > + > +typedef struct NvmeParams { > +char *serial; > +uint32_t num_queues; > +uint32_t cmb_size_mb; > +} NvmeParams; > + > typedef struct NvmeAsyncEvent { > QSIMPLEQ_ENTRY(NvmeAsyncEvent) entry; > NvmeAerResult result; > @@ -63,6 +77,7 @@ typedef struct NvmeCtrl { > MemoryRegion ctrl_mem; > NvmeBar bar; > BlockConfconf; > +NvmeParams params; > > uint32_tpage_size; > uint16_tpage_bits; > @@ -71,10 +86,8 @@ typedef struct NvmeCtrl { > uint16_tsqe_size; > uint32_treg_size; > uint32_tnum_namespaces; > -uint32_tnum_queues; > uint32_tmax_q_ents; > uint64_tns_size; > -uint32_tcmb_size_mb; > uint32_tcmbsz; > uint32_tcmbloc; > uint8_t *cmbuf; > @@ -82,7 +95,6 @@ typedef struct NvmeCtrl { > uint64_thost_timestamp; /* Timestamp sent by the > host */ > uint64_ttimestamp_set_qemu_clock_ms;/* QEMU clock time */ > > -char*serial; > HostMemoryBackend *pmrdev; > > NvmeNamespace *namespaces; Looks OK. Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky

Re: [PATCH v3 12/16] nvme: add namespace helpers

2020-04-22 Thread Maxim Levitsky
On Wed, 2020-04-22 at 09:09 +0200, Klaus Jensen wrote: > From: Klaus Jensen > > Introduce some small helpers to make the next patches easier on the eye. > > Signed-off-by: Klaus Jensen > Reviewed-by: Philippe Mathieu-Daudé > Reviewed-by: Maxim Levitsky > Reviewed-by:

Re: [PATCH v4 00/18] nvme: factor out cmb/pmr setup

2020-04-22 Thread Maxim Levitsky
| 31 ++- > hw/block/trace-events | 180 +++--- > include/block/nvme.h | 8 + > 4 files changed, 429 insertions(+), 333 deletions(-) > For the series: Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky

Re: [Qemu-devel] [PATCH 1/2] LUKS: better error message when creating too large files

2020-04-30 Thread Maxim Levitsky
On Mon, 2019-07-22 at 10:05 +0100, Daniel P. Berrangé wrote: > On Sun, Jul 21, 2019 at 09:15:07PM +0300, Maxim Levitsky wrote: > > Currently if you attampt to create too large file with luks you > > get the following error message: > > > > Formatting 'test.luks&#x

Re: [Qemu-devel] [PATCH 1/2] LUKS: better error message when creating too large files

2020-04-30 Thread Maxim Levitsky
On Thu, 2020-04-30 at 15:18 +0300, Maxim Levitsky wrote: > On Mon, 2019-07-22 at 10:05 +0100, Daniel P. Berrangé wrote: > > On Sun, Jul 21, 2019 at 09:15:07PM +0300, Maxim Levitsky wrote: > > > Currently if you attampt to create too large file with luks you > > > get

Re: [PATCH v2 1/1] block/crypto: better error message when creating too large files

2020-04-30 Thread Maxim Levitsky
On Mon, 2020-04-20 at 12:29 +0300, Maxim Levitsky wrote: > Currently if you attampt to create too large file with luks you > get the following error message: > > Formatting 'test.luks', fmt=luks size=17592186044416 key-secret=sec0 > qemu-img: test.luks: Could not re

Re: [PATCH v2 02/14] qcrypto/luks: implement encryption key management

2020-05-03 Thread Maxim Levitsky
On Tue, 2020-04-28 at 14:16 +0100, Daniel P. Berrangé wrote: > On Sun, Mar 08, 2020 at 05:18:51PM +0200, Maxim Levitsky wrote: > > Next few patches will expose that functionality > > to the user. > > > > Signed-off-by: Maxim Levitsky > > -

[PATCH] Fix iotest 153

2020-05-03 Thread Maxim Levitsky
ach the actual amend operation anyway Fixes: f62514b3def5fb2acbef64d0e053c0c31fa45aff Signed-off-by: Maxim Levitsky --- tests/qemu-iotests/153 | 2 +- tests/qemu-iotests/153.out | 12 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/qemu-iotests/153 b/tests/qem

[PATCH v3 00/14] LUKS: encryption slot management using amend interface

2020-05-03 Thread Maxim Levitsky
eplacing it will be better. Best regards, Maxim Levitsky clone of "luks-keymgmnt-v2" Maxim Levitsky (14): qcrypto/core: add generic infrastructure for crypto options amendment qcrypto/luks: implement encryption key management block/amend: add 'force' option

[PATCH v3 05/14] block/amend: refactor qcow2 amend options

2020-05-03 Thread Maxim Levitsky
Some qcow2 create options can't be used for amend. Remove them from the qcow2 create options and add generic logic to detect such options in qemu-img Signed-off-by: Maxim Levitsky Reviewed-by: Daniel P. Berrangé --- block/qcow2.c | 108 ++--- qemu-

[PATCH v3 01/14] qcrypto/core: add generic infrastructure for crypto options amendment

2020-05-03 Thread Maxim Levitsky
This will be used first to implement luks keyslot management. block_crypto_amend_opts_init will be used to convert qemu-img cmdline to QCryptoBlockAmendOptions Signed-off-by: Maxim Levitsky Reviewed-by: Daniel P. Berrangé --- block/crypto.c | 17 + block/crypto.h

[PATCH v3 03/14] block/amend: add 'force' option

2020-05-03 Thread Maxim Levitsky
'force' option will be used for some unsafe amend operations. This includes things like erasing last keyslot in luks based formats (which destroys the data, unless the master key is backed up by external means), but that _might_ be desired result. Signed-off-by: Maxim Levitsky R

[PATCH v3 07/14] block/crypto: implement the encryption key management

2020-05-03 Thread Maxim Levitsky
ange for the idea of unsharing read, rather that write permission which allows to avoid cases when the other user had opened the image read-only. Signed-off-by: Maxim Levitsky Reviewed-by: Daniel P. Berrangé --- block/crypto.c | 127 +++-- block/crypto.h |

[PATCH v3 14/14] iotests: add tests for blockdev-amend

2020-05-03 Thread Maxim Levitsky
This commit adds two tests that cover the new blockdev-amend functionality of luks and qcow2 driver Signed-off-by: Maxim Levitsky Reviewed-by: Daniel P. Berrangé --- tests/qemu-iotests/302 | 278 + tests/qemu-iotests/302.out | 40 ++ tests/qemu

[PATCH v3 04/14] block/amend: separate amend and create options for qemu-img

2020-05-03 Thread Maxim Levitsky
it in each action option list. In future it might be useful to remove some options which are not supported anyway from amend list, which currently cause an error message if amended. Signed-off-by: Maxim Levitsky Reviewed-by: Daniel P. Berrangé --- block/qcow2.c | 160

[PATCH v3 09/14] iotests: filter few more luks specific create options

2020-05-03 Thread Maxim Levitsky
This allows more tests to be able to have same output on both qcow2 luks encrypted images and raw luks images Signed-off-by: Maxim Levitsky Reviewed-by: Daniel P. Berrangé --- tests/qemu-iotests/087.out | 6 ++--- tests/qemu-iotests/134.out | 2 +- tests/qemu-iotests/158.out

[PATCH v3 02/14] qcrypto/luks: implement encryption key management

2020-05-03 Thread Maxim Levitsky
Next few patches will expose that functionality to the user. Signed-off-by: Maxim Levitsky --- crypto/block-luks.c | 406 +++- qapi/crypto.json| 61 ++- 2 files changed, 463 insertions(+), 4 deletions(-) diff --git a/crypto/block-luks.c b/crypto

[PATCH v3 12/14] block/crypto: implement blockdev-amend

2020-05-03 Thread Maxim Levitsky
Signed-off-by: Maxim Levitsky Reviewed-by: Daniel P. Berrangé --- block/crypto.c | 72 qapi/block-core.json | 14 - 2 files changed, 66 insertions(+), 20 deletions(-) diff --git a/block/crypto.c b/block/crypto.c index b71e57f777

[PATCH v3 11/14] block/core: add generic infrastructure for x-blockdev-amend qmp command

2020-05-03 Thread Maxim Levitsky
blockdev-amend will be used similiar to blockdev-create to allow on the fly changes of the structure of the format based block devices. Current plan is to first support encryption keyslot management for luks based formats (raw and embedded in qcow2) Signed-off-by: Maxim Levitsky Reviewed-by

[PATCH v3 10/14] iotests: qemu-img tests for luks key management

2020-05-03 Thread Maxim Levitsky
This commit adds two tests, which test the new amend interface of both luks raw images and qcow2 luks encrypted images. Signed-off-by: Maxim Levitsky Reviewed-by: Daniel P. Berrangé --- tests/qemu-iotests/300 | 207 + tests/qemu-iotests/300.out | 99

[PATCH v3 06/14] block/crypto: rename two functions

2020-05-03 Thread Maxim Levitsky
rename the write_func to create_write_func, and init_func to create_init_func. This is preparation for other write_func that will be used to update the encryption keys. No functional changes Signed-off-by: Maxim Levitsky Reviewed-by: Daniel P. Berrangé --- block/crypto.c | 25

[PATCH v3 08/14] block/qcow2: extend qemu-img amend interface with crypto options

2020-05-03 Thread Maxim Levitsky
Now that we have all the infrastructure in place, wire it in the qcow2 driver and expose this to the user. Signed-off-by: Maxim Levitsky Reviewed-by: Daniel P. Berrangé --- block/qcow2.c | 72 +- tests/qemu-iotests/082.out | 45

[PATCH v3 13/14] block/qcow2: implement blockdev-amend

2020-05-03 Thread Maxim Levitsky
Currently the implementation only supports amending the encryption options, unlike the qemu-img version Signed-off-by: Maxim Levitsky Reviewed-by: Daniel P. Berrangé --- block/qcow2.c| 39 +++ qapi/block-core.json | 16 +++- 2 files

<    1   2   3   4   5   6   7   8   9   10   >