Re: [PATCH RFC 0/1] mount: universally disallow mounting over symlinks

From: Ian Kent
Date: Mon Jan 13 2020 - 19:25:31 EST


On Mon, 2020-01-13 at 10:59 +0800, Ian Kent wrote:
>
> > 3) is _anything_ besides root directory ever created in direct
> > autofs
> > superblocks by anyone? If not, why does autofs_lookup() even
> > bother
> > to
> > do anything there? IOW, why not have it return ERR_PTR(-ENOENT)
> > immediately
> > for direct ones? Or am I missing something and it is, in fact,
> > possible
> > to have the daemon create something in those?
>
> Short answer is no, longer answer is directories "shouldn't" ever
> be created inside direct mount points.
>
> The thing is that the multi-mount map construct can be used with
> direct mounts too, but they must always have a real mount at the
> base because they are direct mounts. So processes should not be
> able to walk into them while they are being mounted (constructed).
>
> But I'm pretty sure it's rare (maybe not done at all) that this
> map construct is used with direct mounts.

This isn't right.

There's actually nothing stopping a user from using a direct map
entry that's a multi-mount without an actual mount at its root.
So there could be directories created under these, it's just not
usually done.

I'm pretty sure I don't check and disallow this.

Ian