From: Mahesh Bandewar Date: Thu, 5 Jan 2023 02:28:42 +0000 (-0800) Subject: sysctl: expose all net/core sysctls inside netns X-Git-Tag: v6.3-rc1~162^2~331 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6b754d7bd007c5f68fbb2d9abd5c00d253b033d0;p=thirdparty%2Fkernel%2Flinux.git sysctl: expose all net/core sysctls inside netns All were not visible to the non-priv users inside netns. However, with 4ecb90090c84 ("sysctl: allow override of /proc/sys/net with CAP_NET_ADMIN"), these vars are protected from getting modified. A proc with capable(CAP_NET_ADMIN) can change the values so not having them visible inside netns is just causing nuisance to process that check certain values (e.g. net.core.somaxconn) and see different behavior in root-netns vs. other-netns Cc: "David S. Miller" Cc: Eric Dumazet Cc: Jakub Kicinski Cc: Paolo Abeni Cc: Soheil Hassas Yeganeh Signed-off-by: Mahesh Bandewar Acked-by: Soheil Hassas Yeganeh Signed-off-by: David S. Miller --- diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c index 5b1ce656baa1d..e7b98162c6321 100644 --- a/net/core/sysctl_net_core.c +++ b/net/core/sysctl_net_core.c @@ -643,11 +643,6 @@ static __net_init int sysctl_core_net_init(struct net *net) for (tmp = tbl; tmp->procname; tmp++) tmp->data += (char *)net - (char *)&init_net; - - /* Don't export any sysctls to unprivileged users */ - if (net->user_ns != &init_user_ns) { - tbl[0].procname = NULL; - } } net->core.sysctl_hdr = register_net_sysctl(net, "net/core", tbl);