mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: John Johansen <john.johansen@canonical.com>
To: linux-kernel@vger.kernel.org
Cc: linux-security-module@vger.kernel.org
Subject: [PATCH 1/7] AppArmor: Retrieve the dentry_path for error reporting when path lookup fails
Date: Mon, 27 Feb 2012 14:23:11 -0800	[thread overview]
Message-ID: <1330381397-5352-2-git-send-email-john.johansen@canonical.com> (raw)
In-Reply-To: <1330381397-5352-1-git-send-email-john.johansen@canonical.com>

When __d_path and d_absolute_path fail due to the name being outside of
the current namespace no name is reported.  Use dentry_path to provide
some hint as to which file was being accessed.

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Kees Cook <kees@ubuntu.com>
---
 security/apparmor/path.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/security/apparmor/path.c b/security/apparmor/path.c
index c31ce83..b3cf4cd 100644
--- a/security/apparmor/path.c
+++ b/security/apparmor/path.c
@@ -94,18 +94,21 @@ static int d_namespace_path(struct path *path, char *buf, int buflen,
 	} else
 		res = d_absolute_path(path, buf, buflen);
 
-	*name = res;
 	/* handle error conditions - and still allow a partial path to
 	 * be returned.
 	 */
 	if (IS_ERR(res)) {
-		error = PTR_ERR(res);
-		*name = buf;
-		goto out;
-	}
-	if (!our_mnt(path->mnt))
+		res = dentry_path_raw(path->dentry, buf, buflen);
+		if (IS_ERR(res)) {
+			error = PTR_ERR(res);
+			*name = buf;
+			goto out;
+		};
+	} else if (!our_mnt(path->mnt))
 		connected = 0;
 
+	*name = res;
+
 ok:
 	/* Handle two cases:
 	 * 1. A deleted dentry && profile is not allowing mediation of deleted
-- 
1.7.9


  reply	other threads:[~2012-02-27 22:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-27 22:23 [Patch 0/7] AppArmor: Add mediation of mount operations John Johansen
2012-02-27 22:23 ` John Johansen [this message]
2012-02-27 22:23 ` [PATCH 2/7] AppArmor: Minor cleanup of d_namespace_path to consolidate error handling John Johansen
2012-02-27 22:23 ` [PATCH 3/7] AppArmor: Update dfa matching routines John Johansen
2012-02-27 22:23 ` [PATCH 4/7] AppArmor: Move path failure information into aa_get_name and rename John Johansen
2012-02-27 22:23 ` [PATCH 5/7] AppArmor: Make chroot relative the default path lookup type John Johansen
2012-02-27 22:23 ` [PATCH 6/7] AppArmor: Add ability to load extended policy John Johansen
2012-02-27 22:23 ` [PATCH 7/7] AppArmor: Add the ability to mediate mount John Johansen
2012-02-28  2:29   ` Tetsuo Handa
2012-02-28  7:17     ` John Johansen

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=1330381397-5352-2-git-send-email-john.johansen@canonical.com \
    --to=john.johansen@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    /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®