VirtIO 9p mount_tag (bogus?) limit of 32 bytes
I've noticed that if you use a virtio 9p filesystem with a mount_tag property value that is longer than 32 bytes, it gets silently truncated.
In virtio-9p-device.c
len = strlen(conf->tag);
if (len > MAX_TAG_LEN) {
len = MAX_TAG_LEN;
}The header virtio-9p.h contains
/* from Linux's linux/virtio_9p.h */
/* The ID for virtio console */ #define VIRTIO_ID_9P 9 #define MAX_REQ 128 #define MAX_TAG_LEN 32
The Linux kernel's virtio_9p.h, however, does not have any MAX_TAG_LEN constant and AFAICT the code in Linux's net/9p/trans_virtio.c is not placing any 32 byte length restriction on the mount tag.
So is this QEMU length limit legacy code that can be removed ?
If using the mount_tag to specify the desired guest mount location path, then 32 bytes is really quite limiting - a good 255 bytes is much more desirable.
Finally, regardless of what limit is imposed, it would be better to return an error if the user attempts to specify an excessively long mount tag, rather than truncate it breaking the guest app relying on the full tag.
Regards,
Daniel
Signature · 4 lines
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
Quoted 8 lines · Daniel P. Berrange
I've noticed that if you use a virtio 9p filesystem with a
mount_tagproperty value that is longer than 32 bytes, it gets silently truncated.In
virtio-9p-device.clen = strlen(conf->tag); if (len> MAX_TAG_LEN) { len = MAX_TAG_LEN;
I think its better to return here with a failure message saying mount_tag too long. IIUC, The 32 byte limit has been kept because of understanding that mount_tag is a device name in guest (and not a path location).
Aneesh, any inputs ?
- Harsh
Quoted 31 lines
}The header
virtio-9p.hcontains/* from Linux's linux/virtio_9p.h */ /* The ID for virtio console */ #define VIRTIO_ID_9P 9 #define MAX_REQ 128 #define MAX_TAG_LEN 32The Linux kernel's
virtio_9p.h, however, does not have anyMAX_TAG_LENconstant and AFAICT the code in Linux'snet/9p/trans_virtio.cis not placing any 32 byte length restriction on the mount tag.So is this QEMU length limit legacy code that can be removed ?
If using the
mount_tagto specify the desired guest mount location path, then 32 bytes is really quite limiting - a good 255 bytes is much more desirable.Finally, regardless of what limit is imposed, it would be better to return an error if the user attempts to specify an excessively long mount tag, rather than truncate it breaking the guest app relying on the full tag.
Regards,
Daniel
Quoted 6 lines · Harsh Bora
Quoted 5 lines · Daniel P. Berrange
I've noticed that if you use a virtio 9p filesystem with a
mount_tagproperty value that is longer than 32 bytes, it gets silently truncated.In
virtio-9p-device.c
Quoted 8 lines
Quoted 3 lines
len = strlen(conf->tag); if (len> MAX_TAG_LEN) { len = MAX_TAG_LEN;I think its better to return here with a failure message saying
mount_tagtoo long. IIUC, The 32 byte limit has been kept because of understanding thatmount_tagis a device name in guest (and not a path location).
While I appreciate the fact that 'mount_tag' is not required to be a path name, so you can allow symbolic naming for exports, in some use cases it is important / significantly simpler to be able to just set a path name. I don't think we should mandate symbolic naming, or path based naming - we should just allow users to choose which best suits their needs.
For example, I am building appliances which have multiple 9p devices exported to the guest. These 9p filesystems are all mounted by the 'init' process in the initrd. If I'm forced to use symbolic naming for devices, it means I need to create a custom initrd for every appliance configuration I have (many many many of them), with the init process knowing how to map from symbolic names back to the mount paths I actually want. If I can just use a path for the mount_tag, then one single initrd can be used for all my appliances.
So I really would like 'mount_tag' to be significantly larger upto at least 255 bytes, or more.
Daniel
Signature · 4 lines
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
Quoted 32 lines · Daniel P. Berrange
Quoted 6 lines · Harsh Bora
Quoted 5 lines · Daniel P. Berrange
I've noticed that if you use a virtio 9p filesystem with a
mount_tagproperty value that is longer than 32 bytes, it gets silently truncated.In
virtio-9p-device.cQuoted 8 lines
Quoted 3 lines
len = strlen(conf->tag); if (len> MAX_TAG_LEN) { len = MAX_TAG_LEN;I think its better to return here with a failure message saying
mount_tagtoo long. IIUC, The 32 byte limit has been kept because of understanding thatmount_tagis a device name in guest (and not a path location).While I appreciate the fact that '
mount_tag' is not required to be a path name, so you can allow symbolic naming for exports, in some use cases it is important / significantly simpler to be able to just set a path name. I don't think we should mandate symbolic naming, or path based naming - we should just allow users to choose which best suits their needs.For example, I am building appliances which have multiple 9p devices exported to the guest. These 9p filesystems are all mounted by the 'init' process in the initrd. If I'm forced to use symbolic naming for devices, it means I need to create a custom initrd for every appliance configuration I have (many many many of them), with the init process knowing how to map from symbolic names back to the mount paths I actually want. If I can just use a path for the
mount_tag, then one single initrd can be used for all my appliances.
Quoted 3 lines
So I really would like '
mount_tag' to be significantly larger upto at least 255 bytes, or more.
Will you not be able to have well defined mount tags, that map these directories. I guess we don't want to claim 255 bytes out of config space for mount tag. That is one of the reason it is limited to 32 bytes.
-aneesh
Quoted 33 lines · Aneesh Kumar K.V
Quoted 32 lines · Daniel P. Berrange
Quoted 6 lines · Harsh Bora
Quoted 5 lines · Daniel P. Berrange
I've noticed that if you use a virtio 9p filesystem with a
mount_tagproperty value that is longer than 32 bytes, it gets silently truncated.In
virtio-9p-device.cQuoted 8 lines
Quoted 3 lines
len = strlen(conf->tag); if (len> MAX_TAG_LEN) { len = MAX_TAG_LEN;I think its better to return here with a failure message saying
mount_tagtoo long. IIUC, The 32 byte limit has been kept because of understanding thatmount_tagis a device name in guest (and not a path location).While I appreciate the fact that '
mount_tag' is not required to be a path name, so you can allow symbolic naming for exports, in some use cases it is important / significantly simpler to be able to just set a path name. I don't think we should mandate symbolic naming, or path based naming - we should just allow users to choose which best suits their needs.For example, I am building appliances which have multiple 9p devices exported to the guest. These 9p filesystems are all mounted by the 'init' process in the initrd. If I'm forced to use symbolic naming for devices, it means I need to create a custom initrd for every appliance configuration I have (many many many of them), with the init process knowing how to map from symbolic names back to the mount paths I actually want. If I can just use a path for the
mount_tag, then one single initrd can be used for all my appliances.
Quoted 8 lines
Quoted 3 lines
So I really would like '
mount_tag' to be significantly larger upto at least 255 bytes, or more.Will you not be able to have well defined mount tags, that map these directories. I guess we don't want to claim 255 bytes out of config space for mount tag. That is one of the reason it is limited to 32 bytes.
The reason for using paths instead of symbolic names in the mount tag is because the guest code does not know what paths it might be asked to mount at runtime. Symbolic names in the mount tags are only useful if the guest can be told ahead of time about a finite set of tag -> path mappings, which is not a reasonable assumption in general.
Regards,
Daniel
Signature · 4 lines
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|