Skip to content

Commit

Permalink
Add 'linux_mounts_enable' rc.conf(5) variable, to make it possible
Browse files Browse the repository at this point in the history
to disable mounting Linux-specific filesystems under /compat/linux
when 'linux_enable' is set to YES.

Reviewed by:	netchild, ian (earlier version)
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D22320
  • Loading branch information
trasz committed Nov 13, 2019
1 parent 4e0706c commit 5dece9b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 2 additions & 0 deletions libexec/rc/rc.conf
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,8 @@ firstboot_sentinel="/firstboot" # Scripts with "firstboot" keyword are run if
# the file can be deleted after the boot completes.
sysvipc_enable="NO" # Load System V IPC primitives at startup (or NO).
linux_enable="NO" # Linux binary compatibility loaded at startup (or NO).
linux_mounts_enable="YES" # If linux_enable is set to YES, mount Linux-specific
# filesystems at startup.
clear_tmp_enable="NO" # Clear /tmp at startup.
clear_tmp_X="YES" # Clear and recreate X11-related directories in /tmp
ldconfig_insecure="NO" # Set to YES to disable ldconfig security checks
Expand Down
14 changes: 8 additions & 6 deletions libexec/rc/rc.d/linux
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,14 @@ linux_start()
sysctl kern.elf32.fallback_brand=3 > /dev/null
fi

_emul_path="/compat/linux"
mount -o nocover -t linprocfs linprocfs "${_emul_path}/proc"
mount -o nocover -t linsysfs linsysfs "${_emul_path}/sys"
mount -o nocover -t devfs devfs "${_emul_path}/dev"
mount -o nocover -t fdescfs fdescfs "${_emul_path}/dev/fd"
mount -o nocover,mode=1777 -t tmpfs tmpfs "${_emul_path}/dev/shm"
if checkyesno linux_mounts_enable; then
_emul_path="/compat/linux"
mount -o nocover -t linprocfs linprocfs "${_emul_path}/proc"
mount -o nocover -t linsysfs linsysfs "${_emul_path}/sys"
mount -o nocover -t devfs devfs "${_emul_path}/dev"
mount -o nocover -t fdescfs fdescfs "${_emul_path}/dev/fd"
mount -o nocover,mode=1777 -t tmpfs tmpfs "${_emul_path}/dev/shm"
fi
}

load_rc_config $name
Expand Down

0 comments on commit 5dece9b

Please sign in to comment.