linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] vsock.7: Add missing structure element
@ 2019-11-19 17:31 Mikhail Golubev
  2019-11-21 10:17 ` Michael Kerrisk (man-pages)
  0 siblings, 1 reply; 2+ messages in thread
From: Mikhail Golubev @ 2019-11-19 17:31 UTC (permalink / raw)
  To: mtk.manpages; +Cc: linux-man

The structure 'struct sockaddr_vm' has additional element 'unsigned char
svm_zero[]' since version v3.9-rc1 (include/uapi/linux/vm_sockets.h).
Linux kernel checks that this element is zeroed
(net/vmw_vsock/vsock_addr.c). Reflect this on the vsock man page.

Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=205583
Signed-off-by: Mikhail Golubev <Mikhail.Golubev@opensynergy.com>
---
 man7/vsock.7 | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/man7/vsock.7 b/man7/vsock.7
index 23c67548f..145057719 100644
--- a/man7/vsock.7
+++ b/man7/vsock.7
@@ -95,6 +95,7 @@ struct sockaddr_vm {
     unsigned short svm_reserved1;
     unsigned int   svm_port;       /* Port # in host byte order */
     unsigned int   svm_cid;        /* Address in host byte order */
+    unsigned char  svm_zero[];
 };
 .EE
 .in
@@ -113,6 +114,8 @@ Only a process with the
 capability may
 .BR bind (2)
 to these port numbers.
+.I svm_zero
+is always set to 0.
 .PP
 There are several special addresses:
 .B VMADDR_CID_ANY
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] vsock.7: Add missing structure element
  2019-11-19 17:31 [patch] vsock.7: Add missing structure element Mikhail Golubev
@ 2019-11-21 10:17 ` Michael Kerrisk (man-pages)
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Kerrisk (man-pages) @ 2019-11-21 10:17 UTC (permalink / raw)
  To: Mikhail Golubev; +Cc: mtk.manpages, linux-man

Hello Mikhail,

On 11/19/19 6:31 PM, Mikhail Golubev wrote:
> The structure 'struct sockaddr_vm' has additional element 'unsigned char
> svm_zero[]' since version v3.9-rc1 (include/uapi/linux/vm_sockets.h).
> Linux kernel checks that this element is zeroed
> (net/vmw_vsock/vsock_addr.c). Reflect this on the vsock man page.
> 
> Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=205583
> Signed-off-by: Mikhail Golubev <Mikhail.Golubev@opensynergy.com>
> ---
>  man7/vsock.7 | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/man7/vsock.7 b/man7/vsock.7
> index 23c67548f..145057719 100644
> --- a/man7/vsock.7
> +++ b/man7/vsock.7
> @@ -95,6 +95,7 @@ struct sockaddr_vm {
>      unsigned short svm_reserved1;
>      unsigned int   svm_port;       /* Port # in host byte order */
>      unsigned int   svm_cid;        /* Address in host byte order */
> +    unsigned char  svm_zero[];
>  };
>  .EE
>  .in
> @@ -113,6 +114,8 @@ Only a process with the
>  capability may
>  .BR bind (2)
>  to these port numbers.
> +.I svm_zero
> +is always set to 0.
>  .PP
>  There are several special addresses:
>  .B VMADDR_CID_ANY

Thanks for the patch. I applied it, and tweaked the wording also.
In addition, I think we must describe the size of the field,
since the use of an open-ended array at the end of a struct
has a specific (different) meaning in C. So, in the end the change
looks as below.

Cheers,

Michael

diff --git a/man7/vsock.7 b/man7/vsock.7
index 23c67548f..1adc3084b 100644
--- a/man7/vsock.7
+++ b/man7/vsock.7
@@ -95,6 +95,11 @@ struct sockaddr_vm {
     unsigned short svm_reserved1;
     unsigned int   svm_port;       /* Port # in host byte order */
     unsigned int   svm_cid;        /* Address in host byte order */
+    unsigned char  svm_zero[sizeof(struct sockaddr) \-
+                            sizeof(sa_family_t) \-
+                            sizeof(unsigned short) \-
+                            sizeof(unsigned int) \-
+                            sizeof(unsigned int)];
 };
 .EE
 .in
@@ -113,6 +118,8 @@ Only a process with the
 capability may
 .BR bind (2)
 to these port numbers.
+.I svm_zero
+must be zero-filled.
 .PP
 There are several special addresses:
 .B VMADDR_CID_ANY



-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-11-21 10:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-19 17:31 [patch] vsock.7: Add missing structure element Mikhail Golubev
2019-11-21 10:17 ` Michael Kerrisk (man-pages)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).