Project

General

Profile

Bug #8279

socketpair(AF_UNIX, SOCK_DGRAM,...) broken after 7590

Added by Gordon Ross over 2 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
networking
Start date:
2017-05-27
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage

Description

[ From ]
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

History

#1

Updated by Gordon Ross over 2 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/

#2

Updated by Gordon Ross over 2 years ago

  • Status changed from In Progress to Pending RTI
#3

Updated by Electric Monk over 2 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>

Also available in: Atom PDF