[Devel] [RFC 45/54] sock: fix CONFIG_VE=n build
Eva Kurchatova
eva.kurchatova at virtuozzo.com
Wed Apr 29 22:58:45 MSK 2026
Signed-off-by: Eva Kurchatova <eva.kurchatova at virtuozzo.com>
---
net/core/sock.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/net/core/sock.c b/net/core/sock.c
index 926225c3cb3f..660fbab72666 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1319,6 +1319,7 @@ int sk_setsockopt(struct sock *sk, int level, int optname,
sock_valbool_flag(sk, SOCK_BROADCAST, valbool);
break;
case SO_SNDBUF:
+#ifdef CONFIG_VE
unpriv_sndbuf:
/* Don't error on this BSD doesn't and if you think
* about it this is right. Otherwise apps have to
@@ -1326,6 +1327,7 @@ int sk_setsockopt(struct sock *sk, int level, int optname,
* are treated in BSD as hints
*/
val = min_t(u32, val, READ_ONCE(sysctl_wmem_max));
+#endif
set_sndbuf:
/* Ensure val * 2 fits into an int, to prevent max_t()
* from treating it as a negative value.
@@ -1343,11 +1345,11 @@ int sk_setsockopt(struct sock *sk, int level, int optname,
ret = -EPERM;
break;
}
-
+#ifdef CONFIG_VE
/* nft utility uses this sockopt in CentOS 8 env */
if (!ve_is_super(get_exec_env()))
goto unpriv_sndbuf;
-
+#endif
/* No negative values (to prevent underflow, as val will be
* multiplied by 2).
*/
@@ -1356,7 +1358,9 @@ int sk_setsockopt(struct sock *sk, int level, int optname,
goto set_sndbuf;
case SO_RCVBUF:
+#ifdef CONFIG_VE
unpriv_rcvbuf:
+#endif
/* Don't error on this BSD doesn't and if you think
* about it this is right. Otherwise apps have to
* play 'guess the biggest size' games. RCVBUF/SNDBUF
@@ -1370,11 +1374,11 @@ int sk_setsockopt(struct sock *sk, int level, int optname,
ret = -EPERM;
break;
}
-
+#ifdef CONFIG_VE
/* nft utility uses this sockopt in CentOS 8 env */
if (!ve_is_super(get_exec_env()))
goto unpriv_rcvbuf;
-
+#endif
/* No negative values (to prevent underflow, as val will be
* multiplied by 2).
*/
--
2.54.0
More information about the Devel
mailing list