On Sun, Mar 19, 2017 at 06:46:01PM -0700, Linus Torvalds wrote: > On Sun, Mar 19, 2017 at 10:24 AM, Al Viro <v...@zeniv.linux.org.uk> wrote: > > Bringing back an old conversation - what do you think about the > > potential usefulness of the following ...at() option: > > * no mountpoint crossings allowed (mount --bind included) > > * only relative symlinks traversals are allowed > > * starting point acts as a chroot boundary (IOW, .. does not lead > > out of it) > > Hmm. The original use of this was iirc apache (or maybe samba), that > simply wanted to be sure that when you did a pathname lookup, it > didn't escape out of the subtree that the lookup was done from (eg > some public_html directory or whatever). > > But I had that discussions *long* ago, and I don't even remember who > it might have been with. My reaction at the time was simply that it > would have been easy for us to have a "no symlink traversal at all" > mode, because their solution was to just walk each path component > carefully by hand. > > Maybe somebody who knows apache (or samba) can pipe up and say "yeah, > we still do that", or "we solved it with our own filename cache, so we > don't care".
The last posting of the O_BENEATH flag with very similar semantics indicated that there were sandboxing usecases that still want this . I think it's a good idea; the kernel is in the best place to do this correctly instead of having a bunch of half-baked implementations in userspace everywhere. 1: http://marc.info/?l=linux-fsdevel&m=143945842819081&w=2