From mboxrd@z Thu Jan 1 00:00:00 1970 From: Al Viro Subject: Re: [git pull] apparmor fix for __d_path() misuse Date: Wed, 7 Dec 2011 01:44:58 +0000 Message-ID: <20111207014458.GT2203@ZenIV.linux.org.uk> References: <4EDE94DC.8010106@canonical.com> <20111206224100.GM2203@ZenIV.linux.org.uk> <4EDEA152.90804@canonical.com> <20111207001643.GN2203@ZenIV.linux.org.uk> <20111207003922.GO2203@ZenIV.linux.org.uk> <20111207011047.GQ2203@ZenIV.linux.org.uk> <20111207013720.GS2203@ZenIV.linux.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: John Johansen , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org To: Linus Torvalds Return-path: Content-Disposition: inline In-Reply-To: <20111207013720.GS2203@ZenIV.linux.org.uk> Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Wed, Dec 07, 2011 at 01:37:20AM +0000, Al Viro wrote: > + if (path->mnt->mnt_flags & MNT_INTERNAL) { > + /* it's not mounted anywhere */ > + res = dentry_path(path->dentry, buf, buflen); > + *name = res; > + if (IS_ERR(res)) { > + *name = buf; > + return PTR_ERR(res); > + } > + if (path->dentry->d_sb->s_magic == PROC_SUPER_MAGIC && > + strncmp(*name, "/sys/", 5) == 0) { > + /* TODO: convert over to using a per namespace > + * control instead of hard coded /proc > + */ > + return prepend(name, *name - buf, "/proc", 5); Incidentally, why only /proc/sys? For one thing, we won't be accessing anything else on internal vfsmount of proc, so strncmp() part looks wrong; for another, if some code starts doing that, why would acting as if it was on normally mounted /proc be the wrong thing? John?