** Description changed:

- On Ubuntu 26.04.1 (resolute), a qemu:///system VM using the passt
- network backend fails to start. passt is killed with signal 11
- immediately.
+ [ Impact ]
  
- Steps to reproduce:
- 1. Define a qemu:///system VM with <interface type='user'><backend 
type='passt'/>...</interface>
- 2. virsh -c qemu:///system start <vm>
+  * A qemu VM using the passt network backend
+    (<interface type='user'><backend type='passt'/></interface>) fails to
+    start or have the network functional.
  
- Actual result:
-   libvirt.libvirtError: internal error: Child process (passt --one-off 
--socket /run/libvirt/qemu/passt/2-<vm>-net0.socket --pid 
/run/libvirt/qemu/passt/2-<vm>-net0-passt.pid) unexpected fatal signal 11
- Kernel log at the same moment (reproducible on every start):
-   apparmor="DENIED" operation="file_mmap" profile="libvirt-<uuid>" 
name="/usr/bin/passt" comm="passt" requested_mask="rm" denied_mask="rm" 
fsuid=64055 ouid=0
+  * There are several AppArmor denials in the libvirt-qemu profile:
+    1. passt is denied mmap of its own binary. The "passt" subprofile only
+       grants 'r' on /usr/bin/passt; mapping needs 'm':
+         apparmor="DENIED" operation="file_mmap" name="/usr/bin/passt"
+         comm="passt" requested_mask="rm" denied_mask="rm"
+    2. Once passt runs, QEMU is denied access to the unix socket created by
+       passt under /run/libvirt/qemu/passt/:
+         apparmor="DENIED" operation="connect" class="file"
+         name="/run/libvirt/qemu/passt/5-<vm>-net0.socket"
+         requested_mask="wr" denied_mask="wr"
  
- Expected result:
-   passt runs under the libvirt-<uuid>//passt subprofile (the generated 
profile includes "/usr/bin/passt Cx -> passt,") and the VM starts.
+ [ Test Plan ]
  
- Analysis:
- - The denial is logged against the VM's main profile, not the //passt 
subprofile, so the Cx transition never applies. libvirtd appears to start passt 
directly with the VM's profile already applied.
- - The main profile doesn't allow mapping /usr/bin/passt, so passt dies before 
it can run.
- - fsuid 64055 is libvirt-qemu (system mode).
- - /etc/apparmor.d/local/* overrides are empty; the profiles are stock.
- - passt itself is fine: the same binary works as pasta for rootless Podman on 
this machine.
- - Related upstream discussion (unprivileged/session-mode variant): passt-dev 
"Apparmor (and other) Issues", Feb 2025. The same denial is reported on Ask 
Ubuntu (question 1555327) for 24.04 and 25.04.
+ Download the resolute cloud image and customize the root password so that
+ you can login to the console.
  
- Workaround: use QEMU's built-in user networking (interface type='user'
- without a passt backend) or the default NAT network.
+ $ sudo apt install -y libvirt-daemon-system libvirt-clients passt 
qemu-system-x86
+ $ virsh define vm.xml   # vm.xml can be found in [Other Info] section
+ $ virsh start --console test
  
- Versions:
-   libvirt 12.0.0-1ubuntu5.6
-   passt 0.0~git20260120.386b5f5-1
-   apparmor 5.0.2-0ubuntu1~26.04.1
-   qemu 10.2.1
-   kernel 7.0.0-43-generic
+  * Before the fix: the VM start fails with "unexpected fatal signal 11" from
+    passt, and the kernel log shows the DENIED file_mmap on /usr/bin/passt
+    (sudo dmesg | grep -i 'apparmor="DENIED"').
  
- ProblemType: Bug
- DistroRelease: Ubuntu 26.04
- Package: libvirt-daemon-system 12.0.0-1ubuntu5.6
- ProcVersionSignature: Ubuntu 7.0.0-43.43-generic 7.0.14
- Uname: Linux 7.0.0-43-generic x86_64
- ApportVersion: 2.34.1-0ubuntu0.1
- Architecture: amd64
- CasperMD5CheckResult: pass
- CurrentDesktop: ubuntu:GNOME
- Date: Sun Nov  8 11:26:35 2026
- InstallationDate: Installed on 2026-10-05 (34 days ago)
- InstallationMedia: Ubuntu 26.04.1 LTS "Resolute Raccoon" - Release amd64 
(20260826)
- ProcEnviron:
-  LANG=en_US.UTF-8
-  PATH=(custom, no user)
-  SHELL=/bin/bash
-  TERM=xterm-256color
-  XDG_RUNTIME_DIR=<set>
- SourcePackage: libvirt
- UpgradeStatus: No upgrade log present (probably fresh install)
+    OR the VM boots fine but the network interface does not get any IP.
+ 
+  * After the fix: the VM starts, the network interface gets an IP.
+    
+ [ Where problems could occur ]
+ 
+  * The change is limited to the AppArmor template
+    src/security/apparmor/libvirt-qemu, and only touches passt-related
+    rules:
+    - 'm' is added to /usr/bin/passt in the passt subprofile, which allows
+      passt to map its own binary.
+    - rw is added on /run/libvirt/qemu/passt/*.socket in the main profile.
+  * The socket rule is slightly broader than a per-VM path, as it allows
+    any QEMU guest profile to access any passt socket under that directory.
+    The directory is only writable by libvirt, so the exposure is limited.
+  * Possible regressions are AppArmor profile parse errors (all VMs would
+    fail to start) or unexpected denials for VMs that use passt. Both would
+    be visible on VM start and in the kernel log. Guests that do not use
+    passt are not affected.
+ 
+ [ Other Info ]
+ 
+ 1 - vm.xml
+ 
+ <domain type='kvm'>
+   <uuid>3555e03d-d061-4e52-b8f1-d2d82fd54655</uuid>
+   <name>test</name>
+   <memory unit='GiB'>2</memory>
+   <currentMemory unit='GiB'>2</currentMemory>
+   <vcpu placement='static'>2</vcpu>
+ 
+   <os>
+     <type arch='x86_64'>hvm</type>
+     <boot dev='hd'/>
+   </os>
+ 
+   <features>
+     <acpi/>
+     <apic/>
+   </features>
+ 
+   <cpu mode='host-passthrough'/>
+   <clock offset='utc'/>
+ 
+   <on_poweroff>destroy</on_poweroff>
+   <on_reboot>restart</on_reboot>
+   <on_crash>destroy</on_crash>
+ 
+   <devices>
+     <emulator>/usr/bin/qemu-system-x86_64</emulator>
+ 
+     <!-- Main OS Disk (Ubuntu Cloud Image) -->
+     <disk type='file' device='disk'>
+       <driver name='qemu' type='qcow2'/>
+       <source file='/tmp/resolute-server-cloudimg-amd64.img'/>
+       <target dev='vda' bus='virtio'/>
+     </disk>
+ 
+     <interface type='user'>
+       <backend type='passt'/>
+       <mac address='52:54:00:12:34:56'/>
+       <source dev='enp5s0'/>
+       <model type='virtio'/>
+     </interface>
+     <!-- Serial console for 'virsh console' access -->
+     <serial type='pty'>
+       <target port='0'/>
+     </serial>
+     <console type='pty'>
+       <target type='serial' port='0'/>
+     </console>
+   </devices>
+ </domain>

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2173698

Title:
  libvirt system-mode VM with passt backend fails to start: AppArmor
  denies file_mmap of /usr/bin/passt (passt not transitioning to //passt
  subprofile)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/2173698/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to