qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] win32: do not mix SOCKET and fd space
@ 2023-02-12 20:49 marcandre.lureau
  2023-02-12 20:49 ` [PATCH 1/4] tests: use closesocket() marcandre.lureau
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: marcandre.lureau @ 2023-02-12 20:49 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Stefan Weil, Daniel P. Berrangé,
	Paolo Bonzini, Joel Stanley, Laurent Vivier, Thomas Huth,
	Jason Wang, qemu-arm, Stefan Berger, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Hi,

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 SOCKET space. Such conflict would have surprising
consequences. We can fix this by using FDs only.

After fixing a few missed closesocket(), this patch series makes the win32
socket API wrappers take FDs. It finally get rid of closesocket() usage by using
a close() wrapper instead. (note that fdopen/fclose would not be enough either
to close the underlying socket appropriately)

Marc-André Lureau (4):
  tests: use closesocket()
  io: use closesocket()
  win32: stop mixing SOCKET and file descriptor space
  win32: replace closesocket() with close() wrapper

 include/sysemu/os-posix.h   |   1 -
 include/sysemu/os-win32.h   |   8 +-
 backends/tpm/tpm_emulator.c |   6 +-
 crypto/afalg.c              |   6 +-
 hw/hyperv/syndbg.c          |   4 +-
 io/channel-socket.c         |  22 +++--
 io/channel-watch.c          |  17 ++--
 net/dgram.c                 |  14 +--
 net/socket.c                |  22 ++---
 tests/qtest/libqtest.c      |   8 +-
 tests/qtest/microbit-test.c |   2 +-
 tests/qtest/netdev-socket.c |  10 +--
 tests/unit/socket-helpers.c |   2 +-
 util/oslib-win32.c          | 169 ++++++++++++++++++++++++++++++------
 util/qemu-sockets.c         |  22 ++---
 15 files changed, 221 insertions(+), 92 deletions(-)

-- 
2.39.1



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

end of thread, other threads:[~2023-02-21 10:52 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-12 20:49 [PATCH 0/4] win32: do not mix SOCKET and fd space marcandre.lureau
2023-02-12 20:49 ` [PATCH 1/4] tests: use closesocket() marcandre.lureau
2023-02-13  8:03   ` Thomas Huth
2023-02-12 20:49 ` [PATCH 2/4] io: " marcandre.lureau
2023-02-13  8:04   ` Thomas Huth
2023-02-12 20:49 ` [PATCH 3/4] win32: stop mixing SOCKET and file descriptor space marcandre.lureau
2023-02-20 11:27   ` Marc-André Lureau
2023-02-20 12:38   ` Markus Armbruster
2023-02-20 15:29     ` Marc-André Lureau
2023-02-20 15:58       ` Daniel P. Berrangé
2023-02-21  8:18       ` Paolo Bonzini
2023-02-21  9:12         ` Marc-André Lureau
2023-02-21 10:40           ` Marc-André Lureau
2023-02-21 10:52             ` Paolo Bonzini
2023-02-12 20:49 ` [PATCH 4/4] win32: replace closesocket() with close() wrapper marcandre.lureau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).