virtio-win / kvm-guest-drivers-windows

Windows paravirtualized drivers for QEMU\KVM
https://www.linux-kvm.org/page/WindowsGuestDrivers
BSD 3-Clause "New" or "Revised" License
2.01k stars 385 forks source link

[virtiofs] Self-symlink causes crash in virtiofs share #1149

Open Sirius902 opened 2 weeks ago

Sirius902 commented 2 weeks ago

Describe the bug Opening a mounted virtiofs share in Windows Explorer with a self-symlink inside will cause the guest's virtiofs driver to crash.

To Reproduce Steps to reproduce the behaviour:

Expected behavior I would expect the virtiofs driver not to crash and possibly show the offending self-symlink as a shortcut.

Screenshots image image

Event Viewer error text:

Faulting application name: virtiofs.exe, version: 0.0.0.0, time stamp: 0x66952d29
Faulting module name: ntdll.dll, version: 10.0.22621.4111, time stamp: 0x518e67bb
Exception code: 0xc00000fd
Fault offset: 0x000000000002145a
Faulting process id: 0x0x1E28
Faulting application start time: 0x0x1DB07A4D7DEDDB8
Faulting application path: C:\Program Files\Virtio-Win\VioFS\virtiofs.exe
Faulting module path: C:\Windows\SYSTEM32\ntdll.dll
Report Id: bab05ad6-1799-40c1-894d-9ae2ca09894e
Faulting package full name: 
Faulting package-relative application ID: 

Host:

VM:

YanVugenfirer commented 2 weeks ago

Thank you for reporting the issue!

Symlinks are a known place for the corner cases due to the different handling by Linux and Windows. We will look into this, but unfortunately not in a very near future

xiagao commented 2 weeks ago

@Sirius902 I didn't reproduce this issue in my env with your steps, could you tell the virtiofsd version? Host/guest info: 5.14.0-494.el9.x86_64 virtiofsd-1.11.1-1.el9.x86_64 virtio-win-prewhql-0.1-262 Win11 23h3(os build 22631.3447)

Steps:

  1. Create virtiofsd with root privilege:

    mkdir /root/avocado/data/avocado-vt/virtio_fs_test/ &
    /usr/libexec/virtiofsd --socket-path=/var/tmp/avocado-vt-vm1-fs-virtiofsd.sock -o source=/root/avocado/data/avocado-vt/virtio_fs_test/ -o cache=auto &
  2. Create a symlink for a file

    ln -s tmp.sh tmp-link.sh
    lrwxrwxrwx 1 root root        6 Sep 18 08:34  tmp-link.sh -> tmp.sh
  3. Start Win11 guest and start virtiofs service.

    
    C:\>"C:\Program Files (x86)\WinFsp\bin\fsreg.bat" virtiofs C:\virtiofs.exe "-t %1 -m %2"
    The operation completed successfully.
    The operation completed successfully.
    The operation completed successfully.

C:>"C:\Program Files (x86)\WinFsp\bin\launchctl-x64.exe" start virtiofs xiagao_fs1 myfs Y: OK



4.  Opening the mounted virtiofs share in Windows Explorer, in my case it is Y: volume.

Results: No driver crash.
![image](https://github.com/user-attachments/assets/d5d655de-402c-4263-a73d-cd65b47b4526)
xiagao commented 2 weeks ago

Ignore my last comment. It wasn't for self-symlink. The self-symlink indeed makes the virtiofs volume crash inside guest. I'll create an internal issue to track it.