Date: Sun, 23 Jan 2011 18:29:21 GMT From: David Wimsey <david@wimsey.us> To: freebsd-gnats-submit@FreeBSD.org Subject: conf/154246: Bad symlink created if devfs mount point does not exist on jail startup Message-ID: <201101231829.p0NITLcM074987@red.freebsd.org> Resent-Message-ID: <201101231830.p0NIU92E072365@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 154246 >Category: conf >Synopsis: Bad symlink created if devfs mount point does not exist on jail startup >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Jan 23 18:30:09 UTC 2011 >Closed-Date: >Last-Modified: >Originator: David Wimsey >Release: 8.2-RC >Organization: >Environment: FreeBSD vault-01.internal.rtsz.com 8.2-RC2 FreeBSD 8.2-RC2 #0: Wed Jan 12 17:02:35 UTC 2011 root@mason.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64 >Description: /etc/rc.d/jail does not currently test for the existance of the mountpoint for the devfs mount phase of jail startup. If the jail root is read only, the mount will fail, but the symlink is created anyway. >How-To-Repeat: Create a new jail in /jail/testjail rm /jail/testjail/dev /etc/rc.d/jail start /jail will contain a symlink named 'log' pointing to '../var/run/log' >Fix: Attached file aborts jail startup and uses warn to alert the user if the mount point directory doesn't exist Patch attached with submission follows: --- jail.orig 2011-01-23 13:09:29.000000000 -0500 +++ jail 2011-01-23 13:24:55.000000000 -0500 @@ -588,14 +588,21 @@ warn "${_devdir} has symlink as parent - not starting jail ${_jail}" continue fi - info "Mounting devfs on ${_devdir}" - devfs_mount_jail "${_devdir}" ${_ruleset} - # Transitional symlink for old binaries - if [ ! -L "${_devdir}/log" ]; then - __pwd="`pwd`" - cd "${_devdir}" - ln -sf ../var/run/log log - cd "$__pwd" + # Can't mount devfs if the mount point + # doesn't exist directory doesn't exist + if [ -d "${_devdir}" ]; then + info "Mounting devfs on ${_devdir}" + devfs_mount_jail "${_devdir}" ${_ruleset} + # Transitional symlink for old binaries + if [ ! -L "${_devdir}/log" ]; then + __pwd="`pwd`" + cd "${_devdir}" + ln -sf ../var/run/log log + cd "$__pwd" + fi + else + warn "${_devdir} does not exist - not starting jail ${_jail}" + continue fi fi >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201101231829.p0NITLcM074987>