[PATCH 18/19] hw/virtio: fix -Werror=maybe-uninitialized

2024-03-28 Thread marcandre . lureau
From: Marc-André Lureau ../hw/virtio/vhost-shadow-virtqueue.c:545:13: error: ‘r’ may be used uninitialized [-Werror=maybe-uninitialized] '' is not guaranteed to be assigned when calling -Werror=maybe-uninitialized. Signed-off-by: Marc-André Lureau --- hw/virtio/vhost-shadow-virtqueue.c | 2

[PATCH 19/19] RFC: hw/virtio: a potential leak fix

2024-03-28 Thread marcandre . lureau
From: Marc-André Lureau vhost_svq_get_buf() may return a VirtQueueElement that should be freed. It's unclear to me if the vhost_svq_get_buf() call should always return NULL. Signed-off-by: Marc-André Lureau --- hw/virtio/vhost-shadow-virtqueue.c | 4 +++- 1 file changed, 3 insertions(+), 1

[PATCH 17/19] hw/nvme: fix -Werror=maybe-uninitialized

2024-03-28 Thread marcandre . lureau
From: Marc-André Lureau ../hw/nvme/ctrl.c:6081:21: error: ‘result’ may be used uninitialized [-Werror=maybe-uninitialized] It's not obvious that 'result' is set in all code paths. When is a returned argument, it's even less clear. Looking at various assignments, 0 seems to be a suitable

[PATCH 16/19] tests: fix -Werror=maybe-uninitialized

2024-03-28 Thread marcandre . lureau
From: Marc-André Lureau ../tests/unit/test-block-iothread.c:773:17: error: ‘job’ may be used uninitialized [-Werror=maybe-uninitialized] /usr/include/glib-2.0/glib/gtestutils.h:73:53: error: ‘ret’ may be used uninitialized [-Werror=maybe-uninitialized] Signed-off-by: Marc-André Lureau ---

[PATCH 13/19] hw/virtio-blk: fix -Werror=maybe-uninitialized false-positive

2024-03-28 Thread marcandre . lureau
From: Marc-André Lureau ../hw/block/virtio-blk.c:1212:12: error: ‘rq’ may be used uninitialized [-Werror=maybe-uninitialized] Signed-off-by: Marc-André Lureau --- hw/block/virtio-blk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/block/virtio-blk.c

[PATCH 15/19] migration: fix -Werror=maybe-uninitialized false-positive

2024-03-28 Thread marcandre . lureau
From: Marc-André Lureau ../migration/ram.c:1873:23: error: ‘dirty’ may be used uninitialized [-Werror=maybe-uninitialized] When 'block' != NULL, 'dirty' is initialized. Signed-off-by: Marc-André Lureau --- migration/ram.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH 14/19] plugins: fix -Werror=maybe-uninitialized false-positive

2024-03-28 Thread marcandre . lureau
From: Marc-André Lureau ../plugins/loader.c:405:15: error: ‘ctx’ may be used uninitialized [-Werror=maybe-uninitialized] Signed-off-by: Marc-André Lureau --- plugins/loader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/loader.c b/plugins/loader.c index

[PATCH 12/19] migration: fix -Werror=maybe-uninitialized false-positives

2024-03-28 Thread marcandre . lureau
From: Marc-André Lureau ../migration/dirtyrate.c:186:5: error: ‘records’ may be used uninitialized [-Werror=maybe-uninitialized] ../migration/dirtyrate.c:168:12: error: ‘gen_id’ may be used uninitialized [-Werror=maybe-uninitialized] ../migration/migration.c:2273:5: error: ‘file’ may be used

[PATCH 11/19] migration/block: fix -Werror=maybe-uninitialized false-positive

2024-03-28 Thread marcandre . lureau
From: Marc-André Lureau ../migration/block.c:966:16: error: ‘ret’ may be used uninitialized [-Werror=maybe-uninitialized] Given that "cluster_size" must be <= BLK_MIG_BLOCK_SIZE, the previous loop is entered at least once, so 'ret' is assigned a value in all conditions. Signed-off-by:

[PATCH 10/19] hw/rdma: fix -Werror=maybe-uninitialized false-positive

2024-03-28 Thread marcandre . lureau
From: Marc-André Lureau ../hw/rdma/rdma_backend.c:129:8: error: ‘ne’ may be used uninitialized [-Werror=maybe-uninitialized] Signed-off-by: Marc-André Lureau --- hw/rdma/rdma_backend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/rdma/rdma_backend.c

[PATCH 06/19] block/stream: fix -Werror=maybe-uninitialized false-positives

2024-03-28 Thread marcandre . lureau
From: Marc-André Lureau ../block/stream.c:193:19: error: ‘unfiltered_bs’ may be used uninitialized [-Werror=maybe-uninitialized] ../block/stream.c:176:5: error: ‘len’ may be used uninitialized [-Werror=maybe-uninitialized] trace/trace-block.h:906:9: error: ‘ret’ may be used uninitialized

[PATCH 08/19] hw/vhost-scsi: fix -Werror=maybe-uninitialized

2024-03-28 Thread marcandre . lureau
From: Marc-André Lureau ../hw/scsi/vhost-scsi.c:173:12: error: ‘ret’ may be used uninitialized [-Werror=maybe-uninitialized] It can be reached when num_queues=0. It probably doesn't make much sense to instantiate a vhost-scsi with 0 IO queues though. For now, make vhost_scsi_set_workers()

[PATCH 09/19] hw/sdhci: fix -Werror=maybe-uninitialized false-positive

2024-03-28 Thread marcandre . lureau
From: Marc-André Lureau ../hw/sd/sdhci.c:846:16: error: ‘res’ may be used uninitialized [-Werror=maybe-uninitialized] False-positive, because "length" is non-null. Signed-off-by: Marc-André Lureau --- hw/sd/sdhci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH 04/19] nbd: with -Werror=maybe-uninitialized false-positive

2024-03-28 Thread marcandre . lureau
From: Marc-André Lureau ../nbd/client-connection.c:419:8: error: ‘wait_co’ may be used uninitialized [-Werror=maybe-uninitialized] Signed-off-by: Marc-André Lureau --- nbd/client-connection.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nbd/client-connection.c

[PATCH 07/19] hw/ahci: fix -Werror=maybe-uninitialized false-positive

2024-03-28 Thread marcandre . lureau
From: Marc-André Lureau ../hw/ide/ahci.c:989:58: error: ‘tbl_entry_size’ may be used uninitialized [-Werror=maybe-uninitialized] Signed-off-by: Marc-André Lureau --- hw/ide/ahci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c index

[PATCH 05/19] block/mirror: fix -Werror=maybe-uninitialized false-positive

2024-03-28 Thread marcandre . lureau
From: Marc-André Lureau ../block/mirror.c:1066:22: error: ‘iostatus’ may be used uninitialized [-Werror=maybe-uninitialized] Signed-off-by: Marc-André Lureau --- block/mirror.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/mirror.c b/block/mirror.c index

[PATCH 00/19] -Werror=maybe-uninitialized fixes

2024-03-28 Thread marcandre . lureau
From: Marc-André Lureau Hi, Depending on -Doptimization=, GCC (13.2.1 here) produces different maybe-uninitialized warnings: - g: produces -Werror=maybe-uninitialized errors - 0: clean build - 1: produces -Werror=maybe-uninitialized errors - 2: clean build - 3: produces few

[PATCH 03/19] hw/qxl: fix -Werror=maybe-uninitialized false-positives

2024-03-28 Thread marcandre . lureau
From: Marc-André Lureau ../hw/display/qxl.c:1352:5: error: ‘pci_region’ may be used uninitialized [-Werror=maybe-uninitialized] ../hw/display/qxl.c:1365:22: error: ‘pci_start’ may be used uninitialized [-Werror=maybe-uninitialized] Signed-off-by: Marc-André Lureau --- hw/display/qxl.c | 4

[PATCH 02/19] util/timer: with -Werror=maybe-uninitialized false-positive

2024-03-28 Thread marcandre . lureau
From: Marc-André Lureau ../util/qemu-timer.c:198:24: error: ‘expire_time’ may be used uninitialized [-Werror=maybe-uninitialized] ../util/qemu-timer.c:476:8: error: ‘rearm’ may be used uninitialized [-Werror=maybe-uninitialized] Signed-off-by: Marc-André Lureau --- util/qemu-timer.c | 6

[PATCH 01/19] util/coroutine: fix -Werror=maybe-uninitialized false-positive

2024-03-28 Thread marcandre . lureau
From: Marc-André Lureau ../util/qemu-coroutine.c:150:8: error: ‘batch’ may be used uninitialized [-Werror=maybe-uninitialized] Signed-off-by: Marc-André Lureau --- util/qemu-coroutine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/qemu-coroutine.c

[PATCH v3 2/6] virtio: make endian_needed() work during loading

2023-11-06 Thread marcandre . lureau
From: Marc-André Lureau There is no simple way to distinguish when the callback is used for load or save, AFAICT. Signed-off-by: Marc-André Lureau --- hw/virtio/virtio.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index

[PATCH v3 5/6] test-vmstate: add some subsection tests

2023-11-06 Thread marcandre . lureau
From: Marc-André Lureau Check subsection support, and optional handling. Signed-off-by: Marc-André Lureau Reviewed-by: Juan Quintela --- tests/unit/test-vmstate.c | 116 ++ 1 file changed, 116 insertions(+) diff --git a/tests/unit/test-vmstate.c

[PATCH v3 6/6] docs/migration: reflect the changes about needed subsections

2023-11-06 Thread marcandre . lureau
From: Marc-André Lureau Signed-off-by: Marc-André Lureau Reviewed-by: Juan Quintela --- docs/devel/migration.rst | 17 - 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/docs/devel/migration.rst b/docs/devel/migration.rst index 240eb16d90..22875ac40c 100644 ---

[PATCH v3 0/6] migration: check required entries and sections are loaded

2023-11-06 Thread marcandre . lureau
From: Marc-André Lureau Hi, Surprisingly, the migration code doesn't check that required migration entries and subsections are loaded. Either optional or required sections are both ignored when missing. According to the documentation a "newer QEMU that knows about a subsection can (with care)

[PATCH v3 3/6] migration: check required subsections are loaded, once

2023-11-06 Thread marcandre . lureau
From: Marc-André Lureau Check that required subsections have been loaded. Signed-off-by: Marc-André Lureau Reviewed-by: Juan Quintela --- migration/vmstate.c | 40 ++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/migration/vmstate.c

[PATCH v3 1/6] block/fdc: 'phase' is not needed on load

2023-11-06 Thread marcandre . lureau
From: Marc-André Lureau It is reconstructed during fdc_post_load() Signed-off-by: Marc-André Lureau --- hw/block/fdc.c | 5 + 1 file changed, 5 insertions(+) diff --git a/hw/block/fdc.c b/hw/block/fdc.c index d7cc4d3ec1..fc71660ba0 100644 --- a/hw/block/fdc.c +++ b/hw/block/fdc.c @@

[PATCH v3 4/6] migration: check required entries are loaded, once

2023-11-06 Thread marcandre . lureau
From: Marc-André Lureau Signed-off-by: Marc-André Lureau Reviewed-by: Juan Quintela --- migration/savevm.c | 43 +++ 1 file changed, 43 insertions(+) diff --git a/migration/savevm.c b/migration/savevm.c index bc98c2ea6f..2ae65b8088 100644 ---

[PATCH v2 5/9] migration: check required subsections are loaded, once

2023-10-24 Thread marcandre . lureau
From: Marc-André Lureau Check that required subsections have been loaded. Signed-off-by: Marc-André Lureau --- migration/vmstate.c | 40 ++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/migration/vmstate.c b/migration/vmstate.c index

[PATCH v2 7/9] migration: set file error on subsection loading

2023-10-24 Thread marcandre . lureau
From: Marc-André Lureau commit 13cde50889237 ("vmstate: Return error in case of error") sets QemuFile error to stop reading from it and report to the caller (checked by unit tests). We should do the same on subsection loading error. Signed-off-by: Marc-André Lureau --- migration/vmstate.c | 1

[PATCH v2 6/9] migration: check required entries are loaded, once

2023-10-24 Thread marcandre . lureau
From: Marc-André Lureau Signed-off-by: Marc-André Lureau --- migration/savevm.c | 43 +++ 1 file changed, 43 insertions(+) diff --git a/migration/savevm.c b/migration/savevm.c index ca5c7cebe0..66c9c3095b 100644 --- a/migration/savevm.c +++

[PATCH v2 9/9] docs/migration: reflect the changes about needed subsections

2023-10-24 Thread marcandre . lureau
From: Marc-André Lureau Signed-off-by: Marc-André Lureau --- docs/devel/migration.rst | 17 - 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/docs/devel/migration.rst b/docs/devel/migration.rst index c3e1400c0c..50f313f178 100644 --- a/docs/devel/migration.rst +++

[PATCH v2 8/9] test-vmstate: add some subsection tests

2023-10-24 Thread marcandre . lureau
From: Marc-André Lureau Check subsection support, and optional handling. Signed-off-by: Marc-André Lureau --- tests/unit/test-vmstate.c | 116 ++ 1 file changed, 116 insertions(+) diff --git a/tests/unit/test-vmstate.c b/tests/unit/test-vmstate.c index

[PATCH v2 4/9] migration: rename vmstate_save_needed->vmstate_section_needed

2023-10-24 Thread marcandre . lureau
From: Marc-André Lureau The function is used on save at this point. The following commits will use it on load. Signed-off-by: Marc-André Lureau --- include/migration/vmstate.h | 2 +- migration/savevm.c | 2 +- migration/vmstate.c | 4 ++-- 3 files changed, 4 insertions(+), 4

[PATCH v2 0/9] RFC: migration: check required entries and sections are loaded

2023-10-24 Thread marcandre . lureau
From: Marc-André Lureau Hi, Surprisingly, the migration code doesn't check that required migration entries and subsections are loaded. Either optional or required sections are both ignored when missing. According to the documentation a "newer QEMU that knows about a subsection can (with care)

[PATCH v2 2/9] virtio: make endian_needed() work during loading

2023-10-24 Thread marcandre . lureau
From: Marc-André Lureau There is no simple way to distinguish when the callback is used for load or save, AFAICT. Signed-off-by: Marc-André Lureau --- hw/virtio/virtio.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index

[PATCH v2 3/9] net/slirp: use different IDs for each instance

2023-10-24 Thread marcandre . lureau
From: Marc-André Lureau Using always 0, QEMU will end up loading the same instance, even if multiple have been saved. Signed-off-by: Marc-André Lureau --- net/slirp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/slirp.c b/net/slirp.c index c33b3e02e7..af1451b60f

[PATCH v2 1/9] block/fdc: 'phase' is not needed on load

2023-10-24 Thread marcandre . lureau
From: Marc-André Lureau It is reconstructed during fdc_post_load() Signed-off-by: Marc-André Lureau --- hw/block/fdc.c | 5 + 1 file changed, 5 insertions(+) diff --git a/hw/block/fdc.c b/hw/block/fdc.c index d7cc4d3ec1..fc71660ba0 100644 --- a/hw/block/fdc.c +++ b/hw/block/fdc.c @@

[PATCH 1/5] block/fdc: 'phase' is not needed on load

2023-09-26 Thread marcandre . lureau
From: Marc-André Lureau It is reconstructed during fdc_post_load() Signed-off-by: Marc-André Lureau --- hw/block/fdc.c | 5 + 1 file changed, 5 insertions(+) diff --git a/hw/block/fdc.c b/hw/block/fdc.c index d7cc4d3ec1..fc71660ba0 100644 --- a/hw/block/fdc.c +++ b/hw/block/fdc.c @@

[PATCH 2/5] virtio: make endian_needed() work during loading

2023-09-26 Thread marcandre . lureau
From: Marc-André Lureau There is no simple way to distinguish when the callback is used for load or save, AFAICT. Signed-off-by: Marc-André Lureau --- hw/virtio/virtio.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index

[PATCH 5/5] RFC: migration: check required entries are loaded, once

2023-09-26 Thread marcandre . lureau
From: Marc-André Lureau Signed-off-by: Marc-André Lureau --- migration/savevm.c | 43 +++ 1 file changed, 43 insertions(+) diff --git a/migration/savevm.c b/migration/savevm.c index bb3e99194c..6a17bb0f73 100644 --- a/migration/savevm.c +++

[PATCH 3/5] net/slirp: use different IDs for each instance

2023-09-26 Thread marcandre . lureau
From: Marc-André Lureau Using always 0, QEMU will end up loading the same instance, even if multiple have been saved. Signed-off-by: Marc-André Lureau --- net/slirp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/slirp.c b/net/slirp.c index c33b3e02e7..af1451b60f

[PATCH 4/5] RFC: migration: check required subsections are loaded, once

2023-09-26 Thread marcandre . lureau
From: Marc-André Lureau Check that required subsections have been loaded. Signed-off-by: Marc-André Lureau --- migration/vmstate.c | 40 ++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/migration/vmstate.c b/migration/vmstate.c index

[PATCH 0/5] RFC: migration: check required entries and sections are loaded

2023-09-26 Thread marcandre . lureau
From: Marc-André Lureau Hi, To my surprise, QEMU didn't seem to check that required migration entries and subsections are loaded. I took a naive approach to add such check, by adding some "visited" marks along the loading path, and checking by the end that all required entries have been loaded.

[PULL 18/25] tests/docker: fix a win32 error due to portability

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau docker.py is run during configure, and produces an error: No module named 'pwd'. Use a more portable and recommended alternative to lookup the user "login name". Signed-off-by: Marc-André Lureau Reviewed-by: Philippe Mathieu-Daudé Message-Id:

[PULL v2 25/25] monitor: restrict command getfd to POSIX hosts

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau Currently, the function will simply fail if ancillary fds are not provided, for ex on unsupported platforms. This changes the failure from: {"error": {"class": "GenericError", "desc": "No file descriptor supplied via SCM_RIGHTS"}} to: {"error": {"class":

[PULL v2 07/25] win32/socket: introduce qemu_socket_unselect() helper

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau A more explicit version of qemu_socket_select() with no events. Signed-off-by: Marc-André Lureau Reviewed-by: Stefan Berger Message-Id: <20230221124802.4103554-8-marcandre.lur...@redhat.com> --- include/sysemu/os-win32.h | 2 ++ io/channel-socket.c | 4 ++--

[PULL 25/25] QMP/HMP: only actually implement getfd on CONFIG_POSIX

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau Currently, the function will simply fail if ancillary fds are not provided, for ex on unsupported platforms. Signed-off-by: Marc-André Lureau Reviewed-by: Markus Armbruster Message-Id: <20230306122751.2355515-12-marcandre.lur...@redhat.com> --- qapi/misc.json | 2

[PULL v2 17/25] char: do not double-close fd when failing to add client

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau The caller is already closing the fd on failure. Fixes: c3054a6e6a ("char: Factor out qmp_add_client() parts and move to chardev/") Signed-off-by: Marc-André Lureau Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Thomas Huth Message-Id:

[PULL 17/25] char: do not double-close fd when failing to add client

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau The caller is already closing the fd on failure. Fixes: c3054a6e6a ("char: Factor out qmp_add_client() parts and move to chardev/") Signed-off-by: Marc-André Lureau Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Thomas Huth Message-Id:

[PULL v2 19/25] osdep: implement qemu_socketpair() for win32

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau Manually implement a socketpair() function, using UNIX sockets and simple peer credential checking. QEMU doesn't make much use of socketpair, beside vhost-user which is not available for win32 at this point. However, I intend to use it for writing some new portable

[PULL 24/25] qtest: enable vnc-display test on win32

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau Now that qtest_qmp_add_client() works on win32, we can enable the VNC test. Signed-off-by: Marc-André Lureau Acked-by: Thomas Huth Message-Id: <20230306122751.2355515-11-marcandre.lur...@redhat.com> --- tests/qtest/vnc-display-test.c | 12 +++- 1 file changed,

[PULL v2 20/25] qmp: 'add_client' actually expects sockets

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau Whether it is SPICE, VNC, D-Bus, or the socket chardev, they all actually expect a socket kind or will fail in different ways at runtime. Throw an error early if the given 'add_client' fd is not a socket, and close it to avoid leaks. This allows to replace the close()

[PULL v2 00/25] Win socket patches

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau The following changes since commit 29c8a9e31a982874ce4e2c15f2bf82d5f8dc3517: Merge tag 'linux-user-for-8.0-pull-request' of https://gitlab.com/laurent_vivier/qemu into staging (2023-03-12 10:57:00 +) are available in the Git repository at:

[PULL v2 08/25] aio: make aio_set_fd_poll() static to aio-posix.c

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau Signed-off-by: Marc-André Lureau Reviewed-by: Stefan Berger Message-Id: <20230221124802.4103554-9-marcandre.lur...@redhat.com> --- include/block/aio.h | 8 util/aio-posix.c| 6 +++--- util/aio-win32.c| 7 --- 3 files changed, 3 insertions(+), 18

[PULL 01/25] util: drop qemu_fork()

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau Fortunately, qemu_fork() is no longer used since commit a95570e3e4d6 ("io/command: use glib GSpawn, instead of open-coding fork/exec"). (GSpawn uses posix_spawn() whenever possible instead) Signed-off-by: Marc-André Lureau Reviewed-by: Daniel P. Berrangé Message-Id:

[PULL v2 12/25] slirp: open-code qemu_socket_(un)select()

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau We are about to make the QEMU socket API use file-descriptor space only, but libslirp gives us SOCKET as fd, still. Signed-off-by: Marc-André Lureau Reviewed-by: Stefan Berger Message-Id: <20230221124802.4103554-14-marcandre.lur...@redhat.com> --- net/slirp.c | 10

[PULL v2 14/25] os-posix: remove useless ioctlsocket() define

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau The API is specific to win32. Signed-off-by: Marc-André Lureau Reviewed-by: Daniel P. Berrangé Message-Id: <20230221124802.4103554-16-marcandre.lur...@redhat.com> --- include/sysemu/os-posix.h | 1 - 1 file changed, 1 deletion(-) diff --git

[PULL v2 02/25] tests: use closesocket()

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau Because they are actually sockets... Signed-off-by: Marc-André Lureau Reviewed-by: Thomas Huth Message-Id: <20230221124802.4103554-3-marcandre.lur...@redhat.com> --- tests/unit/socket-helpers.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git

[PULL v2 18/25] tests/docker: fix a win32 error due to portability

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau docker.py is run during configure, and produces an error: No module named 'pwd'. Use a more portable and recommended alternative to lookup the user "login name". Signed-off-by: Marc-André Lureau Reviewed-by: Philippe Mathieu-Daudé Message-Id:

[PULL v2 21/25] monitor: release the lock before calling close()

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau As per comment, presumably to avoid syscall in critical section. Fixes: 0210c3b39bef08 ("monitor: Use LOCK_GUARD macros") Signed-off-by: Marc-André Lureau Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20230306122751.2355515-7-marcandre.lur...@redhat.com> ---

[PULL v2 06/25] win32/socket: introduce qemu_socket_select() helper

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau This is a wrapper for WSAEventSelect, with Error handling. By default, it will produce a warning, so callers don't have to be modified now, and yet we can spot potential mis-use. Signed-off-by: Marc-André Lureau Reviewed-by: Stefan Berger Message-Id:

[PULL v2 05/25] error: add global _warn destination

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau This can help debugging issues or develop, when error handling is introduced. Signed-off-by: Marc-André Lureau Reviewed-by: Stefan Berger Message-Id: <20230221124802.4103554-6-marcandre.lur...@redhat.com> --- include/qapi/error.h | 6 ++

[PULL 03/25] io: use closesocket()

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau Because they are actually sockets... Signed-off-by: Marc-André Lureau Reviewed-by: Thomas Huth Message-Id: <20230221124802.4103554-4-marcandre.lur...@redhat.com> --- io/channel-socket.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git

[PULL 22/25] qmp: add 'get-win32-socket'

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau A process with enough capabilities can duplicate a socket to QEMU. Add a QMP command to import it and add it to the monitor fd list, so it can be later used by other commands. Signed-off-by: Marc-André Lureau Acked-by: Markus Armbruster Message-Id:

[PULL v2 11/25] slirp: unregister the win32 SOCKET

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau Presumably, this is what should happen when the SOCKET is to be removed. (it probably worked until now because closesocket() does it implicitly, but we never now how the slirp library could use the SOCKET later) Signed-off-by: Marc-André Lureau Reviewed-by: Stefan

[PULL v2 22/25] qmp: add 'get-win32-socket'

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau A process with enough capabilities can duplicate a socket to QEMU. Add a QMP command to import it and add it to the monitor fd list, so it can be later used by other commands. Signed-off-by: Marc-André Lureau Acked-by: Markus Armbruster Message-Id:

[PULL v2 09/25] aio/win32: aio_set_fd_handler() only supports SOCKET

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau Let's check if the argument is actually a SOCKET, else report an error and return. Signed-off-by: Marc-André Lureau Reviewed-by: Stefan Berger Message-Id: <20230221124802.4103554-10-marcandre.lur...@redhat.com> --- util/aio-win32.c | 7 ++- 1 file changed, 6

[PULL v2 01/25] util: drop qemu_fork()

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau Fortunately, qemu_fork() is no longer used since commit a95570e3e4d6 ("io/command: use glib GSpawn, instead of open-coding fork/exec"). (GSpawn uses posix_spawn() whenever possible instead) Signed-off-by: Marc-André Lureau Reviewed-by: Daniel P. Berrangé Message-Id:

[PULL v2 04/25] tests: add test-error-report

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau Signed-off-by: Marc-André Lureau Reviewed-by: Stefan Berger Message-Id: <20230221124802.4103554-5-marcandre.lur...@redhat.com> --- tests/unit/test-error-report.c | 121 + tests/unit/meson.build | 1 + 2 files changed, 122

[PULL 10/25] main-loop: remove qemu_fd_register(), win32/slirp/socket specific

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau Open-code the socket registration where it's needed, to avoid artificially used or unclear generic interface. Furthermore, the following patches are going to make socket handling use FD-only inside QEMU, but we need to handle win32 SOCKET from libslirp. Signed-off-by:

[PULL 02/25] tests: use closesocket()

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau Because they are actually sockets... Signed-off-by: Marc-André Lureau Reviewed-by: Thomas Huth Message-Id: <20230221124802.4103554-3-marcandre.lur...@redhat.com> --- tests/unit/socket-helpers.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git

[PULL v2 24/25] qtest: enable vnc-display test on win32

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau Now that qtest_qmp_add_client() works on win32, we can enable the VNC test. Signed-off-by: Marc-André Lureau Acked-by: Thomas Huth Message-Id: <20230306122751.2355515-11-marcandre.lur...@redhat.com> --- tests/qtest/vnc-display-test.c | 12 +++- 1 file changed,

[PULL v2 16/25] tests: fix path separator, use g_build_filename()

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau Signed-off-by: Marc-André Lureau Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Thomas Huth Message-Id: <20230306122751.2355515-2-marcandre.lur...@redhat.com> --- tests/unit/test-io-channel-command.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PULL v2 15/25] win32: replace closesocket() with close() wrapper

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau Use a close() wrapper instead, so that we don't need to worry about closesocket() vs close() anymore, let's hope. Signed-off-by: Marc-André Lureau Reviewed-by: Stefan Berger Message-Id: <20230221124802.4103554-17-marcandre.lur...@redhat.com> ---

[PULL v2 23/25] libqtest: make qtest_qmp_add_client work on win32

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau Use the "get-win32-socket" function to pass an opened socket to QEMU, instead of using "getfd", which relies on socket ancillary FD message passing. Signed-off-by: Marc-André Lureau Reviewed-by: Daniel P. Berrangé Message-Id:

[PULL 19/25] osdep: implement qemu_socketpair() for win32

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau Manually implement a socketpair() function, using UNIX sockets and simple peer credential checking. QEMU doesn't make much use of socketpair, beside vhost-user which is not available for win32 at this point. However, I intend to use it for writing some new portable

[PULL v2 13/25] win32: avoid mixing SOCKET and file descriptor space

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau Until now, a win32 SOCKET handle is often cast to an int file descriptor, as this is what other OS use for sockets. When necessary, QEMU eventually queries whether it's a socket with the help of fd_is_socket(). However, there is no guarantee of conflict between the fd and

[PULL 20/25] qmp: 'add_client' actually expects sockets

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau Whether it is SPICE, VNC, D-Bus, or the socket chardev, they all actually expect a socket kind or will fail in different ways at runtime. Throw an error early if the given 'add_client' fd is not a socket, and close it to avoid leaks. This allows to replace the close()

[PULL v2 03/25] io: use closesocket()

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau Because they are actually sockets... Signed-off-by: Marc-André Lureau Reviewed-by: Thomas Huth Message-Id: <20230221124802.4103554-4-marcandre.lur...@redhat.com> --- io/channel-socket.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git

[PULL v2 10/25] main-loop: remove qemu_fd_register(), win32/slirp/socket specific

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau Open-code the socket registration where it's needed, to avoid artificially used or unclear generic interface. Furthermore, the following patches are going to make socket handling use FD-only inside QEMU, but we need to handle win32 SOCKET from libslirp. Signed-off-by:

[PULL 15/25] win32: replace closesocket() with close() wrapper

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau Use a close() wrapper instead, so that we don't need to worry about closesocket() vs close() anymore, let's hope. Signed-off-by: Marc-André Lureau Reviewed-by: Stefan Berger Message-Id: <20230221124802.4103554-17-marcandre.lur...@redhat.com> ---

[PULL 12/25] slirp: open-code qemu_socket_(un)select()

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau We are about to make the QEMU socket API use file-descriptor space only, but libslirp gives us SOCKET as fd, still. Signed-off-by: Marc-André Lureau Reviewed-by: Stefan Berger Message-Id: <20230221124802.4103554-14-marcandre.lur...@redhat.com> --- net/slirp.c | 10

[PULL 23/25] libqtest: make qtest_qmp_add_client work on win32

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau Use the "get-win32-socket" function to pass an opened socket to QEMU, instead of using "getfd", which relies on socket ancillary FD message passing. Signed-off-by: Marc-André Lureau Reviewed-by: Daniel P. Berrangé Message-Id:

[PULL 14/25] os-posix: remove useless ioctlsocket() define

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau The API is specific to win32. Signed-off-by: Marc-André Lureau Reviewed-by: Daniel P. Berrangé Message-Id: <20230221124802.4103554-16-marcandre.lur...@redhat.com> --- include/sysemu/os-posix.h | 1 - 1 file changed, 1 deletion(-) diff --git

[PULL 11/25] slirp: unregister the win32 SOCKET

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau Presumably, this is what should happen when the SOCKET is to be removed. (it probably worked until now because closesocket() does it implicitly, but we never now how the slirp library could use the SOCKET later) Signed-off-by: Marc-André Lureau Reviewed-by: Stefan

[PULL 07/25] win32/socket: introduce qemu_socket_unselect() helper

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau A more explicit version of qemu_socket_select() with no events. Signed-off-by: Marc-André Lureau Reviewed-by: Stefan Berger Message-Id: <20230221124802.4103554-8-marcandre.lur...@redhat.com> --- include/sysemu/os-win32.h | 2 ++ io/channel-socket.c | 4 ++--

[PULL 08/25] aio: make aio_set_fd_poll() static to aio-posix.c

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau Signed-off-by: Marc-André Lureau Reviewed-by: Stefan Berger Message-Id: <20230221124802.4103554-9-marcandre.lur...@redhat.com> --- include/block/aio.h | 8 util/aio-posix.c| 6 +++--- util/aio-win32.c| 7 --- 3 files changed, 3 insertions(+), 18

[PULL 16/25] tests: fix path separator, use g_build_filename()

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau Signed-off-by: Marc-André Lureau Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Thomas Huth Message-Id: <20230306122751.2355515-2-marcandre.lur...@redhat.com> --- tests/unit/test-io-channel-command.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PULL 21/25] monitor: release the lock before calling close()

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau As per comment, presumably to avoid syscall in critical section. Fixes: 0210c3b39bef08 ("monitor: Use LOCK_GUARD macros") Signed-off-by: Marc-André Lureau Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20230306122751.2355515-7-marcandre.lur...@redhat.com> ---

[PULL 13/25] win32: avoid mixing SOCKET and file descriptor space

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau Until now, a win32 SOCKET handle is often cast to an int file descriptor, as this is what other OS use for sockets. When necessary, QEMU eventually queries whether it's a socket with the help of fd_is_socket(). However, there is no guarantee of conflict between the fd and

[PULL 09/25] aio/win32: aio_set_fd_handler() only supports SOCKET

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau Let's check if the argument is actually a SOCKET, else report an error and return. Signed-off-by: Marc-André Lureau Reviewed-by: Stefan Berger Message-Id: <20230221124802.4103554-10-marcandre.lur...@redhat.com> --- util/aio-win32.c | 7 ++- 1 file changed, 6

[PULL 05/25] error: add global _warn destination

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau This can help debugging issues or develop, when error handling is introduced. Signed-off-by: Marc-André Lureau Reviewed-by: Stefan Berger Message-Id: <20230221124802.4103554-6-marcandre.lur...@redhat.com> --- include/qapi/error.h | 6 ++

[PULL 06/25] win32/socket: introduce qemu_socket_select() helper

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau This is a wrapper for WSAEventSelect, with Error handling. By default, it will produce a warning, so callers don't have to be modified now, and yet we can spot potential mis-use. Signed-off-by: Marc-André Lureau Reviewed-by: Stefan Berger Message-Id:

[PULL 04/25] tests: add test-error-report

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau Signed-off-by: Marc-André Lureau Reviewed-by: Stefan Berger Message-Id: <20230221124802.4103554-5-marcandre.lur...@redhat.com> --- tests/unit/test-error-report.c | 121 + tests/unit/meson.build | 1 + 2 files changed, 122

[PULL 00/25] Win socket patches

2023-03-13 Thread marcandre . lureau
From: Marc-André Lureau The following changes since commit 29c8a9e31a982874ce4e2c15f2bf82d5f8dc3517: Merge tag 'linux-user-for-8.0-pull-request' of https://gitlab.com/laurent_vivier/qemu into staging (2023-03-12 10:57:00 +) are available in the Git repository at:

[PATCH v3 16/16] win32: replace closesocket() with close() wrapper

2023-02-21 Thread marcandre . lureau
From: Marc-André Lureau Use a close() wrapper instead, so that we don't need to worry about closesocket() vs close() anymore, let's hope. Signed-off-by: Marc-André Lureau --- include/sysemu/os-posix.h | 2 -- include/sysemu/os-win32.h | 8 +++--- backends/tpm/tpm_emulator.c | 6 ++--

[PATCH v3 02/16] tests: use closesocket()

2023-02-21 Thread marcandre . lureau
From: Marc-André Lureau Because they are actually sockets... Signed-off-by: Marc-André Lureau Reviewed-by: Thomas Huth --- tests/unit/socket-helpers.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/unit/socket-helpers.c b/tests/unit/socket-helpers.c index

[PATCH v3 14/16] win32: avoid mixing SOCKET and file descriptor space

2023-02-21 Thread marcandre . lureau
From: Marc-André Lureau Until now, a win32 SOCKET handle is often cast to an int file descriptor, as this is what other OS use for sockets. When necessary, QEMU eventually queries whether it's a socket with the help of fd_is_socket(). However, there is no guarantee of conflict between the fd and

[PATCH v3 15/16] os-posix: remove useless ioctlsocket() define

2023-02-21 Thread marcandre . lureau
From: Marc-André Lureau The API is specific to win32. Signed-off-by: Marc-André Lureau Reviewed-by: Daniel P. Berrangé --- include/sysemu/os-posix.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/sysemu/os-posix.h b/include/sysemu/os-posix.h index 58de7c994d..378213fc86 100644

[PATCH v3 09/16] aio/win32: aio_set_fd_handler() only supports SOCKET

2023-02-21 Thread marcandre . lureau
From: Marc-André Lureau Let's check if the argument is actually a SOCKET, else report an error and return. Signed-off-by: Marc-André Lureau --- util/aio-win32.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/util/aio-win32.c b/util/aio-win32.c index

  1   2   3   >