[Devel] [PATCH RHEL10 COMMIT] net/unix: fix unix_stream_recvmsg() build with CONFIG_BPF_SYSCALL=n

Konstantin Khorenko khorenko at virtuozzo.com
Fri Aug 21 19:42:27 MSK 2026


The commit is pushed to "branch-rh10-6.12.0-211.39.1.16.x.vz10-ovz" and will appear at git at bitbucket.org:openvz/vzkernel.git
after rh10-6.12.0-211.39.1.16.6.vz10
------>
commit 9653e667efe1c8ea07954bb0b39f1a5116445afd
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date:   Fri Aug 21 18:37:13 2026 +0200

    net/unix: fix unix_stream_recvmsg() build with CONFIG_BPF_SYSCALL=n
    
    The MSG_ERRQUEUE path of unix_stream_recvmsg() passes the socket to
    unix_recv_error(), but 'sk' is declared inside the CONFIG_BPF_SYSCALL
    block a few lines above, so the function does not build without that
    option:
    
      net/unix/af_unix.c:3073:40: error: 'sk' undeclared (first use in this
                                  function)
    
    x86_64 defconfig and the User Mode Linux defconfig - the one we want for
    KUnit - both have CONFIG_BPF_SYSCALL=n, so neither has ever built this
    file.
    
    Declare 'sk' unconditionally; the BPF block keeps its own 'prot'.
    
    Fixes: c9ccba858dd1 ("net: zerocopy over unix sockets")
    Feature: net: zerocopy over unix sockets
    https://virtuozzo.atlassian.net/browse/VSTOR-134732
    Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 net/unix/af_unix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index fa9038e89f838..7a37c06a097c4 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -3060,9 +3060,9 @@ static int unix_stream_recvmsg(struct socket *sock, struct msghdr *msg,
 		.size = size,
 		.flags = flags
 	};
+	struct sock *sk = sock->sk;
 
 #ifdef CONFIG_BPF_SYSCALL
-	struct sock *sk = sock->sk;
 	const struct proto *prot = READ_ONCE(sk->sk_prot);
 
 	if (prot != &unix_stream_proto)


More information about the Devel mailing list