Subject: bin/23677: init should use proper permissions when mouting /dev
To: None <gnats-bugs@gnats.netbsd.org>
From: Christian Biere <christianbiere@gmx.de>
List: netbsd-bugs
Date: 12/06/2003 19:03:59
>Number:         23677
>Category:       bin
>Synopsis:       init should use proper permissions when mouting /dev
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Dec 06 19:04:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Christian Biere
>Release:        NetBSD 1.6ZF
>Organization:
>Environment:
System: NetBSD cyclonus 1.6ZF NetBSD 1.6ZF (STARSCREAM) #0: Sun Nov 30 01:56:21 CET 2003 bin@cyclonus:/usr/build/obj/sys/arch/i386/compile/STARSCREAM i386
Architecture: i386
Machine: i386
>Description:
If /sbin/init mounts /dev as memory filesystem due to a missing /dev/console
the mount point /dev becomes world-writeable with the sticky-bit set (mode
07777 IIRC). IMO, init should use 0755 for /dev.

>How-To-Repeat:
rm /dev/console && reboot

>Fix:
Using -u and -g is probably unnecessary because init is running as root/wheel
anyway.

Index: init.c
===================================================================
RCS file: /cvsroot/src/sbin/init/init.c,v
retrieving revision 1.63
diff -u -r1.63 init.c
--- init.c	2003/10/03 13:31:32	1.63
+++ init.c	2003/12/06 18:54:02
@@ -1438,6 +1438,7 @@
 		asprintf(&fs_size, "%d", FSSIZE);
 		(void)execl(INIT_MOUNT_MFS, "mount_mfs",
 		    "-b", "4096", "-f", "512",
+		    "-u", "0", "-g", "0", "-p", "0755",
 		    "-s", fs_size, "-n", STR(NINODE),
 		    "swap", "/dev", NULL);
 		_exit(1);

>Release-Note:
>Audit-Trail:
>Unformatted: