Skip to content

apparmor: Add attach_disconnected flag to passt profile - #88

Open
hector-cao wants to merge 1 commit into
qemus:masterfrom
hector-cao:fix-apparmor-1
Open

hector-cao wants to merge 1 commit into
qemus:masterfrom
hector-cao:fix-apparmor-1

Conversation

@hector-cao

Copy link
Copy Markdown

On Ubuntu 26.04

I run passt:

$ passt --foreground -s /tmp/passt.socket -t 2222:22

qemu VM:

$ qemu-system-x86_64 -enable-kvm -m 4G -cpu host -smp 2 -nographic -drive file=resolute-server-cloudimg-amd64.img,format=qcow2 -netdev stream,id=net0,server=off,addr.type=unix,addr.path=/tmp/passt.socket -device virtio-net-pci,netdev=net0

The guest does not get an IP and network is not working.
With strace log, I see that accept4() fails in passt that causes QEMU process unable to connect.


In isolate_prefork(), passt detaches from the host filesystem: it pivot_root()s into an empty tmpfs and lazily unmounts the old root. Paths to objects opened before this point, such as the listening UNIX domain socket for the hypervisor, can't be resolved from the new root any longer, and AppArmor sees them as disconnected paths.

The visible effect is that accept4() on the hypervisor socket fails with EACCES once passt is sandboxed, so the guest can't connect, and have networking functional.

Set flags=(attach_disconnected), so that disconnected paths are attached to the root of the namespace and mediated against the existing rules, as other sandboxing profiles (e.g. libvirt's) do.

In isolate_prefork(), passt detaches from the host filesystem: it
pivot_root()s into an empty tmpfs and lazily unmounts the old root.
Paths to objects opened before this point, such as the listening UNIX
domain socket for the hypervisor, can't be resolved from the new
root any longer, and AppArmor sees them as disconnected paths.

The visible effect is that accept4() on the hypervisor socket fails
with EACCES once passt is sandboxed, so the guest can't connect,
and have networking functional.

Set flags=(attach_disconnected), so that disconnected paths are
attached to the root of the namespace and mediated against the
existing rules, as other sandboxing profiles (e.g. libvirt's) do.

Signed-off-by: Hector Cao <hector.cao@canonical.com>
@kroese

kroese commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Hi,

Thanks for the bugfix! However this repo is just a mirror of the original Passt code. So this fix should be send to their repo, not this clone.

The address of their git repo is: https://passt.top/passt/ and there you can also file bug reports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants