Skip to contentSkip to conversation

vhost broken?

Qemu-devel Gerd Hoffmann 6 participants 7 messages Jan 5, 2012 – Jan 21, 2012

lore
Share & tools
lore
#0 lore raw

Hi,

current master seems to corrupt guest memory, I get guest errors like this one:

swap_dup: Bad swap file entry 1999800080

BUG: Bad page map in process udevd  pte:bec5f30054520100 pmd:1f6f4067

addr:00007fc464a02000 vm_flags:00100073 anon_vma:ffff88001f928ec0 mapping:(null) index:7fc464a02
Pid: 555, comm: udevd Not tainted 2.6.32-220.el6.x86_64 #1

bisecting points to this commit:

commit 04097f7c5957273c578f72b9bd603ba6b1d69e33

Author: Avi Kivity <[email protected]>
Date:   Sun Dec 18 14:06:05 2011 +0200

vhost: convert to MemoryListener API

cheers,
Gerd

#1 lore raw
Quoted 11 lines · Gerd Hoffmann

Hi,

current master seems to corrupt guest memory, I get guest errors like this one:

swap_dup: Bad swap file entry 1999800080

BUG: Bad page map in process udevd  pte:bec5f30054520100 pmd:1f6f4067

addr:00007fc464a02000 vm_flags:00100073 anon_vma:ffff88001f928ec0 mapping:(null) index:7fc464a02
Pid: 555, comm: udevd Not tainted 2.6.32-220.el6.x86_64 #1

Quoted 8 lines

bisecting points to this commit:

commit 04097f7c5957273c578f72b9bd603ba6b1d69e33

Author: Avi Kivity <[email protected]>
Date:   Sun Dec 18 14:06:05 2011 +0200

vhost: convert to MemoryListener API

Very likely. Michael, can you help?

I don't have a vhost setup, can you share your command line?

Signature · 1 line
error compiling committee.c: too many arguments to function
#2 lore raw

Hi,

Quoted 1 line

I don't have a vhost setup, can you share your command line?

Just use libvirt which enables it automagically if possible ;)

Command line from /var/log/libvirt/qemu/rhel6-org-scsi.lsi.log is below (but probably doesn't buy you that much as it wouldn't work without the vhost/tap fd setup libvirt is doing).

cheers,
Gerd

LC_ALL=C PATH=/sbin:/usr/sbin:/bin:/usr/bin QEMU_AUDIO_DRV=spice /home/kraxel/bin/qemu-default -S -M pc-1.0 -enable-kvm -m 512 -smp 1,sockets=1,cores=1,threads=1 -name rhel6-org-scsi.lsi -uuid d67eb0e9-6a0d-faa0-308e-898692f8700d -nodefconfig -nodefaults -device
sga -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/rhel6-org-scsi.lsi.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc
-no-shutdown -boot order=c,menu=on -device
lsi,id=scsi0,bus=pci.0,addr=0x5 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x9 -drive file=/vmdisk/guests/rhel6.img,if=none,id=drive-scsi0-0-0,format=qcow2,cache=none,aio=threads -device
scsi-disk,bus=scsi0.0,scsi-id=0,drive=drive-scsi0-0-0,id=scsi0-0-0
-netdev tap,fd=26,id=hostnet0,vhost=on,vhostfd=27 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:c4:31:86,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device
isa-serial,chardev=charserial0,id=serial0 -chardev spicevmc,id=charchannel0,name=vdagent -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=com.redhat.spice.0 -usb -device usb-tablet,id=input0 -spice port=5900,addr=127.0.0.1,disable-ticketing -vga qxl -global qxl-vga.vram_size=67108864 -device
intel-hda,id=sound0,bus=pci.0,addr=0x4 -device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6 -bios /home/kraxel/rhel6/seabios/out/bios.bin -readconfig /home/kraxel/rhel6/qemu-kvm/docs/ich9-ehci-uhci.cfg -readconfig /root/libvirt/all-usbdrives.cfg -readconfig /root/libvirt/rhel6.cfg
-trace events=/root/libvirt/usb-host.events -option-rom romfile=/root/roms/8xx_64.rom,bootindex=1

#3 lore raw
In reply to Avi Kivity
Quoted 18 lines · Avi Kivity
Quoted 17 lines · Gerd Hoffmann

Hi,

current master seems to corrupt guest memory, I get guest errors like this one:

swap_dup: Bad swap file entry 1999800080

BUG: Bad page map in process udevd  pte:bec5f30054520100 pmd:1f6f4067

addr:00007fc464a02000 vm_flags:00100073 anon_vma:ffff88001f928ec0 mapping:(null) index:7fc464a02
Pid: 555, comm: udevd Not tainted 2.6.32-220.el6.x86_64 #1

bisecting points to this commit:

commit 04097f7c5957273c578f72b9bd603ba6b1d69e33

Author: Avi Kivity <[email protected]>
Date:   Sun Dec 18 14:06:05 2011 +0200
Quoted 6 lines
Quoted 2 lines

vhost: convert to MemoryListener API

Very likely. Michael, can you help?

I don't have a vhost setup, can you share your command line?

All you need to do is take your existing -netdev command line, and add in the parameter:

vhost=on

Libvirt does some extra stuff like passing down a pre-opened vhost file descriptor, but you can ignore that for just testing the core functionality.

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 :|
#4 lore raw
In reply to Avi Kivity
Quoted 18 lines · Avi Kivity
Quoted 17 lines · Gerd Hoffmann

Hi,

current master seems to corrupt guest memory, I get guest errors like this one:

swap_dup: Bad swap file entry 1999800080

BUG: Bad page map in process udevd  pte:bec5f30054520100 pmd:1f6f4067

addr:00007fc464a02000 vm_flags:00100073 anon_vma:ffff88001f928ec0 mapping:(null) index:7fc464a02
Pid: 555, comm: udevd Not tainted 2.6.32-220.el6.x86_64 #1

bisecting points to this commit:

commit 04097f7c5957273c578f72b9bd603ba6b1d69e33

Author: Avi Kivity <[email protected]>
Date:   Sun Dec 18 14:06:05 2011 +0200
Quoted 6 lines
Quoted 2 lines

vhost: convert to MemoryListener API

Very likely. Michael, can you help?

I don't have a vhost setup, can you share your command line?

Just chmod /dev/vhost-net to allow access, then
add vhost=on to the tap device.
Example

-netdev tap,id=foo,ifname=msttap0,script=/home/mst/ifup,downscript=no,vhost=on -device virtio-net-pci,netdev=foo

Quoted 2 lines
Signature · 1 line
error compiling committee.c: too many arguments to function
#5 lore raw
Quoted 1 line · Michael S. Tsirkin

Just chmod /dev/vhost-net to allow access

I wonder whether it's considered a security risk to allow non-root users access to /dev/vhost-net?

(Or is there a way to have root prepare limited use of vhost for only some users or some network devices?)

Regards,

Lutz Vieweg

#6 lore raw
Quoted 8 lines · Lutz Vieweg
Quoted 1 line · Michael S. Tsirkin

Just chmod /dev/vhost-net to allow access

I wonder whether it's considered a security risk to allow non-root users access to /dev/vhost-net?

(Or is there a way to have root prepare limited use of vhost for only some users or some network devices?)

Usual idiom is to create a dedicated group, chgrp /dev/vhost-net to this group and add g+rw permission. That lets you to add users to that group to grant them access.

Initially it was believed that /dev/kvm poses no security implications whatsoever and can be mode 0666. But later on several security bugs has been discovered in this subsystem, so it is a good idea to not grant extra privileges by default.

/mjt