On Thu, Oct 07, 2021 at 12:27:24PM -0400, John Snow wrote: > On Thu, Oct 7, 2021 at 10:52 AM Eric Blake <ebl...@redhat.com> wrote: > > > On Wed, Sep 22, 2021 at 08:49:25PM -0400, John Snow wrote: > > > The single space is indeed required to successfully transmit the file > > > descriptor to QEMU. > > > > Sending fds requires a payload of at least one byte, but I don't think > > that qemu cares which byte. Thus, while your choice of space is fine, > > the commit message may be a bit misleading at implying it must be > > space. > > > > > OK, I'll rephrase. (Space winds up being useful in particular because it > doesn't mess with the parsing for subsequent JSON objects sent over the > wire.) > > (Idle curiosity: Is it possible to make QEMU accept an empty payload here? > I understand that for compatibility reasons it wouldn't change much for the > python lib even if we did, but I'm curious.)
No, my understanding is that for SCM_RIGHTS to work reliably, you HAVE to have a payload to avoid a return value of 0 from recvmsg() which would be ambiguous with the peer performing orderly shutdown. 'man 7 unix' confirms: At least one byte of real data should be sent when sending ancillary data. On Linux, this is required to successfully send ancillary data over a UNIX domain stream socket. When sending ancillary data over a UNIX domain datagram socket, it is not necessary on Linux to send any accompanying real data. However, portable applications should also in‐ clude at least one byte of real data when sending ancillary data over a datagram socket. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org