summaryrefslogtreecommitdiff
path: root/include/uapi
diff options
context:
space:
mode:
authorStefano Garzarella <sgarzare@redhat.com>2025-06-23 12:00:53 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-07-17 18:27:41 +0200
commit162ac8836c57544b21e207375e5dc913b6afe267 (patch)
tree714af2201b0120665dbb5eae680ca705b0ae752c /include/uapi
parent48939325f88b685baee397442ab8bbc4217ba66a (diff)
downloadlinux-162ac8836c57544b21e207375e5dc913b6afe267.tar.gz
linux-162ac8836c57544b21e207375e5dc913b6afe267.tar.bz2
linux-162ac8836c57544b21e207375e5dc913b6afe267.zip
vsock/uapi: fix linux/vm_sockets.h userspace compilation errors
[ Upstream commit 22bbc1dcd0d6785fb390c41f0dd5b5e218d23bdd ] If a userspace application just include <linux/vm_sockets.h> will fail to build with the following errors: /usr/include/linux/vm_sockets.h:182:39: error: invalid application of ‘sizeof’ to incomplete type ‘struct sockaddr’ 182 | unsigned char svm_zero[sizeof(struct sockaddr) - | ^~~~~~ /usr/include/linux/vm_sockets.h:183:39: error: ‘sa_family_t’ undeclared here (not in a function) 183 | sizeof(sa_family_t) - | Include <sys/socket.h> for userspace (guarded by ifndef __KERNEL__) where `struct sockaddr` and `sa_family_t` are defined. We already do something similar in <linux/mptcp.h> and <linux/if.h>. Fixes: d021c344051a ("VSOCK: Introduce VM Sockets") Reported-by: Daan De Meyer <daan.j.demeyer@gmail.com> Signed-off-by: Stefano Garzarella <sgarzare@redhat.com> Link: https://patch.msgid.link/20250623100053.40979-1-sgarzare@redhat.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'include/uapi')
-rw-r--r--include/uapi/linux/vm_sockets.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/uapi/linux/vm_sockets.h b/include/uapi/linux/vm_sockets.h
index fd0ed7221645..67e3938e86bd 100644
--- a/include/uapi/linux/vm_sockets.h
+++ b/include/uapi/linux/vm_sockets.h
@@ -17,6 +17,10 @@
#ifndef _UAPI_VM_SOCKETS_H
#define _UAPI_VM_SOCKETS_H
+#ifndef __KERNEL__
+#include <sys/socket.h> /* for struct sockaddr and sa_family_t */
+#endif
+
#include <linux/socket.h>
/* Option name for STREAM socket buffer size. Use as the option name in