Page MenuHomeFreeBSD

vfs: Disallow renameat() with FD_RESOLVE_BENEATH descriptors
Needs ReviewPublic

Authored by markj on Fri, May 22, 10:12 PM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

The FD_RESOLVE_BENEATH flag was intended to try to resolve bugzilla PR
262179 without entirely disallowing fd passing between jails. However,
one can use renameat() to bypass the restriction: upon receiving a
directory fd with FD_RESOLVE_BENEATH set, a jailed process can still
move its CWD or one of its ancestors to the directory, and just cd
out of its jail root.

So disallow renameat() when either the source or destination directory
fds has FD_RESOLVE_BENEATH set, like we do with fchdir() and fchroot()
to prevent similar escapes. I don't really see a better alternative
other than simply disallowing fd-sharing across a jail boundary.

Reported by: firk@cantconnect.ru

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 73359
Build 70242: arc lint + arc unit