Skip to contentSkip to conversation

net: net_cls: fd passed in SCM_RIGHTS datagram not set correctly

PATCH In review Daniel Wagner 4 participants 4 messages Jan 21, 2013 1 message not in the archive

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: net_cls: fd passed in SCM_RIGHTS datagram not set correctly

From: Daniel Wagner <[email protected]>

Commit 6a328d8c6f03501657ad580f6f98bf9a42583ff7 changed the update logic for the socket but it does not update the SCM_RIGHTS update as well. This patch is based on the net_prio fix commit

48a87cc26c13b68f6cce4e9d769fcb17a6b3e4b8

net: netprio: fd passed in SCM_RIGHTS datagram not set correctly

A socket fd passed in a SCM_RIGHTS datagram was not getting updated with the new tasks cgrp prioidx. This leaves IO on the socket tagged with the old tasks priority.

To fix this add a check in the scm recvmsg path to update the sock cgrp prioidx with the new tasks value.

Let's apply the same fix for net_cls.

Cc "David S. Miller" <davem-fT/PcQaiUtIeIZ0/[email protected]>
Cc "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/[email protected]>
Cc Al Viro <viro-RmSDqhL/[email protected]>
Cc John Fastabend <[email protected]>
Cc Neil Horman <[email protected]>
---
 net/core/scm.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
net/core/scm.c +4 -1
index 57fb1ee..905dcc6 100644
@@ -35,6 +35,7 @@
 #include <net/sock.h>
 #include <net/compat.h>
 #include <net/scm.h>
+#include <net/cls_cgroup.h>
 
 
 /*
@@ -302,8 +303,10 @@ void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm)
 		}
 		/* Bump the usage count and install the file. */
 		sock = sock_from_file(fp[i], &err);
-		if (sock)
+		if (sock) {
 			sock_update_netprioidx(sock->sk, current);
+			sock_update_classid(sock->sk, current);
+		}
 		fd_install(new_fd, get_file(fp[i]));
 	}
 
Signature · 1 line
1.8.0.rc0

A message that is not in the archive (sent off-list or not yet received): 1358761102-7765-1-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org

#2 lore raw
Quoted 14 lines · Daniel Wagner

From: Daniel Wagner <[email protected]>

Commit 6a328d8c6f03501657ad580f6f98bf9a42583ff7 changed the update logic for the socket but it does not update the SCM_RIGHTS update as well. This patch is based on the net_prio fix commit

48a87cc26c13b68f6cce4e9d769fcb17a6b3e4b8

net: netprio: fd passed in SCM_RIGHTS datagram not set correctly

A socket fd passed in a SCM_RIGHTS datagram was not getting updated with the new tasks cgrp prioidx. This leaves IO on the socket tagged with the old tasks priority.

Quoted 6 lines

To fix this add a check in the scm recvmsg path to update the sock cgrp prioidx with the new tasks value.

Let's apply the same fix for net_cls.

Acutally I didn't report this. I was about to send exactly the same patch and then I noticed the shared socket issue. ;)

Quoted 10 lines
Cc "David S. Miller" <davem-fT/PcQaiUtIeIZ0/[email protected]>
Cc "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/[email protected]>
Cc Al Viro <viro-RmSDqhL/[email protected]>
Cc John Fastabend <[email protected]>
Cc Neil Horman <[email protected]>
---
 net/core/scm.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
#3 lore raw
Quoted 15 lines · Li Zefan
Quoted 14 lines · Daniel Wagner

From: Daniel Wagner <[email protected]>

Commit 6a328d8c6f03501657ad580f6f98bf9a42583ff7 changed the update logic for the socket but it does not update the SCM_RIGHTS update as well. This patch is based on the net_prio fix commit

48a87cc26c13b68f6cce4e9d769fcb17a6b3e4b8

net: netprio: fd passed in SCM_RIGHTS datagram not set correctly

A socket fd passed in a SCM_RIGHTS datagram was not getting updated with the new tasks cgrp prioidx. This leaves IO on the socket tagged with the old tasks priority.

Quoted 8 lines
Quoted 6 lines

To fix this add a check in the scm recvmsg path to update the sock cgrp prioidx with the new tasks value.

Let's apply the same fix for net_cls.

Acutally I didn't report this.

You made me look into this, so you reported it at least in my eyes :)

Quoted 2 lines

I was about to send exactly the same
patch and then I noticed the shared socket issue. ;)

I don't mind if you want your patch to be applied. I just felt responsible for the changes I did.

thanks,
daniel

#4 lore raw
In reply to a message not in the archive

From: Daniel Wagner <[email protected]>
Date: Mon, 21 Jan 2013 10:38:22 +0100

Quoted 14 lines

From: Daniel Wagner <[email protected]>

Commit 6a328d8c6f03501657ad580f6f98bf9a42583ff7 changed the update logic for the socket but it does not update the SCM_RIGHTS update as well. This patch is based on the net_prio fix commit

48a87cc26c13b68f6cce4e9d769fcb17a6b3e4b8

net: netprio: fd passed in SCM_RIGHTS datagram not set correctly

A socket fd passed in a SCM_RIGHTS datagram was not getting updated with the new tasks cgrp prioidx. This leaves IO on the socket tagged with the old tasks priority.

Quoted 6 lines

To fix this add a check in the scm recvmsg path to update the sock cgrp prioidx with the new tasks value.

Let's apply the same fix for net_cls.

You need to resubmit this, and proprly add a "Signed-off-by: " tag for yourself.