Page MenuHomeFreeBSD

chroot.2: Update errors and unprivileged use
ClosedPublic

Authored by emaste on Sat, Aug 2, 5:19 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Aug 8, 7:18 AM
Unknown Object (File)
Tue, Aug 5, 1:12 PM
Unknown Object (File)
Tue, Aug 5, 11:54 AM
Unknown Object (File)
Tue, Aug 5, 8:07 AM
Unknown Object (File)
Tue, Aug 5, 6:44 AM
Unknown Object (File)
Tue, Aug 5, 4:08 AM
Unknown Object (File)
Tue, Aug 5, 2:32 AM
Unknown Object (File)
Tue, Aug 5, 2:28 AM

Details

Summary
Include errors common to chroot and fchroot in a single list, followed
by errors unique to each.

Unprivileged chroot is permitted if the security.bsd.unprivileged_chroot
sysctl is set to 1.  Make note of this and update the EPERM description.

Reported by:    kevans

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

lib/libsys/chroot.2
66

I'd recommend noting the procctl(2) requirement as well- maybe this?

allanjude added inline comments.
lib/libsys/chroot.2
66

Is it meant to say you can't chroot if the process has enabled NO_NEW_PRIVS? or something else?

emaste retitled this revision from chroot.2: Note that unprivileged use is possible to chroot.2: Update errors and unprivileged use.
emaste edited the summary of this revision. (Show Details)
lib/libsys/chroot.2
66

NO_NEW_PRIVS is the mechanism that blocks suid/sgid, so it must be toggled on before you can chroot(2) as non-root

emaste added a reviewer: kib.

update with @kevans feedback

This revision is now accepted and ready to land.Sat, Aug 2, 5:57 PM
lib/libsys/chroot.2
117–118

Which component?

lib/libsys/chroot.2
117–118

This is pretty standard wording for ENOTDIR among other system calls, any component of the path name for chroot(2).

Did combining them into one list make it confusing? I can use ENOTDIR A component of the path name is not a directory. for chroot and ENOTDIR The file descriptor does not reference a directory. for fchroot.

lib/libsys/chroot.2
117–118

But there is no 'component of path' for fchdir, because there is no path.
The proposed reformulation is correct.

lib/libsys/chroot.2
117–118

The same argument applies to EACCESS then, will undo combining that as well.

Unjoin EACCESS and ENOTDIR per @kib

This revision now requires review to proceed.Sat, Aug 2, 6:18 PM

Avoid shuffling existing errnos

This revision is now accepted and ready to land.Sat, Aug 2, 6:35 PM
This revision was automatically updated to reflect the committed changes.

style.mdoc(5) asks sysctls are Va so you can apropos them. I wonder if we can combine Ql and Va.