aboutsummaryrefslogtreecommitdiffstats
path: root/net/unix
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2012-11-15 22:02:59 -0500
committerDavid S. Miller <davem@davemloft.net>2012-11-18 20:30:55 -0500
commit464dc801c76aa0db88e16e8f5f47c6879858b9b2 (patch)
treecfaf0f43f4ce50669f07031ec42062b4c9a7f985 /net/unix
parent73f7ef435934e952c1d70d83d69921ea5d1f6bd4 (diff)
net: Don't export sysctls to unprivileged users
In preparation for supporting the creation of network namespaces by unprivileged users, modify all of the per net sysctl exports and refuse to allow them to unprivileged users. This makes it safe for unprivileged users in general to access per net sysctls, and allows sysctls to be exported to unprivileged users on an individual basis as they are deemed safe. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/unix')
-rw-r--r--net/unix/sysctl_net_unix.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/net/unix/sysctl_net_unix.c b/net/unix/sysctl_net_unix.c
index b34b5b9792f0..8800604c93f4 100644
--- a/net/unix/sysctl_net_unix.c
+++ b/net/unix/sysctl_net_unix.c
@@ -34,6 +34,10 @@ int __net_init unix_sysctl_register(struct net *net)
34 if (table == NULL) 34 if (table == NULL)
35 goto err_alloc; 35 goto err_alloc;
36 36
37 /* Don't export sysctls to unprivileged users */
38 if (net->user_ns != &init_user_ns)
39 table[0].procname = NULL;
40
37 table[0].data = &net->unx.sysctl_max_dgram_qlen; 41 table[0].data = &net->unx.sysctl_max_dgram_qlen;
38 net->unx.ctl = register_net_sysctl(net, "net/unix", table); 42 net->unx.ctl = register_net_sysctl(net, "net/unix", table);
39 if (net->unx.ctl == NULL) 43 if (net->unx.ctl == NULL)