Re: new ...at() flag: AT_NO_JUMPS
From: Linus Torvalds
Date: Thu May 04 2017 - 21:27:16 EST
On Thu, May 4, 2017 at 5:30 PM, Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:
>
> As for mountpoint crossing... it might make sense to split those.
> O_BENEATH allowed it, and if we want AT_BENEATH to match that - let's
> do it. Then this one would become AT_BENEATH | AT_XDEV (the latter named
> after find(1) option, obviously).
So I would still like to split that NO_JUMP flag even more.
I like the AT_BENEATH | AT_XDEV split, but I think XDEV should be
split further, and I think the symlink avoidance should be split more
too.
As mentioned last time, at least for the git usage, even relative
symlinks are a no-no - not because they'd escape, but simply because
git wants to see the *unique* name, and resolve relative symlinks to
either the symlink, or to the actual file it points to.
So I think that we'd want an additional flag that says "no symlinks at all".
And I think the "no mountpoint" traversal might be splittable too.
Yes, sometimes you'd probably want to say "stay exactly inside this
filesystem" (like find -xdev). So no arguments against AT_XDEV that
refuses any mount traversal (kind of like my "no symlink traversal"
thing).
But at other points you might want to just guarantee that the walk
stays below a certain starting point and doesn't escape.
That could still allow crossing mount-points, but only if they are
non-bind mounts and cannot let us escape.
I'm not sure if that's testable, though.
Linus