Re: [patch 00/13] devtmpfs patches

From: Stephen Smalley
Date: Wed May 13 2009 - 10:43:58 EST


On Wed, 2009-05-13 at 16:20 +0200, Kay Sievers wrote:
> On Wed, May 13, 2009 at 15:34, Kay Sievers <kay.sievers@xxxxxxxx> wrote:
>
> >>> + kern_cred = prepare_kernel_cred(NULL);
> >>
> >> If you have no intention of altering the credentials you create, you might
> >> want to use &init_cred instead of kern_cred. That said, you might want to
> >> allocate it and let the security module alter it before you use it.
> >
> > Ah, didn't know that it was exported. It's the one in
> > include/linux/init_task.h, right? I'll give that a try.
>
> That seems to work fine here. Thanks a lot for the help.
>
> Maybe we could do the same credential swap in sysfs, and get rid of:
> /**
> * lookup_one_noperm - bad hack for sysfs
> * @name: pathname component to lookup
> * @base: base directory to lookup from
> *
> * This is a variant of lookup_one_len that doesn't perform any permission
> * checks. It's a horrible hack to work around the braindead sysfs
> * architecture and should not be used anywhere else.
> *
> * DON'T USE THIS FUNCTION EVER, thanks.
> */
>
> in fs/namei.c?
>
> Seems a bit odd to have a vfs function for a single filesystem, called
> from a single location, and annotated as "do not use". Christoph added
> the comment a while ago, so adding him to Cc:.

Yes, that makes sense to me as well - we didn't have the credentials
infrastructure in place at the time that lookup_one_noperm was
introduced, but switching the credentials around a normal lookup_one_len
call should work now.

--
Stephen Smalley
National Security Agency

--
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/