Re: [PATCH] Missing BKL in sys_chroot() for 2.6

From: viro
Date: Mon Jun 07 2004 - 17:56:58 EST


On Mon, Jun 07, 2004 at 11:56:37AM -0700, Linus Torvalds wrote:
>
>
> On Sun, 6 Jun 2004, BlaisorBlade wrote:
> >
> > (PLEASE cc me on replies as I'm not subscribed).
> >
> > Set_fs_root *claims* it wants the BKL held:
>
> I think the set_fs_root() comment is just wrong.
>
> We properly lock the accesses to root/rootmnt with "fs->lock", and in fact
> no other users will have the BKL when accessing them anyway, so I don't
> see what the BKL would help in this case.
>
> However, from a quick grep of users, it does look like some other users
> aren't real careful with "fs->lock" (ie chroot_fs_refs() looks like it
> could have problems - probably purely theoretical).
>
> Al, do your eagle-eyes see something I missed?

chroot_fs_refs() is OK - it's a part of pivot_root(2) and it's just as
"if process looks like the have root and/or cwd in old root, we assume
they want to have those flipped to new one; if they are not, assume
that they know what they are doing and wouldn't like us to pull anything
on them". IOW, here we don't really care.

selinux open_devnull(), OTOH, is bogus - they already have an fs of their
own that is not going away; so why not put the damn device node on it and
be done with that?

In any case, BKL is irrelevant - that comment should've been dropped a long
time ago.
-
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/