Merge lp:~vorlon/upstart/lp.1244763 into lp:upstart

Proposed by Steve Langasek
Status: Merged
Merged at revision: 1553
Proposed branch: lp:~vorlon/upstart/lp.1244763
Merge into: lp:upstart
Diff against target: 114 lines (+25/-15)
4 files modified
ChangeLog (+7/-0)
init/main.c (+8/-4)
init/system.c (+9/-10)
init/system.h (+1/-1)
To merge this branch: bzr merge lp:~vorlon/upstart/lp.1244763
Reviewer Review Type Date Requested Status
Dimitri John Ledkov Approve
Adam Conrad (community) Approve
Review via email: mp+192739@code.launchpad.net

Description of the change

Straightforward change to fix bug #1244763. Adam will test this on an
initramfsless system to confirm it DTRT.

To post a comment you must log in.
Revision history for this message
Adam Conrad (adconrad) wrote :

Tested on a machine that exhibits the issue, results pre and post-patching:

============ unpatched output ==============
beebe:~$ cat /proc/mounts
rootfs / rootfs rw 0 0
/dev/root / ext4 rw,relatime,data=ordered 0 0
devtmpfs /dev devtmpfs rw,relatime,size=8223712k,nr_inodes=2055928,mode=755 0 0
none /dev/pts devpts rw,nosuid,noexec,relatime,mode=600 0 0
none /proc proc rw,nosuid,nodev,noexec,relatime 0 0
none /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
none /sys/fs/cgroup tmpfs rw,relatime,size=4k,mode=755 0 0
none /sys/fs/fuse/connections fusectl rw,relatime 0 0
none /sys/kernel/debug debugfs rw,relatime 0 0
none /run tmpfs rw,nosuid,noexec,relatime,size=1644764k,mode=755 0 0
none /run/lock tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k 0 0
none /run/shm tmpfs rw,nosuid,nodev,relatime 0 0
none /run/user tmpfs rw,nosuid,nodev,noexec,relatime,size=102400k,mode=755 0 0
systemd /sys/fs/cgroup/systemd cgroup rw,nosuid,nodev,noexec,relatime,name=systemd 0 0

============= patched output ===============
beebe:~$ cat /proc/mounts
rootfs / rootfs rw 0 0
/dev/root / ext4 rw,relatime,data=ordered 0 0
devtmpfs /dev devtmpfs rw,relatime,size=8223712k,nr_inodes=2055928,mode=755 0 0
none /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620 0 0
none /proc proc rw,nosuid,nodev,noexec,relatime 0 0
none /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
none /sys/fs/cgroup tmpfs rw,relatime,size=4k,mode=755 0 0
none /sys/fs/fuse/connections fusectl rw,relatime 0 0
none /sys/kernel/debug debugfs rw,relatime 0 0
none /run tmpfs rw,nosuid,noexec,relatime,size=1644764k,mode=755 0 0
none /run/lock tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k 0 0
none /run/shm tmpfs rw,nosuid,nodev,relatime 0 0
none /run/user tmpfs rw,nosuid,nodev,noexec,relatime,size=102400k,mode=755 0 0
systemd /sys/fs/cgroup/systemd cgroup rw,nosuid,nodev,noexec,relatime,name=systemd 0 0

System seems otherwise fine, no new hiccups in booting, and the only mount that appears different is devpts, for the better.

review: Approve
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

lgtm.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ChangeLog'
--- ChangeLog 2013-10-23 22:44:54 +0000
+++ ChangeLog 2013-10-25 19:18:39 +0000
@@ -1,3 +1,10 @@
12013-10-25 Steve Langasek <steve.langasek@ubuntu.com>
2
3 * init/main.c, init/system.c, init/system.h: allow mount options
4 to be passed to system_mount(), and pass the right options when
5 mounting /dev/pts to match the permissions set by either
6 initramfs-tools or mountall. LP: #1244763.
7
12013-10-23 Dmitrijs Ledkovs <xnox@ubuntu.com>82013-10-23 Dmitrijs Ledkovs <xnox@ubuntu.com>
29
3 * extra/upstart-socket-bridge.c: use SOCKET_PATH in our event10 * extra/upstart-socket-bridge.c: use SOCKET_PATH in our event
411
=== modified file 'init/main.c'
--- init/main.c 2013-07-31 09:28:48 +0000
+++ init/main.c 2013-10-25 19:18:39 +0000
@@ -280,7 +280,8 @@
280 needs_devtmpfs = 1;280 needs_devtmpfs = 1;
281281
282 if (needs_devtmpfs) {282 if (needs_devtmpfs) {
283 if (system_mount ("devtmpfs", "/dev", (MS_NOEXEC | MS_NOSUID)) < 0) {283 if (system_mount ("devtmpfs", "/dev",
284 MS_NOEXEC | MS_NOSUID, NULL) < 0) {
284 NihError *err;285 NihError *err;
285286
286 err = nih_error_get ();287 err = nih_error_get ();
@@ -296,7 +297,8 @@
296 nih_error ("%s: %s", _("Cannot create directory"), "/dev/pts");297 nih_error ("%s: %s", _("Cannot create directory"), "/dev/pts");
297 }298 }
298299
299 if (system_mount ("devpts", "/dev/pts", (MS_NOEXEC | MS_NOSUID)) < 0) {300 if (system_mount ("devpts", "/dev/pts", MS_NOEXEC | MS_NOSUID,
301 "gid=5,mode=0620") < 0) {
300 NihError *err;302 NihError *err;
301303
302 err = nih_error_get ();304 err = nih_error_get ();
@@ -356,7 +358,8 @@
356 * ourselves. Also mount /dev/pts to allow CONSOLE_LOG358 * ourselves. Also mount /dev/pts to allow CONSOLE_LOG
357 * to function if booted in an initramfs-less environment.359 * to function if booted in an initramfs-less environment.
358 */360 */
359 if (system_mount ("proc", "/proc", (MS_NODEV | MS_NOEXEC | MS_NOSUID)) < 0) {361 if (system_mount ("proc", "/proc",
362 MS_NODEV | MS_NOEXEC | MS_NOSUID, NULL) < 0) {
360 NihError *err;363 NihError *err;
361364
362 err = nih_error_get ();365 err = nih_error_get ();
@@ -365,7 +368,8 @@
365 nih_free (err);368 nih_free (err);
366 }369 }
367370
368 if (system_mount ("sysfs", "/sys", (MS_NODEV | MS_NOEXEC | MS_NOSUID)) < 0) {371 if (system_mount ("sysfs", "/sys",
372 MS_NODEV | MS_NOEXEC | MS_NOSUID, NULL) < 0) {
369 NihError *err;373 NihError *err;
370374
371 err = nih_error_get ();375 err = nih_error_get ();
372376
=== modified file 'init/system.c'
--- init/system.c 2012-08-03 15:47:59 +0000
+++ init/system.c 2013-10-25 19:18:39 +0000
@@ -165,21 +165,20 @@
165 * system_mount:165 * system_mount:
166 * @type: filesystem type,166 * @type: filesystem type,
167 * @dir: mountpoint,167 * @dir: mountpoint,
168 * @flags: mount flags.168 * @flags: mount flags,
169 *169 * @options: mount options.
170 * Mount the kernel filesystem @type at @dir with @flags, if not already mounted. This170 *
171 * is used to ensure that the proc and sysfs filesystems are always171 * Mount the kernel filesystem @type at @dir with @flags and mount options
172 * available.172 * @options, if not already mounted. This is used to ensure that the proc
173 *173 * and sysfs filesystems are always available.
174 * Filesystems are always mounted with the MS_NODEV, MS_NOEXEC and MS_NOSUID
175 * mount options, which are sensible for /proc and /sys.
176 *174 *
177 * Returns: zero on success, negative value on raised error.175 * Returns: zero on success, negative value on raised error.
178 **/176 **/
179int177int
180system_mount (const char *type,178system_mount (const char *type,
181 const char *dir,179 const char *dir,
182 unsigned long flags)180 unsigned long flags,
181 const char *options)
183{182{
184 nih_local char *parent = NULL;183 nih_local char *parent = NULL;
185 char * ptr;184 char * ptr;
@@ -208,7 +207,7 @@
208 return 0;207 return 0;
209208
210 /* Mount the filesystem */209 /* Mount the filesystem */
211 if (mount ("none", dir, type, flags, NULL) < 0)210 if (mount ("none", dir, type, flags, options) < 0)
212 nih_return_system_error (-1);211 nih_return_system_error (-1);
213212
214 return 0;213 return 0;
215214
=== modified file 'init/system.h'
--- init/system.h 2012-08-03 15:47:59 +0000
+++ init/system.h 2013-10-25 19:18:39 +0000
@@ -36,7 +36,7 @@
36 __attribute__ ((warn_unused_result));36 __attribute__ ((warn_unused_result));
3737
38int system_mount (const char *type, const char *dir,38int system_mount (const char *type, const char *dir,
39 unsigned long flags)39 unsigned long flags, const char *options)
40 __attribute__ ((warn_unused_result));40 __attribute__ ((warn_unused_result));
4141
42void system_mknod (const char *path, mode_t mode, dev_t dev);42void system_mknod (const char *path, mode_t mode, dev_t dev);

Subscribers

People subscribed via source and target branches