* [PATCH net] vsock/uapi: fix linux/vm_sockets.h userspace compilation errors
@ 2025-06-23 10:00 Stefano Garzarella
2025-06-25 0:30 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Stefano Garzarella @ 2025-06-23 10:00 UTC (permalink / raw)
To: netdev
Cc: Andy King, Stefano Garzarella, George Zhang, Jakub Kicinski,
Eric Dumazet, Simon Horman, virtualization, Paolo Abeni,
Dmitry Torokhov, linux-kernel, David S. Miller, Daan De Meyer
From: Stefano Garzarella <sgarzare@redhat.com>
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>
---
include/uapi/linux/vm_sockets.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/include/uapi/linux/vm_sockets.h b/include/uapi/linux/vm_sockets.h
index ed07181d4eff..e05280e41522 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>
#include <linux/types.h>
--
2.49.0
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH net] vsock/uapi: fix linux/vm_sockets.h userspace compilation errors
2025-06-23 10:00 [PATCH net] vsock/uapi: fix linux/vm_sockets.h userspace compilation errors Stefano Garzarella
@ 2025-06-25 0:30 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-06-25 0:30 UTC (permalink / raw)
To: Stefano Garzarella
Cc: netdev, acking, georgezhang, kuba, edumazet, horms,
virtualization, pabeni, dtor, linux-kernel, davem,
daan.j.demeyer
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Mon, 23 Jun 2025 12:00:53 +0200 you wrote:
> From: Stefano Garzarella <sgarzare@redhat.com>
>
> 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) -
> |
>
> [...]
Here is the summary with links:
- [net] vsock/uapi: fix linux/vm_sockets.h userspace compilation errors
https://git.kernel.org/netdev/net/c/22bbc1dcd0d6
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-06-25 0:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-23 10:00 [PATCH net] vsock/uapi: fix linux/vm_sockets.h userspace compilation errors Stefano Garzarella
2025-06-25 0:30 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®