Re: Update: Failing tests: Re: RFC: [PATCH] SCM_CREDS support
Svante Signell, on Mon 14 Mar 2016 09:05:56 +0100, wrote:
> On Mon, 2016-03-14 at 00:57 +0100, Samuel Thibault wrote:
> > Svante Signell, on Sun 13 Mar 2016 14:19:35 +0100, wrote:
> > > Running the code reveals that the current implementation in glibc is buggy:
> > >
> > > ./scm_rights+creds_recv
> > > Number of SCM_RIGHTS [<=3], SCM_CREDS [<=2]: [1,1]
> > > Input error: Using defaults:
> > > NRIGHTS = 1, NCREDS = 1
> > > scm_rights+creds_send.c: msgh.msg_controllen = 112 (from control_un)
> > > Receiving via datagram socket
> > > recvmsg: (os/kern) invalid right
> > I've had a closer look, what happens here is that the
> > mach_port_mod_refs() call on the rendezvous port fails because the port
> > type of the rendezvous port is DEADNAME, i.e. the other end dropped the
> > port. Indeed, your sending program terminates as soon as it has sent
> > its message. You need to make it wait at least a bit for the receiver
> > to get to receive the credentials.
> Well, the program works perfectly on kFreeBSD (Linux is different).
That doesn't mean that the program behaves correctly.
> And with my old implementation it worked perfectly too.
Because it was synchronous, which was posing other problems.