[Devel] [PATCH RH7] net: export "net/core/xfrm*" sysctls for containers

Nikita Yushchenko nikita.yushchenko at virtuozzo.com
Mon Sep 6 14:26:45 MSK 2021


These sysctls only modify namespace-local XFRM protocol settings, and
are used by 'libreswan' package.

https://jira.sw.ru/browse/PSBM-132916
Signed-off-by: Nikita Yushchenko <nikita.yushchenko at virtuozzo.com>
---
 net/xfrm/xfrm_sysctl.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/xfrm/xfrm_sysctl.c b/net/xfrm/xfrm_sysctl.c
index 05a6e3d9c258..de612e6e6f63 100644
--- a/net/xfrm/xfrm_sysctl.c
+++ b/net/xfrm/xfrm_sysctl.c
@@ -1,5 +1,6 @@
 #include <linux/sysctl.h>
 #include <linux/slab.h>
+#include <linux/ve.h>
 #include <net/net_namespace.h>
 #include <net/xfrm.h>
 
@@ -54,8 +55,8 @@ int __net_init xfrm_sysctl_init(struct net *net)
 	table[2].data = &net->xfrm.sysctl_larval_drop;
 	table[3].data = &net->xfrm.sysctl_acq_expires;
 
-	/* Don't export sysctls to unprivileged users */
-	if (net->user_ns != &init_user_ns)
+	/* Export sysctls only to root userns of the host or the container */
+	if (ve_net_hide_sysctl(net))
 		table[0].procname = NULL;
 
 	net->xfrm.sysctl_hdr = register_net_sysctl(net, "net/core", table);
-- 
2.20.1



More information about the Devel mailing list