virtiofs guest connection refused after upgrade qemu-system-x86:amd64 (1:6.2+dfsg-2ubuntu6.12, 1:6.2+dfsg-2ubuntu6.13)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
qemu (Ubuntu) |
Invalid
|
Undecided
|
Unassigned | ||
Jammy |
Fix Released
|
High
|
Sergio Durigan Junior |
Bug Description
[ Impact ]
QEMU users who rely on virtiofs for mounting external paths will face a connection refused error while trying to accessing such mountpoints. There is no workaround for this problem other than using a previous version of QEMU.
[ Test Plan ]
We'll need to create a VM on libvirt and edit its XML domain definition in order to make it use virtiofsd to access a path on the host.
Inside a Jammy system:
$ sudo apt install -y libvirt-
$ uvt-simplestrea
$ uvt-kvm create j release=jammy --memory 1024
$ virsh destroy j
$ virsh edit j
Inside the editor, add the following snippets:
<domain type='kvm'>
...
<memoryBacking>
<source type='memfd'/>
<access mode='shared'/>
</memoryBacking>
...
<devices>
...
<filesystem type='mount' accessmode=
<driver type='virtiofs' queue='1024'/>
<binary path='/
<cache mode='always'/>
<lock posix='on' flock='on'/>
</binary>
<source dir='/tmp/test'/>
<target dir='mytag'/>
</filesystem>
...
</devices>
</domain>
Save and exit.
$ mkdir -p /tmp/test
$ touch /tmp/test/a
$ virsh start j
$ virsh wait j
$ virsh ssh j
Now, while inside the VM (as the ubuntu user):
$ sudo mount -t virtiofs mytag /mnt
$ ls -la /mnt
You should see the file 'a'.
[ Where problems could occur ]
This bug is a regression caused by one of the patches backported to address bug bug #1853307. The problem happens because the Linux kernel headers have been updated, and that caused a change in the size of "struct fuse_init_in" that wasn't accounted for. Upstream's fix for this was to initially limit the function that reads such struct in a way that only the 16 initial bytes are considered. This fix, albeit correct in theory, wasn't part of any release because https:/
A regression, if it were to occur, would likely manifest in the form of problems with the code responsible for parsing the first 16 bytes of the struct. I'm not entirely sure whether the struct can be affected by compiler optimizations which add paddings to speed better align the struct fields; it doesn't that it is.
Note that a regression here would only affect virtiofsd users, who are already completely unable to use the feature.
[ Original Description ]
After installing the upgrades
qemu-system-
qemu-user-
qemu-utils:amd64 (1:6.2+
qemu-system-
qemu-block-
qemu-system-
qemu-system-
and a reboot of the server, all virtual machines are getting an "connection refused" error and cannot access the host folders via virtiofs anymore.
Exact Error message on the client:
cannot access '/var/www-lib': Connection refused
Nothing else in the Logs.
Client OS:
Distributor ID: Ubuntu
Description: Ubuntu 22.04.3 LTS
Release: 22.04
Codename: jammy
Linux 5.15.0-82-generic #91-Ubuntu SMP
FileSystem: EXT4
Server OS:
Distributor ID: Ubuntu
Description: Ubuntu 22.04.3 LTS
Release: 22.04
Codename: jammy
Ubuntu 22.04, 5.15.0-82-generic #91-Ubuntu SMP Mon Aug 14 14:14:14 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
FileSystem: EXT4
I scanned all logs, in the kern.log, I found the following message:
virtiofs virtio0: virtio_
the XML-Code from the guest machine looks like this:
...
<memoryBacking>
<hugepages>
<page size='2' unit='M'/>
</hugepages>
<access mode='shared'/>
</memoryBacking>
....
<filesystem type='mount' accessmode=
<driver type='virtiofs' queue='1024'/>
<binary path='/
<cache mode='always'/>
<lock posix='on' flock='on'/>
</binary>
<source dir='/Da/n/W/w'/>
<target dir='W'/>1
<address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
</filesystem>
...
I did a little more trying to find the issue. The change in the file /usr/lib/
I did an upgrade to the new rust based virtiofsd and modified my virtual machine to be loaded without flock and posix on.
Voila, mapping is working.
Now I changed it back to the original version - access denied
flock and posix still not configured, changing back to version 1:6.2+dfsg-
Therefore I assume we have an bug in the new virtiofsd version.
Related branches
- git-ubuntu bot: Approve
- Athos Ribeiro (community): Approve
- Canonical Server Core Reviewers: Pending requested
- Canonical Server Reporter: Pending requested
-
Diff: 84 lines (+62/-0)3 files modifieddebian/changelog (+9/-0)
debian/patches/series (+1/-0)
debian/patches/ubuntu/lp-2033957-virtiofsd-Fix-breakage-due-to-fuse_init_in.patch (+52/-0)
description: | updated |
Changed in qemu (Ubuntu Jammy): | |
status: | Triaged → In Progress |
tags: | added: regression-update |
tags: | added: verification-done-jammy |
tags: | removed: verification-done-jammy verification-needed-jammy |
tags: | added: verification-done-jammy |
Status changed to 'Confirmed' because the bug affects multiple users.