linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fuse: reserve byteswapped init opcodes
@ 2019-09-04 12:36 Michael S. Tsirkin
  2019-09-04 14:22 ` Dr. David Alan Gilbert
  2019-09-04 18:53 ` Stefan Hajnoczi
  0 siblings, 2 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2019-09-04 12:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Miklos Szeredi, linux-fsdevel, stefanha, dgilbert

virtio fs tunnels fuse over a virtio channel.  One issue is two sides
might be speaking different endian-ness. To detects this,
host side looks at the opcode value in the FUSE_INIT command.
Works fine at the moment but might fail if a future version
of fuse will use such an opcode for initialization.
Let's reserve this opcode so we remember and don't do this.

Same for CUSE_INIT.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/uapi/linux/fuse.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/uapi/linux/fuse.h b/include/uapi/linux/fuse.h
index 2971d29a42e4..f042e63f4aa0 100644
--- a/include/uapi/linux/fuse.h
+++ b/include/uapi/linux/fuse.h
@@ -425,6 +425,10 @@ enum fuse_opcode {
 
 	/* CUSE specific operations */
 	CUSE_INIT		= 4096,
+
+	/* Reserved opcodes: helpful to detect structure endian-ness */
+	FUSE_INIT_BSWAP_RESERVED	= 26 << 24,
+	CUSE_INIT_BSWAP_RESERVED	= 16 << 16,
 };
 
 enum fuse_notify_code {
-- 
MST

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

* Re: [PATCH] fuse: reserve byteswapped init opcodes
  2019-09-04 12:36 [PATCH] fuse: reserve byteswapped init opcodes Michael S. Tsirkin
@ 2019-09-04 14:22 ` Dr. David Alan Gilbert
  2019-09-04 18:53 ` Stefan Hajnoczi
  1 sibling, 0 replies; 3+ messages in thread
From: Dr. David Alan Gilbert @ 2019-09-04 14:22 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: linux-kernel, Miklos Szeredi, linux-fsdevel, stefanha

* Michael S. Tsirkin (mst@redhat.com) wrote:
> virtio fs tunnels fuse over a virtio channel.  One issue is two sides
> might be speaking different endian-ness. To detects this,
> host side looks at the opcode value in the FUSE_INIT command.
> Works fine at the moment but might fail if a future version
> of fuse will use such an opcode for initialization.
> Let's reserve this opcode so we remember and don't do this.

I think in theory that works even for normal fuse.

> Same for CUSE_INIT.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>  include/uapi/linux/fuse.h | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/include/uapi/linux/fuse.h b/include/uapi/linux/fuse.h
> index 2971d29a42e4..f042e63f4aa0 100644
> --- a/include/uapi/linux/fuse.h
> +++ b/include/uapi/linux/fuse.h
> @@ -425,6 +425,10 @@ enum fuse_opcode {
>  
>  	/* CUSE specific operations */
>  	CUSE_INIT		= 4096,
> +
> +	/* Reserved opcodes: helpful to detect structure endian-ness */
> +	FUSE_INIT_BSWAP_RESERVED	= 26 << 24,

FUSE_INIT << 24 probably works?

> +	CUSE_INIT_BSWAP_RESERVED	= 16 << 16,

Dave

>  };
>  
>  enum fuse_notify_code {
> -- 
> MST
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

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

* Re: [PATCH] fuse: reserve byteswapped init opcodes
  2019-09-04 12:36 [PATCH] fuse: reserve byteswapped init opcodes Michael S. Tsirkin
  2019-09-04 14:22 ` Dr. David Alan Gilbert
@ 2019-09-04 18:53 ` Stefan Hajnoczi
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2019-09-04 18:53 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: linux-kernel, Miklos Szeredi, linux-fsdevel, dgilbert

[-- Attachment #1: Type: text/plain, Size: 670 bytes --]

On Wed, Sep 04, 2019 at 08:36:33AM -0400, Michael S. Tsirkin wrote:
> virtio fs tunnels fuse over a virtio channel.  One issue is two sides
> might be speaking different endian-ness. To detects this,
> host side looks at the opcode value in the FUSE_INIT command.
> Works fine at the moment but might fail if a future version
> of fuse will use such an opcode for initialization.
> Let's reserve this opcode so we remember and don't do this.
> 
> Same for CUSE_INIT.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>  include/uapi/linux/fuse.h | 4 ++++
>  1 file changed, 4 insertions(+)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2019-09-04 18:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-04 12:36 [PATCH] fuse: reserve byteswapped init opcodes Michael S. Tsirkin
2019-09-04 14:22 ` Dr. David Alan Gilbert
2019-09-04 18:53 ` Stefan Hajnoczi

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).