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

Proposed by Steve Langasek on 2013-10-25
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 2013-10-25 Approve on 2013-11-03
Adam Conrad (community) 2013-10-25 Approve on 2013-10-25
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.
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
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
1=== modified file 'ChangeLog'
2--- ChangeLog 2013-10-23 22:44:54 +0000
3+++ ChangeLog 2013-10-25 19:18:39 +0000
4@@ -1,3 +1,10 @@
5+2013-10-25 Steve Langasek <steve.langasek@ubuntu.com>
6+
7+ * init/main.c, init/system.c, init/system.h: allow mount options
8+ to be passed to system_mount(), and pass the right options when
9+ mounting /dev/pts to match the permissions set by either
10+ initramfs-tools or mountall. LP: #1244763.
11+
12 2013-10-23 Dmitrijs Ledkovs <xnox@ubuntu.com>
13
14 * extra/upstart-socket-bridge.c: use SOCKET_PATH in our event
15
16=== modified file 'init/main.c'
17--- init/main.c 2013-07-31 09:28:48 +0000
18+++ init/main.c 2013-10-25 19:18:39 +0000
19@@ -280,7 +280,8 @@
20 needs_devtmpfs = 1;
21
22 if (needs_devtmpfs) {
23- if (system_mount ("devtmpfs", "/dev", (MS_NOEXEC | MS_NOSUID)) < 0) {
24+ if (system_mount ("devtmpfs", "/dev",
25+ MS_NOEXEC | MS_NOSUID, NULL) < 0) {
26 NihError *err;
27
28 err = nih_error_get ();
29@@ -296,7 +297,8 @@
30 nih_error ("%s: %s", _("Cannot create directory"), "/dev/pts");
31 }
32
33- if (system_mount ("devpts", "/dev/pts", (MS_NOEXEC | MS_NOSUID)) < 0) {
34+ if (system_mount ("devpts", "/dev/pts", MS_NOEXEC | MS_NOSUID,
35+ "gid=5,mode=0620") < 0) {
36 NihError *err;
37
38 err = nih_error_get ();
39@@ -356,7 +358,8 @@
40 * ourselves. Also mount /dev/pts to allow CONSOLE_LOG
41 * to function if booted in an initramfs-less environment.
42 */
43- if (system_mount ("proc", "/proc", (MS_NODEV | MS_NOEXEC | MS_NOSUID)) < 0) {
44+ if (system_mount ("proc", "/proc",
45+ MS_NODEV | MS_NOEXEC | MS_NOSUID, NULL) < 0) {
46 NihError *err;
47
48 err = nih_error_get ();
49@@ -365,7 +368,8 @@
50 nih_free (err);
51 }
52
53- if (system_mount ("sysfs", "/sys", (MS_NODEV | MS_NOEXEC | MS_NOSUID)) < 0) {
54+ if (system_mount ("sysfs", "/sys",
55+ MS_NODEV | MS_NOEXEC | MS_NOSUID, NULL) < 0) {
56 NihError *err;
57
58 err = nih_error_get ();
59
60=== modified file 'init/system.c'
61--- init/system.c 2012-08-03 15:47:59 +0000
62+++ init/system.c 2013-10-25 19:18:39 +0000
63@@ -165,21 +165,20 @@
64 * system_mount:
65 * @type: filesystem type,
66 * @dir: mountpoint,
67- * @flags: mount flags.
68- *
69- * Mount the kernel filesystem @type at @dir with @flags, if not already mounted. This
70- * is used to ensure that the proc and sysfs filesystems are always
71- * available.
72- *
73- * Filesystems are always mounted with the MS_NODEV, MS_NOEXEC and MS_NOSUID
74- * mount options, which are sensible for /proc and /sys.
75+ * @flags: mount flags,
76+ * @options: mount options.
77+ *
78+ * Mount the kernel filesystem @type at @dir with @flags and mount options
79+ * @options, if not already mounted. This is used to ensure that the proc
80+ * and sysfs filesystems are always available.
81 *
82 * Returns: zero on success, negative value on raised error.
83 **/
84 int
85 system_mount (const char *type,
86 const char *dir,
87- unsigned long flags)
88+ unsigned long flags,
89+ const char *options)
90 {
91 nih_local char *parent = NULL;
92 char * ptr;
93@@ -208,7 +207,7 @@
94 return 0;
95
96 /* Mount the filesystem */
97- if (mount ("none", dir, type, flags, NULL) < 0)
98+ if (mount ("none", dir, type, flags, options) < 0)
99 nih_return_system_error (-1);
100
101 return 0;
102
103=== modified file 'init/system.h'
104--- init/system.h 2012-08-03 15:47:59 +0000
105+++ init/system.h 2013-10-25 19:18:39 +0000
106@@ -36,7 +36,7 @@
107 __attribute__ ((warn_unused_result));
108
109 int system_mount (const char *type, const char *dir,
110- unsigned long flags)
111+ unsigned long flags, const char *options)
112 __attribute__ ((warn_unused_result));
113
114 void system_mknod (const char *path, mode_t mode, dev_t dev);

Subscribers

People subscribed via source and target branches