Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760961AbZANI7M (ORCPT ); Wed, 14 Jan 2009 03:59:12 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758171AbZANI6k (ORCPT ); Wed, 14 Jan 2009 03:58:40 -0500 Received: from www262.sakura.ne.jp ([202.181.97.72]:60289 "EHLO www262.sakura.ne.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756943AbZANI6i (ORCPT ); Wed, 14 Jan 2009 03:58:38 -0500 Message-Id: <200901140858.n0E8wE9v099032@www262.sakura.ne.jp> Subject: Re: [TOMOYO #14 (mmotm 2008-12-30-16-05) 03/10] Introduce d_realpath(). From: Tetsuo Handa To: jmorris@namei.org Cc: akpm@linux-foundation.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Date: Wed, 14 Jan 2009 17:58:14 +0900 References: <20090101050741.372438529@I-love.SAKURA.ne.jp> <20090101050940.282118078@I-love.SAKURA.ne.jp> In-Reply-To: Content-Type: text/plain; charset="ISO-2022-JP" X-Anti-Virus: K-Prox Anti-Virus Powered by Kaspersky, bases: 14012009 #1451940, status: clean Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1603 Lines: 48 James Morris wrote: > > (3) /proc/PID/ is represented as /proc/self/ if PID equals current->tgid. > > This needs an ack from Al and/or Christoph. > It is a sad thing that I cannot use /proc/self/ (which is the only part where a pathname based access control can prevent current process from accessing other process's information), but I purged d_realpath() for now. Next posting (#15) will embed AppArmor's d_namespace_path()-like function into TOMOYO's code. /* d_namespace_path() in OpenSUSE 11.1's 2.6.27.7-9.1 kernel. */ char *d_namespace_path(struct dentry *dentry, struct vfsmount *vfsmnt, char *buf, int buflen) { struct path root, tmp, ns_root = { }; struct path path = { .mnt = vfsmnt, .dentry = dentry }; char *res; read_lock(¤t->fs->lock); root = current->fs->root; path_get(¤t->fs->root); read_unlock(¤t->fs->lock); spin_lock(&vfsmount_lock); if (root.mnt && root.mnt->mnt_ns) ns_root.mnt = mntget(root.mnt->mnt_ns->root); if (ns_root.mnt) ns_root.dentry = dget(ns_root.mnt->mnt_root); spin_unlock(&vfsmount_lock); tmp = ns_root; res = __d_path(&path, &tmp, buf, buflen, D_PATH_FAIL_DELETED | D_PATH_DISCONNECT); path_put(&root); path_put(&ns_root); /* Prevent empty path for lazily unmounted filesystems. */ if (!IS_ERR(res) && *res == '\0') *--res = '.'; return res; } Thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/