netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] sock: ignore SCM_RIGHTS and SCM_CREDENTIALS in __sock_cmsg_send
@ 2016-07-10 16:51 Soheil Hassas Yeganeh
  2016-07-11 20:39 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Soheil Hassas Yeganeh @ 2016-07-10 16:51 UTC (permalink / raw)
  To: davem, netdev
  Cc: slyfox, Soheil Hassas Yeganeh, Eric Dumazet, Willem de Bruijn

From: Soheil Hassas Yeganeh <soheil@google.com>

Sergei Trofimovich reported that pulse audio sends SCM_CREDENTIALS
as a control message to TCP. Since __sock_cmsg_send does not
support SCM_RIGHTS and SCM_CREDENTIALS, it returns an error and
hence breaks pulse audio over TCP.

SCM_RIGHTS and SCM_CREDENTIALS are sent on the SOL_SOCKET layer
but they semantically belong to SOL_UNIX. Since all
cmsg-processing functions including sock_cmsg_send ignore control
messages of other layers, it is best to ignore SCM_RIGHTS
and SCM_CREDENTIALS for consistency (and also for fixing pulse
audio over TCP).

Signed-off-by: Soheil Hassas Yeganeh <soheil@google.com>
Reported-by: Sergei Trofimovich <slyfox@gentoo.org>
Tested-by: Sergei Trofimovich <slyfox@gentoo.org>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Willem de Bruijn <willemb@google.com>
---
 net/core/sock.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/core/sock.c b/net/core/sock.c
index 08bf97e..b7f1263 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1938,6 +1938,10 @@ int __sock_cmsg_send(struct sock *sk, struct msghdr *msg, struct cmsghdr *cmsg,
 		sockc->tsflags &= ~SOF_TIMESTAMPING_TX_RECORD_MASK;
 		sockc->tsflags |= tsflags;
 		break;
+	/* SCM_RIGHTS and SCM_CREDENTIALS are semantically in SOL_UNIX. */
+	case SCM_RIGHTS:
+	case SCM_CREDENTIALS:
+		break;
 	default:
 		return -EINVAL;
 	}
-- 
2.8.0.rc3.226.g39d4020

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] sock: ignore SCM_RIGHTS and SCM_CREDENTIALS in __sock_cmsg_send
  2016-07-10 16:51 [PATCH net] sock: ignore SCM_RIGHTS and SCM_CREDENTIALS in __sock_cmsg_send Soheil Hassas Yeganeh
@ 2016-07-11 20:39 ` David Miller
  2016-07-11 20:52   ` Soheil Hassas Yeganeh
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2016-07-11 20:39 UTC (permalink / raw)
  To: soheil.kdev; +Cc: netdev, slyfox, soheil, edumazet, willemb

From: Soheil Hassas Yeganeh <soheil.kdev@gmail.com>
Date: Sun, 10 Jul 2016 12:51:46 -0400

> From: Soheil Hassas Yeganeh <soheil@google.com>
> 
> Sergei Trofimovich reported that pulse audio sends SCM_CREDENTIALS
> as a control message to TCP. Since __sock_cmsg_send does not
> support SCM_RIGHTS and SCM_CREDENTIALS, it returns an error and
> hence breaks pulse audio over TCP.
> 
> SCM_RIGHTS and SCM_CREDENTIALS are sent on the SOL_SOCKET layer
> but they semantically belong to SOL_UNIX. Since all
> cmsg-processing functions including sock_cmsg_send ignore control
> messages of other layers, it is best to ignore SCM_RIGHTS
> and SCM_CREDENTIALS for consistency (and also for fixing pulse
> audio over TCP).
> 
> Signed-off-by: Soheil Hassas Yeganeh <soheil@google.com>
> Reported-by: Sergei Trofimovich <slyfox@gentoo.org>
> Tested-by: Sergei Trofimovich <slyfox@gentoo.org>

Please resubmit this with a proper "Fixes: " tag which tells which
commit introduced this regression.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] sock: ignore SCM_RIGHTS and SCM_CREDENTIALS in __sock_cmsg_send
  2016-07-11 20:39 ` David Miller
@ 2016-07-11 20:52   ` Soheil Hassas Yeganeh
  0 siblings, 0 replies; 3+ messages in thread
From: Soheil Hassas Yeganeh @ 2016-07-11 20:52 UTC (permalink / raw)
  To: David Miller
  Cc: Soheil Hassas Yeganeh, netdev, Sergei Trofimovich, Eric Dumazet,
	Willem de Bruijn

On Mon, Jul 11, 2016 at 4:39 PM, David Miller <davem@davemloft.net> wrote:
>
> From: Soheil Hassas Yeganeh <soheil.kdev@gmail.com>
> Date: Sun, 10 Jul 2016 12:51:46 -0400
>
> > From: Soheil Hassas Yeganeh <soheil@google.com>
> >
> > Sergei Trofimovich reported that pulse audio sends SCM_CREDENTIALS
> > as a control message to TCP. Since __sock_cmsg_send does not
> > support SCM_RIGHTS and SCM_CREDENTIALS, it returns an error and
> > hence breaks pulse audio over TCP.
> >
> > SCM_RIGHTS and SCM_CREDENTIALS are sent on the SOL_SOCKET layer
> > but they semantically belong to SOL_UNIX. Since all
> > cmsg-processing functions including sock_cmsg_send ignore control
> > messages of other layers, it is best to ignore SCM_RIGHTS
> > and SCM_CREDENTIALS for consistency (and also for fixing pulse
> > audio over TCP).
> >
> > Signed-off-by: Soheil Hassas Yeganeh <soheil@google.com>
> > Reported-by: Sergei Trofimovich <slyfox@gentoo.org>
> > Tested-by: Sergei Trofimovich <slyfox@gentoo.org>
>
> Please resubmit this with a proper "Fixes: " tag which tells which
> commit introduced this regression.

Sorry David that I forgot the Fixes tag. I just updated the patch and
resubmitted.

Thanks!
Soheil

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-07-11 20:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-10 16:51 [PATCH net] sock: ignore SCM_RIGHTS and SCM_CREDENTIALS in __sock_cmsg_send Soheil Hassas Yeganeh
2016-07-11 20:39 ` David Miller
2016-07-11 20:52   ` Soheil Hassas Yeganeh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).