[Merge] lp:~jamesodhunt/upstart/bug-980917 into lp:upstart
Steve Langasek
steve.langasek at canonical.com
Thu Aug 2 19:08:24 UTC 2012
Review: Needs Fixing
+ if (system_mount ("devtmpfs", "/dev", (MS_NOEXEC | MS_NOSUID)) < 0) {
+ NihError *err;
+
+ err = nih_error_get ();
+ nih_error ("%s: %s", _("Unable to mount /dev filesystem"),
+ err->message);
+ nih_free (err);
+ }
+
+ /* Required to exist before /dev/pts accessed */
+ if (mknod ("/dev/ptmx", makedev (5, 2), S_IFCHR) < 0 && errno != EEXIST)
+ nih_error ("Unable to create /dev/ptmx");
+
+ if (mkdir ("/dev/pts", 0755) < 0 && errno != EEXIST)
+ nih_error ("%s: %s", _("Cannot create directory"), "/dev/pts");
+
This all assumes that mounting devtmpfs on /dev is required, and that /dev isn't being provided some other way - such as by a static /dev on the root filesystem. A result of this is that when /dev is not currently a mount point *and is not configured to be*, this code will still mount devtmpfs, potentially clobbering the /dev that the admin has configured.
I think this entire section should be wrapped with a check for whether /dev/pts and /dev/ptmx already exist, and only mount /dev if we determine we need to write to the directory.
--
https://code.launchpad.net/~jamesodhunt/upstart/bug-980917/+merge/117863
Your team Upstart Reviewers is subscribed to branch lp:upstart.
More information about the upstart-devel
mailing list