Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1358053

RE: [PATCH] af_unix: closed SOCK_SEQPACKET socketpair must get SIGPIPE

From David Laight <David.Laight@ACULAB.COM>
Newsgroups linux.kernel
Subject RE: [PATCH] af_unix: closed SOCK_SEQPACKET socketpair must get SIGPIPE
Date 2016-03-15 15:00 +0100
Message-ID <rcXFU-2Ox-7@gated-at.bofh.it> (permalink)
References <rcT9f-8rY-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Alexander Potapenko
> Sent: 15 March 2016 09:04
> According to IEEE Std 1003.1, 2013, sending data to a SOCK_SEQPACKET
> socketpair with MSG_NOSIGNAL flag set must result in a SIGPIPE if the
> socket is no longer connected.
...
> Without the below patch the behavior is as follows:
> 
> $ ./sock seqpacket
> sendmsg: Broken pipe
...
> The behavior of the patched kernel complies with POSIX:
> 
> $  ./sock seqpacket
> Killed by SIGPIPE
...

While POSIX might specify this behaviour, changing the behaviour
could easily break applications.
Basically this change (more or less) require every application that
uses SOCK_SEQPACKED to be audited to ensure that MSG_NOSIGNAL is set
on ever send/write to the socket.

Personally I think the whole SIGPIPE on sockets should never have been
allowed to get into the standard.
I don't remember MSG_NOSIGNAL being present in SYSV.

The only time you want a write into a pipe to generate SIGPIPE is
for pipes generates by the shell that feed stdout to stdin of the
next process in the pipeline.
If pipes are implemented as unix-domain socketpairs (no one does that
any more) then it would require the SIGPIPE for write().

	David

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] af_unix: closed SOCK_SEQPACKET socketpair must get SIGPIPE Alexander Potapenko <glider@google.com> - 2016-03-15 10:10 +0100
  Re: [PATCH] af_unix: closed SOCK_SEQPACKET socketpair must get  SIGPIPE Eric Dumazet <eric.dumazet@gmail.com> - 2016-03-15 14:30 +0100
    Re: [PATCH] af_unix: closed SOCK_SEQPACKET socketpair must get SIGPIPE Alexander Potapenko <glider@google.com> - 2016-03-15 15:40 +0100
  RE: [PATCH] af_unix: closed SOCK_SEQPACKET socketpair must get  SIGPIPE David Laight <David.Laight@ACULAB.COM> - 2016-03-15 15:00 +0100
    Re: [PATCH] af_unix: closed SOCK_SEQPACKET socketpair must get SIGPIPE Alexander Potapenko <glider@google.com> - 2016-03-15 17:20 +0100

csiph-web