RFC (fwd) Re: 5.3 tmpfs mount permissions

Giorgos Keramidas keramida at ceid.upatras.gr
Mon Nov 8 06:37:54 PST 2004


On 2004-11-08 14:44, Mike Makonnen <mtm at identd.net> wrote:
> I haven't tested it, but I don't see anything obviously wrong with it.
>
> Cheers.

How about this one?  There are no tricky parts in mount_md() anymore and the
tmpfs_flags variable is passed to mdmfs.  I just rebooted with it, with
tmpfs=30m and tmpfs=YES in my rc.conf and all seemed to work fine.

I've kept the tmpsize and varsize options too.  I know they can be replaced by
a properly tweaked tmpmfs_flags, but this isn't really necessary.

%%%
Index: etc/rc.subr
===================================================================
RCS file: /home/ncvs/src/etc/rc.subr,v
retrieving revision 1.31
diff -u -u -r1.31 rc.subr
--- etc/rc.subr	30 Jul 2004 17:19:35 -0000	1.31
+++ etc/rc.subr	8 Nov 2004 13:55:04 -0000
@@ -1289,12 +1289,12 @@
 # as close as possible between 5-current and 4-stable.
 #   $1 = size
 #   $2 = mount point
-#   $3 = (optional) bytes-per-inode
+#   $3 = (optional) extra mdmfs flags
 mount_md() {
 	if [ -n "$3" ]; then
-		bpi="-i $3"
+		flags="$3"
 	fi
-	/sbin/mdmfs $bpi -s $1 -M md $2
+	/sbin/mdmfs $flags -s $1 -M md $2
 }
 
 fi
Index: etc/defaults/rc.conf
===================================================================
RCS file: /home/ncvs/src/etc/defaults/rc.conf,v
retrieving revision 1.226
diff -u -u -r1.226 rc.conf
--- etc/defaults/rc.conf	20 Oct 2004 16:58:27 -0000	1.226
+++ etc/defaults/rc.conf	8 Nov 2004 13:58:23 -0000
@@ -40,8 +40,10 @@
 removable_interfaces=""	# Removable network interfaces for /etc/pccard_ether.
 tmpmfs="AUTO"		# Set to YES to always create an mfs /tmp, NO to never
 tmpsize="20m"		# Size of mfs /tmp if created
+tmpmfs_flags="-S -o noexec,nosuid,nodev" # Extra mdmfs options for the mfs /tmp
 varmfs="AUTO"		# Set to YES to always create an mfs /var, NO to never
 varsize="32m"		# Size of mfs /var if created
+varmfs_flags="-S"	# Extra mount options for the mfs /var
 populate_var="AUTO"	# Set to YES to always (re)populate /var, NO to never
 local_startup="/usr/local/etc/rc.d /usr/X11R6/etc/rc.d" # startup script dirs.
 script_name_sep=" "	# Change if your startup scripts' names contain spaces
Index: etc/rc.d/tmp
===================================================================
RCS file: /home/ncvs/src/etc/rc.d/tmp,v
retrieving revision 1.34
diff -u -u -r1.34 tmp
--- etc/rc.d/tmp	7 Oct 2004 13:55:26 -0000	1.34
+++ etc/rc.d/tmp	8 Nov 2004 14:27:55 -0000
@@ -42,7 +42,7 @@
 #
 case "${tmpmfs}" in
 [Yy][Ee][Ss])
-	mount_md ${tmpsize} /tmp
+	mount_md ${tmpsize} /tmp "${tmpmfs_flags}"
 	chmod 01777 /tmp
 	;;
 [Nn][Oo])
@@ -56,7 +56,7 @@
 			echo "dropping into shell, ^D to continue anyway."
 			/bin/sh
 		else
-			mount_md ${tmpsize} /tmp
+			mount_md ${tmpsize} /tmp "${tmpmfs_flags}"
 			chmod 01777 /tmp
 		fi
 	fi
Index: etc/rc.d/var
===================================================================
RCS file: /home/ncvs/src/etc/rc.d/var,v
retrieving revision 1.34
diff -u -u -r1.34 var
--- etc/rc.d/var	7 Oct 2004 13:55:26 -0000	1.34
+++ etc/rc.d/var	8 Nov 2004 14:28:19 -0000
@@ -61,7 +61,7 @@
 #
 case "${varmfs}" in
 [Yy][Ee][Ss])
-	mount_md ${varsize} /var
+	mount_md ${varsize} /var "${varmfs_flags}"
 	;;
 [Nn][Oo])
 	;;
@@ -69,7 +69,7 @@
 	if (/bin/mkdir -p /var/.diskless 2> /dev/null); then
 		rmdir /var/.diskless
 	else
-		mount_md ${varsize} /var
+		mount_md ${varsize} /var "${varmfs_flags}"
 	fi
 esac
 
Index: share/man/man5/rc.conf.5
===================================================================
RCS file: /home/ncvs/src/share/man/man5/rc.conf.5,v
retrieving revision 1.232
diff -u -u -r1.232 rc.conf.5
--- share/man/man5/rc.conf.5	23 Oct 2004 18:35:35 -0000	1.232
+++ share/man/man5/rc.conf.5	8 Nov 2004 14:04:58 -0000
@@ -240,6 +240,22 @@
 Controls the size of a created
 .Pa /tmp
 memory file system.
+.It Va tmpmfs_flags
+Extra options passed to the
+.Xr mdmfs 8
+utility when the memory file system for
+.Pa /tmp
+is created.
+The default is
+.Dq Li -S -o noexec,nosuid,nodev ,
+which inhibits the use of softupdates on
+.Pa /tmp
+to waste as little space as possible and mounts the memory file system
+.Dq Li noexec,nosuid,nodev .
+See
+.Xr mdmfs 8
+for other options you can use in
+.Li tmpmfs_flags .
 .It Va varmfs
 Controls the creation of a
 .Pa /var
@@ -255,6 +271,21 @@
 Controls the size of a created
 .Pa /var
 memory file system.
+.It Va varmfs_flags
+Extra options passed to the
+.Xr mdmfs 8
+utility when the memory file system for
+.Pa /var
+is created.
+The default is
+.Dq Li -S ,
+which inhibits the use of softupdates on
+.Pa /var
+to waste as little space as possible.
+See
+.Xr mdmfs 8
+for other options you can use in
+.Li varmfs_flags .
 .It Va populate_var
 Controls the automatic population of the
 .Pa /var
@@ -3095,6 +3126,7 @@
 .Xr kldxref 8 ,
 .Xr lpd 8 ,
 .Xr mdconfig 8 ,
+.Xr mdmfs 8 ,
 .Xr mountd 8 ,
 .Xr moused 8 ,
 .Xr mrouted 8 ,
%%%


More information about the freebsd-rc mailing list