From: Stefano Brivio <sbrivio@redhat.com>
To: passt-dev@passt.top
Cc: Michal Humpula <bts@hudrydum.cz>,
David Gibson <david@gibson.dropbear.id.au>
Subject: [PATCH] apparmor: Fixes for new user namespace detaching procedure
Date: Fri, 2 Oct 2026 23:04:11 +0200 [thread overview]
Message-ID: <20261002210411.2522002-1-sbrivio@redhat.com> (raw)
Commit 7bf1595c9242 ("isolation: Don't create our userns as nobody")
changed the procedure user namespaces are detached, also for passt,
and adds unconditional setting of UID and GID maps.
This needs AppArmor adjustments:
- rules to access gid_map, uid_map, and setgroups entries in procfs
now need to be enabled for passt as well, not just for pasta: move
them to the passt abstraction (which is included from the pasta
abstraction)
- we now need to open a user namespace originally detached by a
separate holder process, which requires us to open procfs entries
that are disconnected (from an AppArmor perspective) from the
original namespace: add the attach_disconnected flag to the profile
for passt as well (this was already the case for pasta).
This isn't ideal but there doesn't seem any way around it: opening
the namespace from the holder process itself doesn't help either.
We'll need to add this flag also in passt subprofiles for
guestfs-tools (maintained in Debian) and libvirtd (which only
applies when guests are started as root for the moment, maintained
by libvirt upstream).
Reported-by: Michal Humpula <bts@hudrydum.cz>
Link: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1149683
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
---
contrib/apparmor/abstractions/passt | 4 +++-
contrib/apparmor/abstractions/pasta | 4 ----
contrib/apparmor/usr.bin.passt | 2 +-
3 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/contrib/apparmor/abstractions/passt b/contrib/apparmor/abstractions/passt
index f4570c1..0aeb19d 100644
--- a/contrib/apparmor/abstractions/passt
+++ b/contrib/apparmor/abstractions/passt
@@ -34,7 +34,9 @@
pivot_root "/tmp/" -> "/tmp/",
umount "/",
- owner @{PROC}/@{pid}/uid_map r, # conf_ugid()
+ owner @{PROC}/@{pid}/gid_map w, # make_ugid_map()
+ owner @{PROC}/@{pid}/setgroups w,
+ owner @{PROC}/@{pid}/uid_map rw,
@{PROC}/sys/net/ipv4/ip_local_port_range r, # fwd_probe_ephemeral()
diff --git a/contrib/apparmor/abstractions/pasta b/contrib/apparmor/abstractions/pasta
index 251d4a2..89fa427 100644
--- a/contrib/apparmor/abstractions/pasta
+++ b/contrib/apparmor/abstractions/pasta
@@ -35,10 +35,6 @@
/dev/net/tun rw, # tap_ns_tun(), tap.c
- owner @{PROC}/@{pid}/gid_map w, # pasta_start_ns(), conf_ugid()
- owner @{PROC}/@{pid}/setgroups w,
- owner @{PROC}/@{pid}/uid_map rw,
-
owner @{PROC}/sys/net/ipv4/ping_group_range w, # pasta_spawn_cmd(), pasta.c
/{usr/,}bin/** Ux,
diff --git a/contrib/apparmor/usr.bin.passt b/contrib/apparmor/usr.bin.passt
index da49e37..ccc2ea9 100644
--- a/contrib/apparmor/usr.bin.passt
+++ b/contrib/apparmor/usr.bin.passt
@@ -15,7 +15,7 @@ abi <abi/4.0>,
include <tunables/global>
-profile passt /usr/bin/passt{,.avx2} {
+profile passt /usr/bin/passt{,.avx2} flags=(attach_disconnected) {
include <abstractions/passt>
include <abstractions/user-tmp> # tap_sock_unix_open(),
--
2.43.0
reply other threads:[~2026-10-02 21:04 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261002210411.2522002-1-sbrivio@redhat.com \
--to=sbrivio@redhat.com \
--cc=bts@hudrydum.cz \
--cc=david@gibson.dropbear.id.au \
--cc=passt-dev@passt.top \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).