Repository navigation
apparmor: Add attach_disconnected flag to passt profile - #88
Open
hector-cao wants to merge 1 commit into
Open
hector-cao wants to merge 1 commit into
hector-cao wants to merge 1 commit into
Conversation
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>
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.