From: Stefano Brivio <sbrivio@redhat.com>
To: passt-dev@passt.top
Cc: "Jörg Sonnenberger" <joerg@bec.de>,
"Danish Prakash" <danish.prakash@suse.com>,
"Christian Boltz" <suse-beta@cboltz.de>,
"Paul Holzinger" <pholzing@redhat.com>
Subject: [PATCH 3/3] apparmor: Fix access to procfs namespace entries in pasta's abstraction
Date: Wed, 3 Apr 2024 21:04:21 +0200 [thread overview]
Message-ID: <20240403190425.2848764-4-sbrivio@redhat.com> (raw)
In-Reply-To: <20240403190425.2848764-1-sbrivio@redhat.com>
From: Danish Prakash <danish.prakash@suse.com>
From an original patch by Danish Prakash.
With commit ff22a78d7b52 ("pasta: Don't try to watch namespaces in
procfs with inotify, use timer instead"), if a filesystem-bound
target namespace is passed on the command line, we'll grab a handle
on its parent directory. That commit, however, didn't introduce a
matching AppArmor rule. Add it here.
To access a network namespace procfs entry, we also need a 'ptrace'
rule. See commit 594dce66d3bb ("isolation: keep CAP_SYS_PTRACE when
required") for details as to when we need this -- essentially, it's
about operation with Buildah.
Reported-by: Jörg Sonnenberger <joerg@bec.de>
Link: https://github.com/containers/buildah/issues/5440
Link: https://bugzilla.suse.com/show_bug.cgi?id=1221840
Fixes: ff22a78d7b52 ("pasta: Don't try to watch namespaces in procfs with inotify, use timer instead")
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
---
contrib/apparmor/abstractions/pasta | 3 +++
1 file changed, 3 insertions(+)
diff --git a/contrib/apparmor/abstractions/pasta b/contrib/apparmor/abstractions/pasta
index 060caab..581ad1b 100644
--- a/contrib/apparmor/abstractions/pasta
+++ b/contrib/apparmor/abstractions/pasta
@@ -29,6 +29,7 @@
@{run}/user/@{uid}/** rw, # pasta_open_ns(), main()
+ @{PROC}/[0-9]*/ns/ r, # pasta_netns_quit_init(),
@{PROC}/[0-9]*/ns/net r, # pasta_wait_for_ns(),
@{PROC}/[0-9]*/ns/user r, # conf_pasta_ns()
@@ -42,3 +43,5 @@
/{usr/,}bin/** Ux,
/usr/bin/pasta.avx2 ix, # arch_avx2_exec(), arch.c
+
+ ptrace r, # pasta_open_ns()
--
@@ -29,6 +29,7 @@
@{run}/user/@{uid}/** rw, # pasta_open_ns(), main()
+ @{PROC}/[0-9]*/ns/ r, # pasta_netns_quit_init(),
@{PROC}/[0-9]*/ns/net r, # pasta_wait_for_ns(),
@{PROC}/[0-9]*/ns/user r, # conf_pasta_ns()
@@ -42,3 +43,5 @@
/{usr/,}bin/** Ux,
/usr/bin/pasta.avx2 ix, # arch_avx2_exec(), arch.c
+
+ ptrace r, # pasta_open_ns()
--
2.43.0
prev parent reply other threads:[~2024-04-03 19:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-03 19:04 [PATCH 0/3] Assorted AppArmor policy fixes for passt and pasta Stefano Brivio
2024-04-03 19:04 ` [PATCH 1/3] apparmor: Add mount rule with explicit, empty source in passt abstraction Stefano Brivio
2024-04-03 19:04 ` [PATCH 2/3] apparmor: Expand scope of @{run}/user access, allow writing PID files too Stefano Brivio
2024-04-03 19:04 ` Stefano Brivio [this message]
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=20240403190425.2848764-4-sbrivio@redhat.com \
--to=sbrivio@redhat.com \
--cc=danish.prakash@suse.com \
--cc=joerg@bec.de \
--cc=passt-dev@passt.top \
--cc=pholzing@redhat.com \
--cc=suse-beta@cboltz.de \
/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).