Re: [git pull] apparmor fix for __d_path() misuse

From: Tetsuo Handa
Date: Tue Dec 06 2011 - 22:26:34 EST


Al Viro wrote:
> diff --git a/security/tomoyo/realpath.c b/security/tomoyo/realpath.c
> index 738bbdf..36fa7c9 100644
> --- a/security/tomoyo/realpath.c
> +++ b/security/tomoyo/realpath.c
> @@ -101,9 +101,8 @@ static char *tomoyo_get_absolute_path(struct path *path, char * const buffer,
> {
> char *pos = ERR_PTR(-ENOMEM);
> if (buflen >= 256) {
> - struct path ns_root = { };
> /* go to whatever namespace root we are under */
> - pos = __d_path(path, &ns_root, buffer, buflen - 1);
> + pos = d_absolute_path(path, buffer, buflen - 1);
> if (!IS_ERR(pos) && *pos == '/' && pos[1]) {
> struct inode *inode = path->dentry->d_inode;
> if (inode && S_ISDIR(inode->i_mode)) {

Currently, TOMOYO assumes that -ENAMETOOLONG is the only error which __d_path()
might return (and retries with larger buffer size unless kmalloc() fails).
If d_absolute_path() starts returning -EINVAL, TOMOYO will deny requests even
if "partial (I mean the result would have been different if reachable)"
pathname is granted by the policy.

How commonly can conditions that make d_absolute_path() return -EINVAL happen?



Linus Torvalds wrote:
> I don't know of any big distro that uses Tomoyo, so...
Ubuntu, Debian, OpenSUSE, ArchLinux, Mandriva...
Hope you know one of these distro. ;-)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/