Re: security: lockless stat() issues
From: Linus Torvalds
Date: Fri Oct 04 2013 - 16:49:19 EST
On Fri, Oct 4, 2013 at 1:15 PM, Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:
>
> Just a couple of days ago you'd been complaining about filesystems exposure
> to rcuwalk details and now you propose to increase the contact surface
> by one more method? OK...\
.. anything for a really critical path.
> For one thing, that will definitely require lazy freeing of struct
> super_block itself. At the very least, you want ->i_sb->s_dev, even
> on default pathway. Another thing is that API is wrong for that
> kind of stuff - we pass vfsmount/dentry pair and we end up looking
> at the inode guts. Fine, but in RCU case you must cope with the
> possibility of dentry->d_inode going NULL under you. Which isn't
> all that terrible, but we need to slap ACCESS_ONCE() into each method
> instance (all 34 of them). IOW, it's worse than just "oh, we need to
> add a flag"; we'll need to pass the sodding inode separately, with
> dire warnings not to use dentry->d_inode.
That would get ugly.
However, I don't think we actually really need to do that. We had a
similar situation with d_revalidate() passing inode pointers etc
totally unnecessarily. Yes, the filesystem needs to use ACCESS_ONCE()
and care about NULL, but it doesn't need anything more than that. And
we really do have that already.
And we already have dentry->d_sb - which is supposed to be valid.
Again, we already use it under RCU for d_revalidate() and for name
hashing. So the super-block had better already be ok with RCU.
Linus
--
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/