rc: Bail if /dev/null is not a device

On startup, check that /dev/null exists and is a character device.
Otherwise, one of two things will happen: either /dev is a writable
directory and we will immediately create /dev/null as a regular file
and dump garbage into it, or it does not and we will spit out a stream
of error messages about failing to create /dev/null.

PR:		295782
MFC after:	1 week
Reviewed by:	jhb, emaste
Differential Revision:	https://reviews.freebsd.org/D57447
This commit is contained in:
Dag-Erling Smørgrav
2026-06-05 17:53:29 +02:00
parent ddf6fad029
commit b5a96894f6
2 changed files with 16 additions and 1 deletions
+11 -1
View File
@@ -28,7 +28,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd September 20, 2024
.Dd June 4, 2026
.Dt RC 8
.Os
.Sh NAME
@@ -97,6 +97,16 @@ command provides a scripting interface to modify system config files.
.Ss Operation of Nm
.Bl -enum
.It
Verify that
.Pa /dev/null
exists and is a character device.
If that is not the case,
.Nm
prints an error message and terminates.
This is normally caused by forgetting to enable
.Xr devfs 5
in a jail's configuration.
.It
If autobooting, set
.Va autoboot Ns = Ns Li yes
and enable a flag