From: Adriano Cordova <adrianox@gmail.com>
To: John Johansen <john.johansen@canonical.com>,
Georgia Garcia <georgia.garcia@canonical.com>
Cc: apparmor@lists.ubuntu.com, linux-security-module@vger.kernel.org,
linux-kernel@vger.kernel.org, Paul Moore <paul@paul-moore.com>,
James Morris <jmorris@namei.org>,
"Serge E . Hallyn" <serge@hallyn.com>,
Adriano Cordova <adrianox@gmail.com>
Subject: [PATCH] apparmor: resolve pivotroot paths before the failure audit
Date: Mon, 28 Sep 2026 16:06:20 -0300 [thread overview]
Message-ID: <20260928190620.1154576-1-adrianox@gmail.com> (raw)
build_pivotroot() stores the new and old path names in the audit data
while it mediates a transition, but it returns early for unconfined
profiles and profiles that do not mediate mounts. Resolve the names in
the failure path in that case before the audit record is emitted.
Signed-off-by: Adriano Cordova <adrianox@gmail.com>
---
security/apparmor/mount.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/security/apparmor/mount.c b/security/apparmor/mount.c
index 4ed7b9136beb..cd869a07335b 100644
--- a/security/apparmor/mount.c
+++ b/security/apparmor/mount.c
@@ -698,9 +698,18 @@ int aa_pivotroot(const struct cred *subj_cred, struct aa_label *label,
return error;
fail:
- /* TODO: add back in auditing of new_name and old_name,
- * needs lifting of name lookup out of profile cb
- */
+ if (!ad.name) {
+ struct aa_profile *p = labels_profile(label);
+
+ aa_path_name(new_path, path_flags(p, new_path), new_buffer,
+ &ad.name, &ad.info, p->disconnected);
+ }
+ if (!ad.mnt.src_name) {
+ struct aa_profile *p = labels_profile(label);
+
+ aa_path_name(old_path, path_flags(p, old_path), old_buffer,
+ &ad.mnt.src_name, &ad.info, p->disconnected);
+ }
ad.mnt.trans = target->hname;
error = aa_audit_perm_error(label, AA_MAY_PIVOTROOT, error, &ad,
audit_cb);
--
2.51.0
reply other threads:[~2026-09-28 19:06 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=20260928190620.1154576-1-adrianox@gmail.com \
--to=adrianox@gmail.com \
--cc=apparmor@lists.ubuntu.com \
--cc=georgia.garcia@canonical.com \
--cc=jmorris@namei.org \
--cc=john.johansen@canonical.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=paul@paul-moore.com \
--cc=serge@hallyn.com \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®