| Summary: | ports-mgmt/pkg: startup scripts are run with an open directory file descriptor, causing chroot() to fail | ||
|---|---|---|---|
| Product: | Ports & Packages | Reporter: | Garrett Wollman <wollman> |
| Component: | Individual Port(s) | Assignee: | freebsd-pkg (Nobody) <pkg> |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | CC: | jaap |
| Priority: | --- | Keywords: | needs-qa |
| Version: | Latest | Flags: | jaap:
maintainer-feedback+
|
| Hardware: | amd64 | ||
| OS: | Any | ||
|
Description
Garrett Wollman
2016-10-11 19:06:03 UTC
It is odd that it complains about the chroot. Unbound should only do that when configured to do so. Nothing changed in the rc script with this upgrade so that is unlikely the cause. I have figured out the cause of the problem. unbound always attempts to chroot when starting, but normally succeeds. When starting inside the environment of a package upgrade, however, it is erroneously running with a file descriptor open on a directory. The check in `sys/kern/vfs_syscalls.c#chroot_refuse_vdir_fds` then refuses to allow the chroot to succeed, *if* either `kern.chroot_allow_open_directories` is set to 0, or it is set to 1 (which is the default) and is already running in a chroot (which includes jails). Conclusion: this is a bug in pkg; the startup scripts should not be run with any descriptors open other than the standard 0/1/2. This has been fixed in the github repository and will be in the next release which will happen before the Weekend (In reply to Garrett Wollman from comment #2) Thanks for figuring this out. |