Skip to contentSkip to conversation

VirtFS mapped symlinks resolved wrong

Qemu-devel Moshroum 2 participants 9 messages Sep 23, 2010 – Sep 27, 2010

lore
Share & tools
lore

Moshroum

author
#0 lore raw

Public bug reported:

I tried to map a folder with qemu-kvm qemu-kvm-0.13.0-rc1-3-gc9c2179 (this is v0.13.0-rc1-16667-gc9c2179). I mounted it first in passthrough mode and saw all symlinks as expected. Then I used mapped and noticed that the target of a symlink changed to the actual data inside the linked folder as target instead of the target filename.

So for example if you have a file abc with the content "omg, this is important stuff" and a symlink lnkme -> abc then it wiill look inside the kvm with mounted 9p virtio (mapped) like that:

lnkme -> omg, this is important stuff

Another problem I noticed was that I cannot mount it (mapped or passthrough) using /etc/rc.local or /etc/fstab, but after login as root using

mount /mnt

or

mount -t 9p -o trans=virtio host_share /mnt

(the same stuff i tried inside /etc/rc.local)

The only output on a failed mount in rc.local/fstab I get is

[   15.035920] device: '9p-1': device_add
[   15.038180] 9p: no channels available
[   15.038937] device: '9p-1': device_unregister
[   15.049123] device: '9p-1': device_create_release

** Affects: qemu
Importance: Undecided
Status: New

Signature · 32 lines
VirtFS mapped symlinks resolved wrong
https://bugs.launchpad.net/bugs/646427
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.

Status in QEMU: New

Bug description:
I tried to map a folder with qemu-kvm qemu-kvm-0.13.0-rc1-3-gc9c2179 (this is v0.13.0-rc1-16667-gc9c2179). I mounted it first in passthrough mode and saw all symlinks as expected. Then I used mapped and noticed that the target of a symlink changed to the actual data inside the linked folder as target instead of the target filename.

So for example if you have a file abc with the content "omg, this is important stuff" and a symlink lnkme -> abc then it wiill look inside the kvm with mounted 9p virtio (mapped) like that:

lnkme -> omg, this is important stuff



Another problem I noticed was that I cannot mount it (mapped or passthrough) using /etc/rc.local or /etc/fstab, but after login as root using

mount /mnt

or

mount -t 9p -o trans=virtio host_share /mnt

(the same stuff i tried inside /etc/rc.local)

The only output on a failed mount in rc.local/fstab I get is 

[   15.035920] device: '9p-1': device_add
[   15.038180] 9p: no channels available
[   15.038937] device: '9p-1': device_unregister
[   15.049123] device: '9p-1': device_create_release
author
#1 lore raw

Why not using simple symlinks on the host with xattr like on normal files instead of those hacks which either don't work on client or don't work on the host?

Signature · 32 lines
VirtFS mapped symlinks resolved wrong
https://bugs.launchpad.net/bugs/646427
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.

Status in QEMU: New

Bug description:
I tried to map a folder with qemu-kvm qemu-kvm-0.13.0-rc1-3-gc9c2179 (this is v0.13.0-rc1-16667-gc9c2179). I mounted it first in passthrough mode and saw all symlinks as expected. Then I used mapped and noticed that the target of a symlink changed to the actual data inside the linked folder as target instead of the target filename.

So for example if you have a file abc with the content "omg, this is important stuff" and a symlink lnkme -> abc then it wiill look inside the kvm with mounted 9p virtio (mapped) like that:

lnkme -> omg, this is important stuff



Another problem I noticed was that I cannot mount it (mapped or passthrough) using /etc/rc.local or /etc/fstab, but after login as root using

mount /mnt

or

mount -t 9p -o trans=virtio host_share /mnt

(the same stuff i tried inside /etc/rc.local)

The only output on a failed mount in rc.local/fstab I get is 

[   15.035920] device: '9p-1': device_add
[   15.038180] 9p: no channels available
[   15.038937] device: '9p-1': device_unregister
[   15.049123] device: '9p-1': device_create_release
author
#2 lore raw
In reply to Moshroum

And maybe you should use lsetxattr and lgetxattr instead of the symlink resolving versions setxattr and getxattr

Signature · 32 lines
VirtFS mapped symlinks resolved wrong
https://bugs.launchpad.net/bugs/646427
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.

Status in QEMU: New

Bug description:
I tried to map a folder with qemu-kvm qemu-kvm-0.13.0-rc1-3-gc9c2179 (this is v0.13.0-rc1-16667-gc9c2179). I mounted it first in passthrough mode and saw all symlinks as expected. Then I used mapped and noticed that the target of a symlink changed to the actual data inside the linked folder as target instead of the target filename.

So for example if you have a file abc with the content "omg, this is important stuff" and a symlink lnkme -> abc then it wiill look inside the kvm with mounted 9p virtio (mapped) like that:

lnkme -> omg, this is important stuff



Another problem I noticed was that I cannot mount it (mapped or passthrough) using /etc/rc.local or /etc/fstab, but after login as root using

mount /mnt

or

mount -t 9p -o trans=virtio host_share /mnt

(the same stuff i tried inside /etc/rc.local)

The only output on a failed mount in rc.local/fstab I get is 

[   15.035920] device: '9p-1': device_add
[   15.038180] 9p: no channels available
[   15.038937] device: '9p-1': device_unregister
[   15.049123] device: '9p-1': device_create_release
#3 lore raw
In reply to Moshroum

Responding to multiple issues raised above.

- Let us track this bug for the security/symlink issue and open a different defect for the mount issue.
- I tried to reproduce this defect with the QEMU mainline. I don't see the problem. More description on the environment (Host OS/Guest OS/ QEMU command line etc) and how to reproduce the problem will be helpful.
[root@localhost mmnt]# cat file1
omg it is important
[root@localhost mmnt]# ln -sf file1 sym1
[root@localhost mmnt]# ls -l
total 16
-rw-r--r-- 1 root root 20 2010-09-24 01:24 file1
lrwxrwxrwx 1 root root 6 2010-09-24 01:24 sym1 -> file1
[root@localhost mmnt]# logout
- Moshroom:
- There are multiple security models here, if you use 'passthrough' same type of files are created on the host/guest. But if you use 'mapped' security model this is how we do it.
This security model is for cloud use case scenarios. Please read more in this post
http://www.mail-archive.com/[email protected]/msg31452.html
- No need to use lsetattr/lgetattr here because we always create regular files in this model.

Signature · 32 lines
VirtFS mapped symlinks resolved wrong
https://bugs.launchpad.net/bugs/646427
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.

Status in QEMU: New

Bug description:
I tried to map a folder with qemu-kvm qemu-kvm-0.13.0-rc1-3-gc9c2179 (this is v0.13.0-rc1-16667-gc9c2179). I mounted it first in passthrough mode and saw all symlinks as expected. Then I used mapped and noticed that the target of a symlink changed to the actual data inside the linked folder as target instead of the target filename.

So for example if you have a file abc with the content "omg, this is important stuff" and a symlink lnkme -> abc then it wiill look inside the kvm with mounted 9p virtio (mapped) like that:

lnkme -> omg, this is important stuff



Another problem I noticed was that I cannot mount it (mapped or passthrough) using /etc/rc.local or /etc/fstab, but after login as root using

mount /mnt

or

mount -t 9p -o trans=virtio host_share /mnt

(the same stuff i tried inside /etc/rc.local)

The only output on a failed mount in rc.local/fstab I get is 

[   15.035920] device: '9p-1': device_add
[   15.038180] 9p: no channels available
[   15.038937] device: '9p-1': device_unregister
[   15.049123] device: '9p-1': device_create_release
author
#4 lore raw
In reply to Moshroum

Host OS is Debian sid/experimental amd64 with 2.6.32-5-amd64 (2.6.32-23). qemu-kvm version can be found above. As said before the symlink were created outside the vm and then tried to access inside the vm.

So I have to use passthrough in host/client shared folders... which means I have to run kvm as root. :(

Signature · 32 lines
VirtFS mapped symlinks resolved wrong
https://bugs.launchpad.net/bugs/646427
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.

Status in QEMU: New

Bug description:
I tried to map a folder with qemu-kvm qemu-kvm-0.13.0-rc1-3-gc9c2179 (this is v0.13.0-rc1-16667-gc9c2179). I mounted it first in passthrough mode and saw all symlinks as expected. Then I used mapped and noticed that the target of a symlink changed to the actual data inside the linked folder as target instead of the target filename.

So for example if you have a file abc with the content "omg, this is important stuff" and a symlink lnkme -> abc then it wiill look inside the kvm with mounted 9p virtio (mapped) like that:

lnkme -> omg, this is important stuff



Another problem I noticed was that I cannot mount it (mapped or passthrough) using /etc/rc.local or /etc/fstab, but after login as root using

mount /mnt

or

mount -t 9p -o trans=virtio host_share /mnt

(the same stuff i tried inside /etc/rc.local)

The only output on a failed mount in rc.local/fstab I get is 

[   15.035920] device: '9p-1': device_add
[   15.038180] 9p: no channels available
[   15.038937] device: '9p-1': device_unregister
[   15.049123] device: '9p-1': device_create_release
author
#5 lore raw
In reply to Moshroum

But mapped is also really confusing. Everything inside the vm:

$ id
uid=0(root) gid=0(root) groups=0(root)
$ touch newfile
$ -rw-r--r-- 1 root 1000 0 Sep 24 20:39 newfile

So the gid is not set correctly. On thhe host:

% xattr newfile
user.virtfs.uid
user.virtfs.mode

I started it using:
% /usr/local/kvm/bin/qemu-system-x86_64 -m 1024 -kernel linux-2.6.35.5.qemu -drive file=root.cow1,if=virtio -net nic,macaddr=02:ca:ff:ee:ba:be,model=virtio,vlan=1 -net tap,ifname=tap1,vlan=1,script=no -virtfs local,path=/shared,security_model=mapped,mount_tag=host -nographic

Signature · 32 lines
VirtFS mapped symlinks resolved wrong
https://bugs.launchpad.net/bugs/646427
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.

Status in QEMU: New

Bug description:
I tried to map a folder with qemu-kvm qemu-kvm-0.13.0-rc1-3-gc9c2179 (this is v0.13.0-rc1-16667-gc9c2179). I mounted it first in passthrough mode and saw all symlinks as expected. Then I used mapped and noticed that the target of a symlink changed to the actual data inside the linked folder as target instead of the target filename.

So for example if you have a file abc with the content "omg, this is important stuff" and a symlink lnkme -> abc then it wiill look inside the kvm with mounted 9p virtio (mapped) like that:

lnkme -> omg, this is important stuff



Another problem I noticed was that I cannot mount it (mapped or passthrough) using /etc/rc.local or /etc/fstab, but after login as root using

mount /mnt

or

mount -t 9p -o trans=virtio host_share /mnt

(the same stuff i tried inside /etc/rc.local)

The only output on a failed mount in rc.local/fstab I get is 

[   15.035920] device: '9p-1': device_add
[   15.038180] 9p: no channels available
[   15.038937] device: '9p-1': device_unregister
[   15.049123] device: '9p-1': device_create_release
author
#6 lore raw
In reply to Moshroum

** Description changed:

I tried to map a folder with qemu-kvm qemu-kvm-0.13.0-rc1-3-gc9c2179 (this is v0.13.0-rc1-16667-gc9c2179). I mounted it first in passthrough mode and saw all symlinks as expected. Then I used mapped and noticed that the target of a symlink changed to the actual data inside the linked folder as target instead of the target filename.

So for example if you have a file abc with the content "omg, this is important stuff" and a symlink lnkme -> abc then it wiill look inside the kvm with mounted 9p virtio (mapped) like that:

lnkme -> omg, this is important stuff
-
-
- Another problem I noticed was that I cannot mount it (mapped or
- passthrough) using /etc/rc.local or /etc/fstab, but after login as root
- using
-
- mount /mnt
-
- or
-
- mount -t 9p -o trans=virtio host_share /mnt
-
- (the same stuff i tried inside /etc/rc.local)
-
- The only output on a failed mount in rc.local/fstab I get is -

- [   15.035920] device: '9p-1': device_add
- [   15.038180] 9p: no channels available
- [   15.038937] device: '9p-1': device_unregister
- [   15.049123] device: '9p-1': device_create_release
Signature · 13 lines
VirtFS mapped symlinks resolved wrong
https://bugs.launchpad.net/bugs/646427
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.

Status in QEMU: New

Bug description:
I tried to map a folder with qemu-kvm qemu-kvm-0.13.0-rc1-3-gc9c2179 (this is v0.13.0-rc1-16667-gc9c2179). I mounted it first in passthrough mode and saw all symlinks as expected. Then I used mapped and noticed that the target of a symlink changed to the actual data inside the linked folder as target instead of the target filename.

So for example if you have a file abc with the content "omg, this is important stuff" and a symlink lnkme -> abc then it wiill look inside the kvm with mounted 9p virtio (mapped) like that:

lnkme -> omg, this is important stuff
#7 lore raw
In reply to Moshroum

Passthrough model needs to be used if you want the compatibility on/off the virtfs mount. The mapped model virtfs-izes the filesystem. For mapped model, one need to start a fresh share and continue to use it only from the guest.

Regarding gid is not being correct, please use 9P2000.L protocol, on the mount specify -o version=9p2000.L. The default is 9P2000.U which doesn't support gid.

Ex mount command:

mount -t 9p -o trans=virtio -o version=9p2000.L -o debug=0xFFFF v_map_virtfs /mmnt

We recently added some info the the external wiki.
(http://wiki.qemu.org/Documentation/9psetup)

- JV

Signature · 13 lines
VirtFS mapped symlinks resolved wrong
https://bugs.launchpad.net/bugs/646427
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.

Status in QEMU: New

Bug description:
I tried to map a folder with qemu-kvm qemu-kvm-0.13.0-rc1-3-gc9c2179 (this is v0.13.0-rc1-16667-gc9c2179). I mounted it first in passthrough mode and saw all symlinks as expected. Then I used mapped and noticed that the target of a symlink changed to the actual data inside the linked folder as target instead of the target filename.

So for example if you have a file abc with the content "omg, this is important stuff" and a symlink lnkme -> abc then it wiill look inside the kvm with mounted 9p virtio (mapped) like that:

lnkme -> omg, this is important stuff
author
#8 lore raw
In reply to Moshroum

Fixed by the mentioned documentation

** Changed in: qemu
Status: New => Invalid

Signature · 13 lines
VirtFS mapped symlinks resolved wrong
https://bugs.launchpad.net/bugs/646427
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.

Status in QEMU: Invalid

Bug description:
I tried to map a folder with qemu-kvm qemu-kvm-0.13.0-rc1-3-gc9c2179 (this is v0.13.0-rc1-16667-gc9c2179). I mounted it first in passthrough mode and saw all symlinks as expected. Then I used mapped and noticed that the target of a symlink changed to the actual data inside the linked folder as target instead of the target filename.

So for example if you have a file abc with the content "omg, this is important stuff" and a symlink lnkme -> abc then it wiill look inside the kvm with mounted 9p virtio (mapped) like that:

lnkme -> omg, this is important stuff