Several HardenedBSD users have reported[1] bsdinstall stalling after DHCP grabbing an IP for IPv4 (usr.sbin/bsdinstall/scripts/netconfig_ipv4). I've reproduced this behavior on VirtualBox 6.0 on OSX with FreeBSD 13-CURRENT/amd64 as the guest OS. I tried setting the virtual NIC to the emulated Intel driver (em) and also virtio-net. Both virtual NIC types cause bsdinstall to stall. [1] https://groups.google.com/a/hardenedbsd.org/d/msg/users/PmTXcc7hp-0/SHMFHJKwCQAJ
It looks like this was caused by r325740 in dhclient. netconfig_ipv4 captures dhclient's stdout using command substitution for possible logging in case dhclient throws an error. The expectation is that this will terminate as soon as dhclient either fails to get a lease and terminates, or succeeds in getting a lease and daemonizes (which closes stdin/stdout/stderr). The switch to cap_syslog broke this behavior, because cap_syslog specifies CASPER_SERVICE_STDIO in its service declaration, so the spawned casper service holds dhclient's stdio descriptors opens.
A commit references this bug: Author: jah Date: Wed Feb 6 04:36:29 UTC 2019 New revision: 343827 URL: https://svnweb.freebsd.org/changeset/base/343827 Log: r341692 changed cap_syslog(3) to preserve the stdio descriptors inherited from its parent so that LOG_PERROR would work. However, this caused dhclient(8)'s stdio streams to remain open across daemonization, breaking the ability to capture its foreground output as done in netconfig_ipv4. Fix this by reverting r341692 and instead passing the parent's stderr descriptor as an argument to cap_openlog() only when LOG_PERROR is specified in logopt. PR: 234514 Suggested by: markj Reported by: Shawn Webb Reviewed by: markj, oshogbo MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D18989 Changes: head/lib/libcasper/services/cap_syslog/cap_syslog.c
A commit references this bug: Author: jah Date: Thu Feb 21 06:40:15 UTC 2019 New revision: 344422 URL: https://svnweb.freebsd.org/changeset/base/344422 Log: MFC r343827: r342089 changed cap_syslog(3) to preserve the stdio descriptors inherited from its parent so that LOG_PERROR would work. However, this caused dhclient(8)'s stdio streams to remain open across daemonization, breaking the ability to capture its foreground output as done in netconfig_ipv4. Fix this by reverting r341692 and instead passing the parent's stderr descriptor as an argument to cap_openlog() only when LOG_PERROR is specified in logopt. PR: 234514 Changes: _U stable/12/ stable/12/lib/libcasper/services/cap_syslog/cap_syslog.c