Bug #8279
socketpair(AF_UNIX, SOCK_DGRAM,...) broken after 7590
100%
Description
[ From pavel.zakharov@delphix.com ]
The fix for #7590 breaks inter-process communication when sending datagrams over a socketpair.
I’m still looking at the why, but here’s a simple program that reproduces this issue:
https://gist.github.com/pzakha/42335d26fd69d7622db12e33d2490ff0
Before this commit it would work as expected:
$ ./sockpair_dgram
parent received 'hello parent, I am child’
Now the message never makes it to the receiver:
$ ./sockpair_dgram
recvmsg failed: Connection reset by peer
Related issues
Updated by Gordon Ross over 3 years ago
Evaluation:
First some clarifications about the exposure:
This works OK (and is the more common usage)
socketpair(PF_LOCAL, SOCK_STREAM, 0, fd)
but this fails with ECONNRESET:
socketpair(PF_LOCAL, SOCK_DGRAM, 0, fd)
The cause is: My prior work on 7590 missed something in the code path used by connected datagram sockets created via socketpair(),
where the sotpi_info_t object has the sti_faddr_noxlate flag set, and neglected to fill in sti->sti_ux_faddr.
(That's the "transport-level" form of the "foreign" address.)
Fix out for review:
https://www.illumos.org/rb/r/530/
Updated by Electric Monk over 3 years ago
- Status changed from Pending RTI to Closed
- % Done changed from 0 to 100
git commit b521c41bc9226e79d6dea569da64cfe5def2ea19
commit b521c41bc9226e79d6dea569da64cfe5def2ea19 Author: Gordon Ross <gwr@nexenta.com> Date: 2017-05-28T18:12:51.000Z 8279 socketpair(AF_UNIX, SOCK_DGRAM,...) broken after 7590 Reviewed by: Igor Kozhukhov <igor@dilos.org> Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com> Approved by: Dan McDonald <danmcd@kebe.com>
Updated by Andy Fiddaman 11 months ago
- Related to Bug #7590: sendmsg on AF_UNIX socket fails after process drops privileges added