Re: [Qemu-block] When AioHandler->is_external=true?

2018-11-20 Thread Fam Zheng
On Tue, 11/20 20:34, Dongli Zhang wrote: > Hi, > > Would you please help explain in which case AioHandler->is_external is true, > and > when it is false? > > I read about iothread and mainloop and I am little bit confused about it. VirtIO's ioeventfd is an example of is_external == true. It

Re: [Qemu-block] KVM Forum block no[td]es

2018-11-20 Thread Vladimir Sementsov-Ogievskiy
On 12.11.2018 16:10, Nir Soffer wrote: On Mon, Nov 12, 2018 at 5:26 PM Max Reitz mailto:mre...@redhat.com>> wrote: On 12.11.18 00:36, Nir Soffer wrote: > On Mon, Nov 12, 2018 at 12:25 AM Max Reitz > mailto:mre...@redhat.com> > >> wrote: > >

Re: [Qemu-block] [PATCH for-next? 0/2] qemu-img: Minor fixes to an amend error path

2018-11-20 Thread John Snow
On 11/19/18 5:19 AM, Max Reitz wrote: > One of the amend error paths has two issues that are fixed by this > series. Since they are relatively minor and have been present in 3.0 > already, I think there is no need to get them into 3.1. OTOH they are > bug fixes, so they could go into 3.1 if

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

2018-11-20 Thread John Snow
On 11/19/18 12:29 PM, Eric Blake wrote: > 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. > >

Re: [Qemu-block] [PATCH] iotests: Skip 233 if certtool not installed

2018-11-20 Thread John Snow
On 11/20/18 5:52 PM, Eric Blake wrote: > 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

Re: [Qemu-block] [Qemu-devel] [PATCH] iotests: Skip 233 if certtool not installed

2018-11-20 Thread Eric Blake
On 11/20/18 4:52 PM, Eric Blake wrote: 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.

[Qemu-block] [PATCH] iotests: Skip 233 if certtool not installed

2018-11-20 Thread 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 Signed-off-by: Eric

Re: [Qemu-block] [PATCH 6/6] tests: exercise NBD server in TLS mode

2018-11-20 Thread Kevin Wolf
Am 20.11.2018 um 19:22 hat Eric Blake geschrieben: > On 11/20/18 11:53 AM, Daniel P. Berrangé wrote: > > > > > > +echo > > > > > +echo "== preparing TLS creds ==" > > > > > + > > > > > +tls_x509_create_root_ca "ca1" > > > > > +tls_x509_create_root_ca "ca2" > > > > > +tls_x509_create_server "ca1"

Re: [Qemu-block] [PATCH for-3.1 0/2] iotests: More Python 3 fixes

2018-11-20 Thread Kevin Wolf
Am 20.11.2018 um 18:22 hat Kevin Wolf geschrieben: > Kevin Wolf (2): > iotests: Replace time.clock() with Timeout > iotests: Replace assertEquals() with assertEqual() Thanks for the quick reviews, applied to the block branch. Kevin

Re: [Qemu-block] [PATCH 1/2] iotests: Replace time.clock() with Timeout

2018-11-20 Thread John Snow
On 11/20/18 12:22 PM, Kevin Wolf wrote: > 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 >

Re: [Qemu-block] [PATCH 2/2] iotests: Replace assertEquals() with assertEqual()

2018-11-20 Thread John Snow
On 11/20/18 12:22 PM, Kevin Wolf wrote: > 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

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

2018-11-20 Thread Philippe Mathieu-Daudé
On 20/11/18 19: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. Another way to fix this might be to register the CMB as a RAM memory region,

Re: [Qemu-block] [Qemu-devel] [PATCH 2/2] iotests: Replace assertEquals() with assertEqual()

2018-11-20 Thread Philippe Mathieu-Daudé
On 20/11/18 18:22, Kevin Wolf wrote: 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: Philippe

Re: [Qemu-block] [Qemu-devel] [PATCH 1/2] iotests: Replace time.clock() with Timeout

2018-11-20 Thread Philippe Mathieu-Daudé
On 20/11/18 18:22, Kevin Wolf wrote: 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

Re: [Qemu-block] [Qemu-devel] [PATCH for-3.1? 3/3] acpi: fix stringop-truncation warnings

2018-11-20 Thread Philippe Mathieu-Daudé
On 20/11/18 16:27, Marc-André Lureau wrote: Replace strcpy() that don't mind about having dest not ending with NUL char by qemu strpadcpy(). Signed-off-by: Marc-André Lureau --- hw/acpi/aml-build.c | 6 -- hw/acpi/core.c | 13 +++-- 2 files changed, 11 insertions(+), 8

Re: [Qemu-block] [Qemu-devel] [PATCH for-3.1? 2/3] migration: fix stringop-truncation warning

2018-11-20 Thread Philippe Mathieu-Daudé
On 20/11/18 16:27, Marc-André Lureau wrote: Adding an assert is enough to silence GCC. ~/src/qemu/migration/global_state.c: In function 'global_state_store_running': ~/src/qemu/migration/global_state.c:45:5: error: 'strncpy' specified bound 100 equals destination size

Re: [Qemu-block] [Qemu-devel] [PATCH for-3.1? 1/3] sheepdog: fix stringop-truncation warning

2018-11-20 Thread Philippe Mathieu-Daudé
On 20/11/18 16:27, Marc-André Lureau wrote: It seems adding an assert is enough to silence GCC. (sd_parse_snapid_or_tag() g_strlcpy() ensures that we don't get in that situation) ~/src/qemu/block/sheepdog.c: In function 'find_vdi_name': ~/src/qemu/block/sheepdog.c:1239:5: error: 'strncpy'

Re: [Qemu-block] [PATCH v5 00/16] Don't pass flags to bdrv_reopen_queue()

2018-11-20 Thread Kevin Wolf
Am 12.11.2018 um 15:00 hat Alberto Garcia geschrieben: > Hi all, > > when reopening a BlockDriverState using bdrv_reopen() and friends the > new options can be specified either with a QDict or with flags. Both > methods overlap and that makes the semantics and the implementation > unnecessarily

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

2018-11-20 Thread Paolo Bonzini
On 19/11/18 18:43, Kevin Wolf wrote: > Am 19.11.2018 um 18:09 hat Paolo Bonzini geschrieben: >> On 19/11/18 16:23, Mark Kanda wrote: >>> For CVE-2018-16847, I just noticed Kevin pulled in Li's previous fix (as >>> opposed to this one). Was this done in error? >> >> Probably. Kevin, can you revert

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

2018-11-20 Thread 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 efficient. However,

Re: [Qemu-block] [PATCH v5 05/16] block: Use bdrv_reopen_set_read_only() in stream_start/complete()

2018-11-20 Thread Alberto Garcia
On Tue 20 Nov 2018 07:00:29 PM CET, Kevin Wolf wrote: >> @@ -226,12 +226,12 @@ void stream_start(const char *job_id, BlockDriverState >> *bs, >> { >> StreamBlockJob *s; >> BlockDriverState *iter; >> -int orig_bs_flags; >> +int bs_read_only; > > bool certainly? Oops! Berto

Re: [Qemu-block] [PATCH 6/6] tests: exercise NBD server in TLS mode

2018-11-20 Thread Eric Blake
On 11/20/18 11:53 AM, Daniel P. Berrangé wrote: +echo +echo "== preparing TLS creds ==" + +tls_x509_create_root_ca "ca1" +tls_x509_create_root_ca "ca2" +tls_x509_create_server "ca1" "server1" +tls_x509_create_client "ca1" "client1" +tls_x509_create_client "ca2" "client2" Looks like we can't

Re: [Qemu-block] [PATCH v5 00/16] Don't pass flags to bdrv_reopen_queue()

2018-11-20 Thread Alberto Garcia
On Tue 20 Nov 2018 07:21:21 PM CET, Kevin Wolf wrote: > Am 12.11.2018 um 15:00 hat Alberto Garcia geschrieben: >> Hi all, >> >> when reopening a BlockDriverState using bdrv_reopen() and friends the >> new options can be specified either with a QDict or with flags. Both >> methods overlap and that

Re: [Qemu-block] [PATCH v5 05/16] block: Use bdrv_reopen_set_read_only() in stream_start/complete()

2018-11-20 Thread Kevin Wolf
Am 12.11.2018 um 15:00 hat Alberto Garcia geschrieben: > This patch replaces the bdrv_reopen() calls that set and remove the > BDRV_O_RDWR flag with the new bdrv_reopen_set_read_only() function. > > Signed-off-by: Alberto Garcia > Reviewed-by: Max Reitz > --- > block/stream.c | 20

Re: [Qemu-block] [PATCH 6/6] tests: exercise NBD server in TLS mode

2018-11-20 Thread Daniel P . Berrangé
On Tue, Nov 20, 2018 at 11:45:54AM -0600, Eric Blake wrote: > On 11/20/18 11:27 AM, Kevin Wolf wrote: > > Am 16.11.2018 um 16:53 hat Daniel P. Berrangé geschrieben: > > > Add tests that validate it is possible to connect to an NBD server > > > running TLS mode. Also test mis-matched TLS vs non-TLS

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

2018-11-20 Thread Paolo Bonzini
On 20/11/18 18:31, Igor Druzhinin wrote: > On 14/11/2018 17:42, Igor Druzhinin wrote: >> On 06/11/2018 12:16, Igor Druzhinin wrote: >>> 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

Re: [Qemu-block] [PATCH 6/6] tests: exercise NBD server in TLS mode

2018-11-20 Thread Eric Blake
On 11/20/18 11:27 AM, Kevin Wolf wrote: Am 16.11.2018 um 16:53 hat Daniel P. Berrangé geschrieben: Add tests that validate it is possible to connect to an NBD server running TLS mode. Also test mis-matched TLS vs non-TLS connections correctly fail. +echo +echo "== preparing TLS creds ==" +

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

2018-11-20 Thread Igor Druzhinin
On 14/11/2018 17:42, Igor Druzhinin wrote: > On 06/11/2018 12:16, Igor Druzhinin wrote: >> 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

Re: [Qemu-block] [PATCH 6/6] tests: exercise NBD server in TLS mode

2018-11-20 Thread Kevin Wolf
Am 16.11.2018 um 16:53 hat Daniel P. Berrangé geschrieben: > Add tests that validate it is possible to connect to an NBD server > running TLS mode. Also test mis-matched TLS vs non-TLS connections > correctly fail. > +echo > +echo "== preparing TLS creds ==" > + > +tls_x509_create_root_ca "ca1" >

Re: [Qemu-block] [Qemu-devel] [PATCH for-3.1? 2/3] migration: fix stringop-truncation warning

2018-11-20 Thread Dr. David Alan Gilbert
* Marc-André Lureau (marcandre.lur...@redhat.com) wrote: > Hi > > On Tue, Nov 20, 2018 at 9:22 PM Dr. David Alan Gilbert > wrote: > > > > * Eric Blake (ebl...@redhat.com) wrote: > > > On 11/20/18 9:27 AM, Marc-André Lureau wrote: > > > > Adding an assert is enough to silence GCC. > > > > > > > >

Re: [Qemu-block] [Qemu-devel] [PATCH for-3.1? 2/3] migration: fix stringop-truncation warning

2018-11-20 Thread Marc-André Lureau
Hi On Tue, Nov 20, 2018 at 9:22 PM Dr. David Alan Gilbert wrote: > > * Eric Blake (ebl...@redhat.com) wrote: > > On 11/20/18 9:27 AM, Marc-André Lureau wrote: > > > Adding an assert is enough to silence GCC. > > > > > > ~/src/qemu/migration/global_state.c: In function > > >

[Qemu-block] [PATCH for-3.1 0/2] iotests: More Python 3 fixes

2018-11-20 Thread Kevin Wolf
Kevin Wolf (2): iotests: Replace time.clock() with Timeout iotests: Replace assertEquals() with assertEqual() tests/qemu-iotests/041| 6 +++--- tests/qemu-iotests/118| 20 tests/qemu-iotests/iotests.py | 2 +- 3 files changed, 12 insertions(+), 16

[Qemu-block] [PATCH 2/2] iotests: Replace assertEquals() with assertEqual()

2018-11-20 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 --- tests/qemu-iotests/041| 6 +++---

[Qemu-block] [PATCH 1/2] iotests: Replace time.clock() with Timeout

2018-11-20 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.

Re: [Qemu-block] [Qemu-devel] [PATCH for-3.1? 2/3] migration: fix stringop-truncation warning

2018-11-20 Thread Dr. David Alan Gilbert
* Eric Blake (ebl...@redhat.com) wrote: > On 11/20/18 9:27 AM, Marc-André Lureau wrote: > > Adding an assert is enough to silence GCC. > > > > ~/src/qemu/migration/global_state.c: In function > > 'global_state_store_running': > > ~/src/qemu/migration/global_state.c:45:5: error: 'strncpy'

Re: [Qemu-block] [Qemu-devel] [PATCH for-3.1? 2/3] migration: fix stringop-truncation warning

2018-11-20 Thread Eric Blake
On 11/20/18 9:27 AM, Marc-André Lureau wrote: Adding an assert is enough to silence GCC. ~/src/qemu/migration/global_state.c: In function 'global_state_store_running': ~/src/qemu/migration/global_state.c:45:5: error: 'strncpy' specified bound 100 equals destination size

Re: [Qemu-block] [Qemu-devel] [PATCH for-3.1? 3/3] acpi: fix stringop-truncation warnings

2018-11-20 Thread Eric Blake
On 11/20/18 9:27 AM, Marc-André Lureau wrote: Replace strcpy() that don't mind about having dest not ending with NUL char by qemu strpadcpy(). Signed-off-by: Marc-André Lureau --- hw/acpi/aml-build.c | 6 -- hw/acpi/core.c | 13 +++-- 2 files changed, 11 insertions(+), 8

Re: [Qemu-block] [Qemu-devel] [PATCH for-3.1? 1/3] sheepdog: fix stringop-truncation warning

2018-11-20 Thread Eric Blake
On 11/20/18 9:27 AM, Marc-André Lureau wrote: It seems adding an assert is enough to silence GCC. (sd_parse_snapid_or_tag() g_strlcpy() ensures that we don't get in that situation) ~/src/qemu/block/sheepdog.c: In function 'find_vdi_name': ~/src/qemu/block/sheepdog.c:1239:5: error: 'strncpy'

[Qemu-block] [PATCH for-3.1? 2/3] migration: fix stringop-truncation warning

2018-11-20 Thread Marc-André Lureau
Adding an assert is enough to silence GCC. ~/src/qemu/migration/global_state.c: In function 'global_state_store_running': ~/src/qemu/migration/global_state.c:45:5: error: 'strncpy' specified bound 100 equals destination size [-Werror=stringop-truncation] strncpy((char

[Qemu-block] [PATCH for-3.1? 3/3] acpi: fix stringop-truncation warnings

2018-11-20 Thread Marc-André Lureau
Replace strcpy() that don't mind about having dest not ending with NUL char by qemu strpadcpy(). Signed-off-by: Marc-André Lureau --- hw/acpi/aml-build.c | 6 -- hw/acpi/core.c | 13 +++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/hw/acpi/aml-build.c

[Qemu-block] [PATCH for-3.1? 1/3] sheepdog: fix stringop-truncation warning

2018-11-20 Thread Marc-André Lureau
It seems adding an assert is enough to silence GCC. (sd_parse_snapid_or_tag() g_strlcpy() ensures that we don't get in that situation) ~/src/qemu/block/sheepdog.c: In function 'find_vdi_name': ~/src/qemu/block/sheepdog.c:1239:5: error: 'strncpy' specified bound 256 equals destination size

[Qemu-block] [PATCH for-3.1? 0/3] strcpy: fix stringop-truncation warnings

2018-11-20 Thread Marc-André Lureau
Hi, Some of those warnings have already been fixed, others have been delayed as it could make sense to disable/ignoring the warning, or write a custom strncpy() function. In some cases where NUL-ending string is not mandatory (because the string length is bound in some format or protocol), we

Re: [Qemu-block] [Qemu-devel] [PATCH] migration/block-dirty-bitmap: Silence coverity CID 1390625

2018-11-20 Thread Vladimir Sementsov-Ogievskiy
16.11.2018 21:43, John Snow wrote: > Coverity warns that backing_bs() could give us a NULL pointer, which > we then use without checking that it isn't. > > In our loop condition, we check bs && bs->drv as a point of habit, but > by nature of the block graph, we cannot have null bs pointers here.

[Qemu-block] When AioHandler->is_external=true?

2018-11-20 Thread Dongli Zhang
Hi, Would you please help explain in which case AioHandler->is_external is true, and when it is false? I read about iothread and mainloop and I am little bit confused about it. Thank you very much! Dongli Zhang

Re: [Qemu-block] [Qemu-devel] [PATCH 1/6 for-3.1] nbd: fix whitespace in server error message

2018-11-20 Thread Philippe Mathieu-Daudé
On 16/11/18 17:01, Eric Blake wrote: On 11/16/18 9:53 AM, Daniel P. Berrangé wrote: A space was missing after the option number was printed:    Option 0x8not permitted before TLS becomes    Option 0x8 not permitted before TLS This fixes    commit 3668328303429f3bc93ab3365c66331600b06a2d   

Re: [Qemu-block] [Qemu-devel] [PATCH 6/6] tests: exercise NBD server in TLS mode

2018-11-20 Thread Daniel P . Berrangé
On Mon, Nov 19, 2018 at 11:00:38AM -0600, Eric Blake wrote: > On 11/19/18 4:37 AM, Daniel P. Berrangé wrote: > > > > Actually, I tracked this message down to using socat (which actually > > > connects and then abruptly exits) when probing whether the socket is up > > > and > > > listening. That