Re: [PATCH 2/2] debugfs: only allow root access to debugginginterfaces

From: Greg KH
Date: Fri Feb 25 2011 - 15:57:35 EST


On Fri, Feb 25, 2011 at 12:40:43PM -0800, Hugh Dickins wrote:
> On Fri, 25 Feb 2011, Greg KH wrote:
> > On Tue, Feb 22, 2011 at 11:29:15PM +0300, Dan Carpenter wrote:
> > > On Tue, Feb 22, 2011 at 11:33:14AM -0800, Greg KH wrote:
> > > > Again, let's fix the real problems here, world-writable debugfs files.
> > >
> > > We could just ban them?
> > >
> > > diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
> > > index e7a7a2f..03ae095 100644
> > > --- a/fs/debugfs/inode.c
> > > +++ b/fs/debugfs/inode.c
> > > @@ -223,6 +223,9 @@ struct dentry *debugfs_create_file(const char *name, mode_t mode,
> > >
> > > pr_debug("debugfs: creating file '%s'\n",name);
> > >
> > > + /* don't allow world writable files */
> > > + mode &= ~S_IWOTH;
> > > +
> > > error = simple_pin_fs(&debug_fs_type, &debugfs_mount,
> > > &debugfs_mount_count);
> > > if (error)
> > >
> >
> > I have no objection to this patch, care to resend it with a
> > signed-off-by: so that I can apply it?
>
> That's funny, I wrote something in debugfs a few months ago which was
> very deliberately rw--w--w-: a kind of circular trace buffer into which
> any userspace could easily echo its progress for debugging.
>
> Probably won't be upstreamed in that form, nor use debugfs if it is.
> But I mention it as an example of why any such limitation on debugfs
> seems inappropriate to me.

Ok, fair enough, then I'll not add this patch, as you just proved it is
a valuable thing to have world writable debugfs files.

thanks,

greg k-h
--
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/