Win32, can I haz fdpass?

Marc-André Lureau

Created: 2022-06-14 mar. 17:36

1. Why care?

  • context: QMP or D-Bus, local IPC
  • streaming (migration/chardev) / OOB
  • D-Bus display API
  • multi-process setup

2. Named Pipes

  • ❌ not socket semantic / API
  • ✅ security/ACL
  • ❌ no resource sharing
  • !dbus & !qmp

3. TCP sockets

  • ✅ socket API
  • ❌ not quite secure
  • ❌ no resource sharing
  • dbus & qmp

4. UNIX sockets

  • added a few years ago
  • ✅ socket API
  • ✅ GETPEERPID
  • ❌ no resource sharing
  • dbus, (qmp win32 TBD)

5. Is there a way?

  • DuplicateHandle(H, process_handle) → HANDLE
  • ❗ HANDLE != SOCKET != fd
  • WSADuplicateSocket(S, PID!) → struct!

6. D-Bus & fd-pass

  • NEGOTIATE_UNIX_FD
  • ex: ShareFD(fd: 'h') dbus fdpass.png

7. WIP: D-Bus & HANDLE-pass

  • NEGOTIATE_HANDLE
  • ex: ShareHandle(handle: 'H') dbus handle.png

8. TBD: QMP

  • add-fd -> /dev/fdset/X
  • add-win32-handle arg:HANDLE
  • add-win32-socket arg:{ socket infos.. }
  • /dev/win32-set/X…

9. Status

  • glib branch (preliminary patches merged)
  • zbus branch (same)
  • dbus reference & spec TBD
    • After meson & AF_UNIX
  • QMP TBD