RESOLVE_NO_XDEV support for emulated backend #8
Labels
ideas welcome
An open problem which doesn't have a clear resolution.
resolver/opath
Related to the userspace openat(2)-based resolver.
While adding
RESOLVE_NO_XDEV
support to theopenat2(2)
backend is incredibly trivial (add theRESOLVE_NO_XDEV
flag), for the emulated backend it appears to be an open problem to detect a mount-point crossing (if it might be a bind-mount). Here is a list of things which don't work:Parsing
/proc/self/mountinfo
is both racy and requires you to trust/proc
(which is not a given, sinceRESOLVE_NO_XDEV
will be used for/proc
hardening -- see /proc hardening #7). There is a poll backend which in principle might allow you to do a double-check that could be safe, but the dependency on/proc
makes this a no-go.Doing
umount(MNT_EXPIRE)
ormount(MS_MOVE)
to check if you get an-EINVAL
(meaning it's not a mount-point) would appear to be the most obvious solution, but it requires privileges (either the ability to do the mount outright or the ability to create a user namespace to then do the mount). This blocks us from working in environments such as the default seccomp profile of most container runtimes.Creating a temporary (and not-bound-to-the-filesystem)
procfs
using the new mount API would also work -- except it requires quite a few privileges (if there are over-mounts you'll get permission issues in user namespaces, and you need to be able to mount things in general) and it requires a new-enough kernel.Right now, I think there is no obvious way to do this on older kernels -- which means we will have to output some kind of warning if running on a kernel without
openat2(2)
support. We can at the very least ensure we're not following symlinks and we never jump to a nonprocfs
mount -- but these are completely bypass-able limitations.The text was updated successfully, but these errors were encountered: