Re: [Qemu-block] [PATCH 3/5] iotests: allow resume_drive by node name

2018-11-22 Thread Peter Krempa
On Thu, Nov 22, 2018 at 21:48:05 +0300, Andrey Shinkevich wrote: > After node graph changes, we may not be able to resume_drive by device > name (backing files are not recursively searched). So, lets allow to > resume by node-name. Set constant name for breakpoints, to avoid > introducing extra par

Re: [Qemu-block] [PATCH 0/5] Discrad blocks during block-stream operation

2018-11-22 Thread Peter Krempa
On Thu, Nov 22, 2018 at 21:48:02 +0300, Andrey Shinkevich wrote: > Hello everyone! > > The given feature discards blocks with copy-on-read operation while the > streaming process runs. Adding the 'discard' argument to the QMP block-stream > command allows dropping a block in the backing chain afte

Re: [Qemu-block] [PATCH 0/2] Update the inherits_from pointer after stream and commit

2018-11-22 Thread Alberto Garcia
On Thu 22 Nov 2018 06:52:00 PM CET, Kevin Wolf wrote: > Not a problem with the series, but I tried to run the test case without > the fix, and this is what I got: > > -{"return": ""} > +{"return": "Cannot change the option 'backing.detect-zeroes'rn"} > > Where does that final "rn" come from? Looks

[Qemu-block] [PATCH 5/5] iotests: 030 with block-stream discard

2018-11-22 Thread Andrey Shinkevich
The classes that set tests for the block-stream command with discard option on are inherited from the existent classes in the 030 file. Some QMP commands do not have the optional 'discard' argument because the WRITE permission is not being granted when the filter is inserted. For instance, it is tr

[Qemu-block] [PATCH 4/5] iotests: prepare 030 for graph change

2018-11-22 Thread Andrey Shinkevich
The discard option for block-stream command requires insertion of the filter to write into the backing chain. In that case, the job will not resume by device name. So, the node name is specified. Signed-off-by: Andrey Shinkevich --- tests/qemu-iotests/030 | 20 1 file change

[Qemu-block] [PATCH 3/5] iotests: allow resume_drive by node name

2018-11-22 Thread Andrey Shinkevich
After node graph changes, we may not be able to resume_drive by device name (backing files are not recursively searched). So, lets allow to resume by node-name. Set constant name for breakpoints, to avoid introducing extra parameters. Signed-off-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-io

[Qemu-block] [PATCH 2/5] The discard flag for block stream operation

2018-11-22 Thread Andrey Shinkevich
Adding a parameter to QMP block-stream command to allow discarding blocks in the backing chain while blocks are being copied to the active layer. Signed-off-by: Andrey Shinkevich --- block/stream.c| 3 +-- blockdev.c| 8 +++- hmp-commands.hx | 4 ++-- hm

[Qemu-block] [PATCH 1/5] Discard blocks while copy-on-read

2018-11-22 Thread Andrey Shinkevich
Discards the block duplicated in an intermediate backing file after the block have been copied into the active layer during QMP block-stream operation. It saves the disk space while merging external snapshots. Signed-off-by: Andrey Shinkevich --- block/stream.c | 428

[Qemu-block] [PATCH 0/5] Discrad blocks during block-stream operation

2018-11-22 Thread Andrey Shinkevich
Hello everyone! The given feature discards blocks with copy-on-read operation while the streaming process runs. Adding the 'discard' argument to the QMP block-stream command allows dropping a block in the backing chain after it has been copied to the active layer. That will elude the block duplica

[Qemu-block] [PULL v2 00/16] Block layer patches

2018-11-22 Thread Kevin Wolf
The following changes since commit 47c1cc30e440860aa695358f7c2dd0b9d7b53d16: Update version for v3.1.0-rc2 release (2018-11-20 18:10:26 +) are available in the Git repository at: git://repo.or.cz/qemu/kevin.git tags/for-upstream for you to fetch changes up to 6bd858b3117a5aab066f3cf02ca

Re: [Qemu-block] [PATCH 0/2] Update the inherits_from pointer after stream and commit

2018-11-22 Thread Kevin Wolf
Am 31.10.2018 um 17:16 hat Alberto Garcia geschrieben: > Hi all, > > when you open an image [A] with a few more images on the backing chain > you get something like this: > > [E] <- [D] <- [C] <- [B] <- [A] > > Here you can go from [A] to [E] by following the bs->backing > pointer. At the sa

Re: [Qemu-block] [PULL 00/13] Block layer patches

2018-11-22 Thread Peter Maydell
On 22 November 2018 at 16:54, Kevin Wolf wrote: > The following changes since commit 47c1cc30e440860aa695358f7c2dd0b9d7b53d16: > > Update version for v3.1.0-rc2 release (2018-11-20 18:10:26 +) > > are available in the Git repository at: > > git://repo.or.cz/qemu/kevin.git tags/for-upstream

Re: [Qemu-block] [Qemu-devel] [PATCH] nvme: fix out-of-bounds access to the CMB

2018-11-22 Thread Peter Maydell
On 20 November 2018 at 18:41, Paolo Bonzini wrote: > Because the CMB BAR has a min_access_size of 2, if you read the last > byte it will try to memcpy *2* bytes from n->cmbuf, causing an off-by-one > error. This is CVE-2018-16847. Maybe we should change the MemoryRegionOps API so that devices ha

[Qemu-block] [PULL 09/13] nvme: call blk_drain in NVMe reset code to avoid lockups

2018-11-22 Thread Kevin Wolf
From: Igor Druzhinin When blk_flush called in NVMe reset path S/C queues are already freed which means that re-entering AIO handling loop having some IO requests unfinished will lockup or crash as their SG structures being potentially reused. Call blk_drain before freeing the queues to avoid this

[Qemu-block] [PULL 13/13] iotests: Enhance 223 to cover multiple bitmap granularities

2018-11-22 Thread Kevin Wolf
From: Eric Blake Testing granularity at the same size as the cluster isn't quite as fun as what happens when it is larger or smaller. This enhancement also shows that qemu's nbd server can serve the same disk over multiple exports simultaneously. Signed-off-by: Eric Blake Tested-by: John Snow

[Qemu-block] [PULL 07/13] block: Fix update of BDRV_O_AUTO_RDONLY in update_flags_from_options()

2018-11-22 Thread Kevin Wolf
From: Alberto Garcia Commit e35bdc123a4ace9f4d3fcca added the auto-read-only option and the code to update its corresponding flag in update_flags_from_options(), but forgot to clear the flag if auto-read-only is false. Signed-off-by: Alberto Garcia Reported-by: Max Reitz Signed-off-by: Kevin W

[Qemu-block] [PULL 12/13] nvme: fix bug with PCI IRQ pins on teardown

2018-11-22 Thread Kevin Wolf
From: Logan Gunthorpe When the submission and completion queues are being torn down the IRQ will be asserted for the completion queue when the submsission queue is deleted. Then when the completion queue is deleted it stays asserted. Thus, on systems that do not use MSI, no further interrupts can

[Qemu-block] [PULL 10/13] nvme: fix out-of-bounds access to the CMB

2018-11-22 Thread Kevin Wolf
From: Paolo Bonzini Because the CMB BAR has a min_access_size of 2, if you read the last byte it will try to memcpy *2* bytes from n->cmbuf, causing an off-by-one error. This is CVE-2018-16847. Another way to fix this might be to register the CMB as a RAM memory region, which would also be more

[Qemu-block] [PULL 11/13] Revert "nvme: fix oob access issue(CVE-2018-16847)"

2018-11-22 Thread Kevin Wolf
This reverts commit 5e3c0220d7e4f0361c4d36c697a8842f2b583402. We have a better fix commited for this now. Signed-off-by: Kevin Wolf --- hw/block/nvme.c | 7 --- 1 file changed, 7 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 8c35cab2b4..84062d388f 100644 --- a/hw/block/n

[Qemu-block] [PULL 02/13] iotests: Replace assertEquals() with assertEqual()

2018-11-22 Thread Kevin Wolf
TestCase.assertEquals() is deprecated since Python 2.7. Recent Python versions print a warning when the function is called, which makes test cases fail. Replace it with the preferred spelling assertEqual(). Signed-off-by: Kevin Wolf Reviewed-by: John Snow Reviewed-by: Philippe Mathieu-Daudé --

[Qemu-block] [PULL 04/13] qemu-img: Fix typo

2018-11-22 Thread Kevin Wolf
From: Max Reitz Fixes: d402b6a21a825a5c07aac9251990860723d49f5d Reported-by: Kevin Wolf Cc: qemu-sta...@nongnu.org Signed-off-by: Max Reitz Reviewed-by: John Snow Signed-off-by: Kevin Wolf --- qemu-img.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qemu-img.c b/qemu-im

[Qemu-block] [PULL 08/13] iotests: fix nbd test 233 to work correctly with raw images

2018-11-22 Thread Kevin Wolf
From: Daniel P. Berrangé The first qemu-io command must honour the $IMGFMT that is set rather than hardcoding qcow2. The qemu-nbd commands should also set $IMGFMT to avoid the insecure format probe warning. Signed-off-by: Daniel P. Berrangé Reviewed-by: Eric Blake Signed-off-by: Kevin Wolf --

[Qemu-block] [PULL 03/13] iotests: Skip 233 if certtool not installed

2018-11-22 Thread Kevin Wolf
From: Eric Blake The use of TLS while building qemu is optional. While the 'certtool' binary should be available on every platform that supports building against TLS, that does not imply that the developer has installed it. Make the test gracefully skip in that case. Reported-by: Kevin Wolf Si

[Qemu-block] [PULL 05/13] qemu-img: Fix leak

2018-11-22 Thread Kevin Wolf
From: Max Reitz create_opts was leaked here. This is not too bad since the process is about to exit anyway, but relying on that does not make the code nicer to read. Fixes: d402b6a21a825a5c07aac9251990860723d49f5d Reported-by: Kevin Wolf Cc: qemu-sta...@nongnu.org Signed-off-by: Max Reitz Rev

[Qemu-block] [PULL 00/13] Block layer patches

2018-11-22 Thread Kevin Wolf
The following changes since commit 47c1cc30e440860aa695358f7c2dd0b9d7b53d16: Update version for v3.1.0-rc2 release (2018-11-20 18:10:26 +) are available in the Git repository at: git://repo.or.cz/qemu/kevin.git tags/for-upstream for you to fetch changes up to 924956b1efc50af7cc334b7a14f

[Qemu-block] [PULL 06/13] scsi-disk: Fix crash if underlying host file or disk returns error

2018-11-22 Thread Kevin Wolf
From: "Richard W.M. Jones" Commit 40dce4ee6 "scsi-disk: fix rerror/werror=ignore" introduced a bug which causes qemu to crash with the assertion error below if the host file or disk returns an error: qemu-system-x86_64: hw/scsi/scsi-bus.c:1374: scsi_req_complete: Assertion `req->status == -1

[Qemu-block] [PULL 01/13] iotests: Replace time.clock() with Timeout

2018-11-22 Thread Kevin Wolf
time.clock() is deprecated since Python 3.3. Current Python versions warn that the function will be removed in Python 3.8, and those warnings make the test case 118 fail. Replace it with the Timeout mechanism that is compatible with both Python 2 and 3, and makes the code even a little nicer. Sig

Re: [Qemu-block] [PATCH 0/2] Update the inherits_from pointer after stream and commit

2018-11-22 Thread Alberto Garcia
ping > Hi all, > > when you open an image [A] with a few more images on the backing chain > you get something like this: > > [E] <- [D] <- [C] <- [B] <- [A] > > Here you can go from [A] to [E] by following the bs->backing > pointer. At the same time each one of the backing files has an > 'inhe

Re: [Qemu-block] [PATCH for-3.1] iotests: Enhance 223 to cover multiple bitmap granularities

2018-11-22 Thread Kevin Wolf
Am 19.11.2018 um 18:29 hat Eric Blake geschrieben: > Testing granularity at the same size as the cluster isn't quite > as fun as what happens when it is larger or smaller. This > enhancement also shows that qemu's nbd server can server the > same disk over multiple exports simultaneously. > > Sig

Re: [Qemu-block] [PATCH] hw/block/nvme: fix bug with PCI IRQ pins on teardown

2018-11-22 Thread Kevin Wolf
Am 21.11.2018 um 19:10 hat Logan Gunthorpe geschrieben: > When the submission and completion queues are being torn down > the IRQ will be asserted for the completion queue when the > submsission queue is deleted. Then when the completion queue > is deleted it stays asserted. Thus, on systems that d

[Qemu-block] [PATCH 2/2] mirror: Block the source BlockDriverState in mirror_start_job()

2018-11-22 Thread Alberto Garcia
The mirror_start_job() function used for the commit-active job blocks the source, target and all intermediate nodes for the duration of the job. target <- intermediate <- source Since 4ef85a9c2339 this function creates a dummy mirror_top_bs that goes on top of the source node, and it is this d

[Qemu-block] [PATCH 1/2] mirror: Release the dirty bitmap if mirror_start_job() fails

2018-11-22 Thread Alberto Garcia
At the moment I don't see how to make this function fail after the dirty bitmap has been created, but if that was possible then we would hit the assert(QLIST_EMPTY(&bs->dirty_bitmaps)) in bdrv_close(). Signed-off-by: Alberto Garcia --- block/mirror.c | 3 +++ 1 file changed, 3 insertions(+) dif

[Qemu-block] [PATCH 0/2] Minor fixes for the mirror block job

2018-11-22 Thread Alberto Garcia
Hi, a couple of minor fixes for the mirror block job. I don't think these bugs can be reproduced at the moment so this shouldn't be 3.1 material. Berto Alberto Garcia (2): mirror: Release the dirty bitmap if mirror_start_job() fails mirror: Block the source BlockDriverState in mirror_start_j

Re: [Qemu-block] [PATCH] nvme: fix out-of-bounds access to the CMB

2018-11-22 Thread Kevin Wolf
Am 20.11.2018 um 19:41 hat Paolo Bonzini geschrieben: > Because the CMB BAR has a min_access_size of 2, if you read the last > byte it will try to memcpy *2* bytes from n->cmbuf, causing an off-by-one > error. This is CVE-2018-16847. > > Another way to fix this might be to register the CMB as a R

Re: [Qemu-block] [PATCH] block/nvme: call blk_drain in NVMe reset code to avoid lockups

2018-11-22 Thread Kevin Wolf
Am 06.11.2018 um 13:16 hat Igor Druzhinin geschrieben: > When blk_flush called in NVMe reset path S/C queues are already freed > which means that re-entering AIO handling loop having some IO requests > unfinished will lockup or crash as their SG structures being potentially > reused. Call blk_drain

Re: [Qemu-block] encrypt in threads

2018-11-22 Thread Vladimir Sementsov-Ogievskiy
21.11.2018 20:30, Vladimir Sementsov-Ogievskiy wrote: > Hi Daniel! > > After moving compression to threads in Qcow2 it's an obvious next step to > "threadyfy" encryption in Qcow2 too. > > But it turned out to be not as simple as I assumed. If I call > qcrypto_block_encrypt > in parallel threads

Re: [Qemu-block] [PATCH] scsi-disk: Fix crash if underlying host file or disk returns error.

2018-11-22 Thread Kevin Wolf
Am 21.11.2018 um 19:31 hat Paolo Bonzini geschrieben: > On 21/11/18 13:47, Richard W.M. Jones wrote: > > Commit 40dce4ee6 "scsi-disk: fix rerror/werror=ignore" introduced a > > bug which causes qemu to crash with the assertion error below if the > > host file or disk returns an error: > > > > qe