lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20091119132833.30bc93a4@barsoom.rdu.redhat.com>
Date:	Thu, 19 Nov 2009 13:28:33 -0500
From:	Jeff Layton <jlayton@...hat.com>
To:	ebiederm@...ssion.com (Eric W. Biederman)
Cc:	linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
	pavel@....cz
Subject: Re: [PATCH] procfs: make /proc style symlinks behave like "normal"
 symlinks

On Thu, 19 Nov 2009 09:07:16 -0800
ebiederm@...ssion.com (Eric W. Biederman) wrote:

> 
> Nacked-by: "Eric W. Biederman" <ebiederm@...ssion.com>
> 
> This is broken.  If the referenced file is in a different mount namespace
> the path returned could point to a completely different path in your
> own mount namespace.  Even in your own mount namespace this makes the
> proc symlinks racy and not guaranteed to return the file of interest.
> 
> I don't see any hope of this approach ever working.
> 
> Eric
> 

Then is proc_pid_readlink broken in the same way?

> 
> Jeff Layton <jlayton@...hat.com> writes:
> 
> > -static int proc_pid_readlink(struct dentry * dentry, char __user * buffer, int buflen)
> > -{
> > -	int error = -EACCES;
> > -	struct inode *inode = dentry->d_inode;
> > +	struct page *page = NULL;
> >  	struct path path;
> > +	int error;
> >  
> >  	/* Are we allowed to snoop on the tasks file descriptors? */
> > -	if (!proc_fd_access_allowed(inode))
> > +	if (!proc_fd_access_allowed(inode)) {
> > +		pathname = ERR_PTR(-EACCES);
> >  		goto out;
> > +	}
> >  
> >  	error = PROC_I(inode)->op.proc_get_link(inode, &path);
> > -	if (error)
> > +	if (error) {
> > +		pathname = ERR_PTR(error);
> >  		goto out;
> > +	}
> > +
> > +	page = alloc_page(GFP_HIGHUSER);
> > +	if (!page) {
> > +		pathname = ERR_PTR(-ENOMEM);
> > +		goto out_path_put;
> > +	}
> > +
> > +	pathname = kmap(page);
> > +	pathname = d_path(&path, pathname, PAGE_SIZE);
> 
> This is just nonsense.
> 

How so? Care to elaborate?

> 
> > +	if (IS_ERR(pathname)) {
> > +		kunmap(page);
> > +		__free_page(page);
> > +		page = NULL;
> > +	}
> >  
> > -	error = do_proc_readlink(&path, buffer, buflen);
> > +out_path_put:
> >  	path_put(&path);
> >  out:
> > -	return error;
> > +	nd_set_link(nd, pathname);
> > +	return page;
> > +}


-- 
Jeff Layton <jlayton@...hat.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ