* [PATCH] net: net_cls: fd passed in SCM_RIGHTS datagram not set correctly @ 2013-01-21 9:38 Daniel Wagner [not found] ` <1358761102-7765-1-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org> 0 siblings, 1 reply; 4+ messages in thread From: Daniel Wagner @ 2013-01-21 9:38 UTC (permalink / raw) To: netdev-u79uwXL29TY76Z2rM5mHXA, cgroups-u79uwXL29TY76Z2rM5mHXA Cc: lizefan-hv44wF8Li93QT0dZR+AlfA, Daniel Wagner, David S. Miller, Eric W. Biederman, Al Viro, John Fastabend, Neil Horman From: Daniel Wagner <daniel.wagner-98C5kh4wR6ohFhg+JK9F0w@public.gmane.org> 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. Reported-by: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org> Cc: "David S. Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org> Cc: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org> Cc: Al Viro <viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org> Cc: John Fastabend <john.r.fastabend-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> Cc: Neil Horman <nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org> Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Cc: cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org --- net/core/scm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/core/scm.c b/net/core/scm.c index 57fb1ee..905dcc6 100644 --- a/net/core/scm.c +++ b/net/core/scm.c @@ -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])); } -- 1.8.0.rc0 ^ permalink raw reply related [flat|nested] 4+ messages in thread
[parent not found: <1358761102-7765-1-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>]
* Re: [PATCH] net: net_cls: fd passed in SCM_RIGHTS datagram not set correctly [not found] ` <1358761102-7765-1-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org> @ 2013-01-21 9:54 ` Li Zefan 2013-01-21 10:16 ` Daniel Wagner 2013-01-21 19:17 ` David Miller 1 sibling, 1 reply; 4+ messages in thread From: Li Zefan @ 2013-01-21 9:54 UTC (permalink / raw) To: Daniel Wagner Cc: netdev-u79uwXL29TY76Z2rM5mHXA, cgroups-u79uwXL29TY76Z2rM5mHXA, Daniel Wagner, David S. Miller, Eric W. Biederman, Al Viro, John Fastabend, Neil Horman On 2013/1/21 17:38, Daniel Wagner wrote: > From: Daniel Wagner <daniel.wagner-98C5kh4wR6ohFhg+JK9F0w@public.gmane.org> > > 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. > > Reported-by: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org> Acutally I didn't report this. I was about to send exactly the same patch and then I noticed the shared socket issue. ;) > Cc: "David S. Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org> > Cc: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org> > Cc: Al Viro <viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org> > Cc: John Fastabend <john.r.fastabend-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> > Cc: Neil Horman <nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org> > Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org > Cc: cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org > --- > net/core/scm.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net: net_cls: fd passed in SCM_RIGHTS datagram not set correctly 2013-01-21 9:54 ` Li Zefan @ 2013-01-21 10:16 ` Daniel Wagner 0 siblings, 0 replies; 4+ messages in thread From: Daniel Wagner @ 2013-01-21 10:16 UTC (permalink / raw) To: Li Zefan Cc: netdev, cgroups, Daniel Wagner, David S. Miller, Eric W. Biederman, Al Viro, John Fastabend, Neil Horman On 21.01.2013 10:54, Li Zefan wrote: > On 2013/1/21 17:38, Daniel Wagner wrote: >> From: Daniel Wagner <daniel.wagner@bmw-carit.de> >> >> 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. >> >> Reported-by: Li Zefan <lizefan@huawei.com> > > Acutally I didn't report this. You made me look into this, so you reported it at least in my eyes :) > 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 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net: net_cls: fd passed in SCM_RIGHTS datagram not set correctly [not found] ` <1358761102-7765-1-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org> 2013-01-21 9:54 ` Li Zefan @ 2013-01-21 19:17 ` David Miller 1 sibling, 0 replies; 4+ messages in thread From: David Miller @ 2013-01-21 19:17 UTC (permalink / raw) To: wagi-kQCPcA+X3s7YtjvyW6yDsg Cc: netdev-u79uwXL29TY76Z2rM5mHXA, cgroups-u79uwXL29TY76Z2rM5mHXA, lizefan-hv44wF8Li93QT0dZR+AlfA, daniel.wagner-98C5kh4wR6ohFhg+JK9F0w, ebiederm-aS9lmoZGLiVWk0Htik3J/w, viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn, john.r.fastabend-ral2JQCrhuEAvxtiuMwx3w, nhorman-2XuSBdqkA4R54TAoqtyWWQ From: Daniel Wagner <wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org> Date: Mon, 21 Jan 2013 10:38:22 +0100 > From: Daniel Wagner <daniel.wagner-98C5kh4wR6ohFhg+JK9F0w@public.gmane.org> > > 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. > > Reported-by: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org> You need to resubmit this, and proprly add a "Signed-off-by: " tag for yourself. ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-01-21 19:17 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-01-21 9:38 [PATCH] net: net_cls: fd passed in SCM_RIGHTS datagram not set correctly Daniel Wagner [not found] ` <1358761102-7765-1-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org> 2013-01-21 9:54 ` Li Zefan 2013-01-21 10:16 ` Daniel Wagner 2013-01-21 19:17 ` David Miller
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).