[util-linux/f16] 2.20.1-2.2: #747250, #769636, #771607, #747038

mluscon mluscon at fedoraproject.org
Fri Jan 20 10:42:27 UTC 2012


commit 85a6551255c456e462d16bb7cf352aeeaffc6cb0
Author: Michal Luscon <mluscon at redhat.com>
Date:   Fri Jan 20 11:39:36 2012 +0100

    2.20.1-2.2: #747250, #769636, #771607, #747038

 util-linux-2.20-logger.patch      |   46 ++++++++++++
 util-linux-2.20-mount-hint.patch  |   51 +++++++++++++
 util-linux-2.20-mount.patch       |  141 +++++++++++++++++++++++++++++++++++++
 util-linux-2.20-switch_root.patch |   25 +++++++
 util-linux.spec                   |   23 ++++++-
 5 files changed, 284 insertions(+), 2 deletions(-)
---
diff --git a/util-linux-2.20-logger.patch b/util-linux-2.20-logger.patch
new file mode 100644
index 0000000..b7a33fc
--- /dev/null
+++ b/util-linux-2.20-logger.patch
@@ -0,0 +1,46 @@
+From 86248cd28a27bdd9a437e389966b0415e106802e Mon Sep 17 00:00:00 2001
+From: Karel Zak <kzak at redhat.com>
+Date: Thu, 8 Dec 2011 10:20:22 +0100
+Subject: [PATCH] logger: fix remote logging
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Reported-by: Hervé Quillévéré <herve_quillevere at herveq.tk>
+Signed-off-by: Karel Zak <kzak at redhat.com>
+---
+ misc-utils/logger.c |    6 +++---
+ 1 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/misc-utils/logger.c b/misc-utils/logger.c
+index a331f26..c89fca7 100644
+--- a/misc-utils/logger.c
++++ b/misc-utils/logger.c
+@@ -281,7 +281,7 @@ main(int argc, char **argv) {
+ 			}
+ 		}
+ 		if (p != buf) {
+-		    if (!usock)
++		    if (!usock && !udpserver)
+ 			syslog(pri, "%s", buf);
+ 		    else
+ 			mysyslog(LogSock, logflags, pri, tag, buf);
+@@ -295,13 +295,13 @@ main(int argc, char **argv) {
+ 		    if (len > 0 && buf[len - 1] == '\n')
+ 			    buf[len - 1] = '\0';
+ 
+-		    if (!usock)
++		    if (!usock && !udpserver)
+ 			syslog(pri, "%s", buf);
+ 		    else
+ 			mysyslog(LogSock, logflags, pri, tag, buf);
+ 		}
+ 	}
+-	if (!usock)
++	if (!usock && !udpserver)
+ 		closelog();
+ 	else
+ 		close(LogSock);
+-- 
+1.7.7.5
+
diff --git a/util-linux-2.20-mount-hint.patch b/util-linux-2.20-mount-hint.patch
new file mode 100644
index 0000000..2a10cb8
--- /dev/null
+++ b/util-linux-2.20-mount-hint.patch
@@ -0,0 +1,51 @@
+From 3142564b244b3163446d59f83390f73cea85097b Mon Sep 17 00:00:00 2001
+From: Karel Zak <kzak at redhat.com>
+Date: Tue, 10 Jan 2012 15:43:56 +0100
+Subject: [PATCH] mount: add hint that context= has to be quoted
+
+Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=747038
+Signed-off-by: Karel Zak <kzak at redhat.com>
+---
+ mount/mount.8 |   17 ++++++++++++++++-
+ 1 files changed, 16 insertions(+), 1 deletions(-)
+
+diff --git a/mount/mount.8 b/mount/mount.8
+index 2c4f636..00b512e 100644
+--- a/mount/mount.8
++++ b/mount/mount.8
+@@ -839,7 +839,7 @@ xattrs are supported, you can save time not having to label every file by
+ assigning the entire disk one security context.
+ 
+ A commonly used option for removable media is
+-.BR context=system_u:object_r:removable_t .
++.BR context="system_u:object_r:removable_t" .
+ 
+ Two other options are
+ .BR fscontext=
+@@ -875,8 +875,23 @@ useful for things like stateless linux.
+ Note that kernel rejects any remount request that includes the context
+ option even if unchanged from the current context.
+ 
++.B Warning that \fIcontext\fP value might contains comma
++and in this case the value has to be properly quoted otherwise
++.BR mount (8)
++will interpret the comma as separator between mount options. Don't forget that
++shell strips off quotes and
++.BR "double quoting is required" ,
++for example:
++.RS
++.RS
++.sp
++mount -t tmpfs none /mnt \-o 'context="system_u:object_r:tmp_t:s0:c127,c456",noexec'
++.sp
++.RE
++
+ For more details, see
+ .BR selinux (8)
++.RE
+ 
+ .TP
+ .B defaults
+-- 
+1.7.7.5
+
diff --git a/util-linux-2.20-mount.patch b/util-linux-2.20-mount.patch
new file mode 100644
index 0000000..94df9fc
--- /dev/null
+++ b/util-linux-2.20-mount.patch
@@ -0,0 +1,141 @@
+From a4c0cc75ff9744299f108c259efab1bd30c8007a Mon Sep 17 00:00:00 2001
+From: Karel Zak <kzak at redhat.com>
+Date: Mon, 2 Jan 2012 11:08:17 +0100
+Subject: [PATCH] mount: append inverting options for mount.<type>
+
+ fstab:
+	server://foo   /mnt/foo    nfs    user,exec
+
+The mount(8) does not append the option "exec" to /sbin/mount.<type>
+helper's command line. This is no problem when executed by non-root
+user as it reads the options from fstab only.
+
+.. but when executed by root (UID=0) then the mount.<type> helper
+follows the command where the "exec" option is missing. This is bug.
+
+original version (strace output):
+
+ execve("/sbin/mount.nfs", ["/sbin/mount.nfs",
+        "sr.net.home:/mnt/store", "/mnt/store", "-o",
+        "rw,nosuid,nodev,noauto,user"], [/* 21 vars */]) = 0
+
+fixed version:
+
+ execve("/sbin/mount.nfs", ["/sbin/mount.nfs",
+        "sr.net.home:/mnt/store", "/mnt/store", "-o",
+        "rw,nosuid,nodev,noauto,user,exec"], [/* 21 vars */]) = 0
+                                    ^^^^^
+
+Signed-off-by: Karel Zak <kzak at redhat.com>
+---
+ mount/mount.c |   31 ++++++++++++++++++++++++-------
+ 1 files changed, 24 insertions(+), 7 deletions(-)
+
+diff --git a/mount/mount.c b/mount/mount.c
+index 9b444c4..a18b2df 100644
+--- a/mount/mount.c
++++ b/mount/mount.c
+@@ -207,6 +207,8 @@ static const struct opt_map opt_map[] = {
+ 
+ static int opt_nofail = 0;
+ 
++static int invuser_flags;
++
+ static const char *opt_loopdev, *opt_vfstype, *opt_offset, *opt_sizelimit,
+         *opt_encryption, *opt_speed, *opt_comment, *opt_uhelper, *opt_helper;
+ 
+@@ -473,7 +475,7 @@ static int has_context_option(char *opts)
+  * For the options uid= and gid= replace user or group name by its value.
+  */
+ static inline void
+-parse_opt(char *opt, int *mask, char **extra_opts) {
++parse_opt(char *opt, int *mask, int *inv_user, char **extra_opts) {
+ 	const struct opt_map *om;
+ 
+ 	for (om = opt_map; om->opt != NULL; om++)
+@@ -482,6 +484,9 @@ parse_opt(char *opt, int *mask, char **extra_opts) {
+ 				*mask &= ~om->mask;
+ 			else
+ 				*mask |= om->mask;
++			if (om->inv && ((*mask & MS_USER) || (*mask & MS_USERS))
++			    && (om->mask & MS_SECURE))
++				*inv_user |= om->mask;
+ 			if ((om->mask == MS_USER || om->mask == MS_USERS)
+ 			    && !om->inv)
+ 				*mask |= MS_SECURE;
+@@ -566,7 +571,7 @@ parse_opts (const char *options, int *flags, char **extra_opts) {
+ 			/* end of option item or last item */
+ 			if (*p == '\0' || *(p+1) == '\0') {
+ 				if (!parse_string_opt(opt))
+-					parse_opt(opt, flags, extra_opts);
++					parse_opt(opt, flags, &invuser_flags, extra_opts);
+ 				opt = NULL;
+ 			}
+ 		}
+@@ -587,7 +592,9 @@ parse_opts (const char *options, int *flags, char **extra_opts) {
+ 
+ /* Try to build a canonical options string.  */
+ static char *
+-fix_opts_string (int flags, const char *extra_opts, const char *user) {
++fix_opts_string (int flags, const char *extra_opts,
++		 const char *user, int inv_user)
++{
+ 	const struct opt_map *om;
+ 	const struct string_opt_map *m;
+ 	char *new_opts;
+@@ -611,6 +618,16 @@ fix_opts_string (int flags, const char *extra_opts, const char *user) {
+ 	if (user)
+ 		new_opts = append_opt(new_opts, "user=", user);
+ 
++	if (inv_user) {
++		for (om = opt_map; om->opt != NULL; om++) {
++			if (om->mask && om->inv
++			    && (inv_user & om->mask) == om->mask) {
++				new_opts = append_opt(new_opts, om->opt, NULL);
++				inv_user &= ~om->mask;
++			}
++		}
++	}
++
+ 	return new_opts;
+ }
+ 
+@@ -662,7 +679,7 @@ create_mtab (void) {
+ 		mnt.mnt_dir = "/";
+ 		mnt.mnt_fsname = spec_to_devname(fstab->m.mnt_fsname);
+ 		mnt.mnt_type = fstab->m.mnt_type;
+-		mnt.mnt_opts = fix_opts_string (flags, extra_opts, NULL);
++		mnt.mnt_opts = fix_opts_string (flags, extra_opts, NULL, 0);
+ 		mnt.mnt_freq = mnt.mnt_passno = 0;
+ 		free(extra_opts);
+ 
+@@ -787,7 +804,7 @@ check_special_mountprog(const char *spec, const char *node, const char *type, in
+ 			if (setuid(getuid()) < 0)
+ 				die(EX_FAIL, _("mount: cannot set user id: %s"), strerror(errno));
+ 
+-			oo = fix_opts_string (flags, extra_opts, NULL);
++			oo = fix_opts_string(flags, extra_opts, NULL, invuser_flags);
+ 			mountargs[i++] = mountprog;			/* 1 */
+ 			mountargs[i++] = (char *) spec;			/* 2 */
+ 			mountargs[i++] = (char *) node;			/* 3 */
+@@ -1659,7 +1676,7 @@ try_mount_one (const char *spec0, const char *node0, const char *types0,
+   }
+ 
+ #ifdef HAVE_LIBMOUNT_MOUNT
+-  mtab_opts = fix_opts_string(flags & ~MS_NOMTAB, extra_opts, user);
++  mtab_opts = fix_opts_string(flags & ~MS_NOMTAB, extra_opts, user, 0);
+   mtab_flags = flags;
+ 
+   if (fake)
+@@ -1703,7 +1720,7 @@ try_mount_one (const char *spec0, const char *node0, const char *types0,
+   }
+ 
+   if (fake || mnt5_res == 0) {
+-      char *mo = fix_opts_string (flags & ~MS_NOMTAB, extra_opts, user);
++      char *mo = fix_opts_string (flags & ~MS_NOMTAB, extra_opts, user, 0);
+       const char *tp = types ? types : "unknown";
+ 
+       /* Mount succeeded, report this (if verbose) and write mtab entry.  */
+-- 
+1.7.7.5
+
diff --git a/util-linux-2.20-switch_root.patch b/util-linux-2.20-switch_root.patch
new file mode 100644
index 0000000..3d1eebf
--- /dev/null
+++ b/util-linux-2.20-switch_root.patch
@@ -0,0 +1,25 @@
+--- a/sys-utils/switch_root.c
++++ b/sys-utils/switch_root.c
+@@ -40,6 +40,10 @@
+ #define MS_MOVE 8192
+ #endif
+ 
++#ifndef MNT_DETACH
++#define MNT_DETACH       0x00000002	/* Just detach from the tree */
++#endif
++
+ /* remove all files/directories below dirName -- don't cross mountpoints */
+ static int recursiveRemove(int fd)
+ {
+@@ -131,7 +135,7 @@ static int switchroot(const char *newroot)
+ 
+ 		if ((stat(newmount, &sb) != 0) || (sb.st_dev != newroot_stat.st_dev)) {
+ 			/* mount point seems to be mounted already or stat failed */
+-			umount(umounts[i]);
++			umount2(umounts[i], MNT_DETACH);
+ 			continue;
+ 		}
+ 
+-- 
+1.7.7.5
+
diff --git a/util-linux.spec b/util-linux.spec
index 716a009..54654b5 100644
--- a/util-linux.spec
+++ b/util-linux.spec
@@ -2,7 +2,7 @@
 Summary: A collection of basic system utilities
 Name: util-linux
 Version: 2.20.1
-Release: 2.1%{?dist}
+Release: 2.2%{?dist}
 License: GPLv2 and GPLv2+ and GPLv3+ and LGPLv2+ and BSD with advertising and Public Domain
 Group: System Environment/Base
 URL: http://kernel.org/~kzak/util-linux/
@@ -86,6 +86,15 @@ Patch7: util-linux-ng-2.13-login-lastlog.patch
 # 231192 - ipcs is not printing correct values on pLinux
 Patch8: util-linux-2.20-ipcs-32bit.patch
 
+# 747250 - /run shows up twice in /proc/mounts
+Patch9: util-linux-2.20-switch_root.patch
+# 769636 - systemd NFS Mounts Ignore "exec" Flag
+Patch10: util-linux-2.20-mount.patch
+# 771607 - The logger utility's "-n"/"--server" option doesn't work
+Patch11: util-linux-2.20-logger.patch
+# 747038 - Mount does not handle context mount correctly
+Patch12: util-linux-2.20-mount-hint.patch
+
 %description
 The util-linux package contains a large variety of low-level system
 utilities that are necessary for a Linux system to function. Among
@@ -199,7 +208,11 @@ cp %{SOURCE8} %{SOURCE9} .
 %patch5 -p1
 %patch7 -p1
 %patch8 -p1
-
+%patch9 -p1
+%patch10 -p1
+%patch11 -p1
+%patch12 -p1
+ 
 %build
 unset LINGUAS || :
 
@@ -747,6 +760,12 @@ fi
 
 
 %changelog
+* Thu Jan 19 2012 Michal Luscon <mluscon at redhat.com> 2.20.1-2.2
+- fix #747250 - /run shows up twice in /proc/mounts
+- fix #769636 - systemd NFS Mounts Ignore "exec" Flag
+- fix #771607 - The logger utility's "-n"/"--server" option doesn't work
+- fix #747038 - Mount does not handle context mount correctly
+
 * Tue Nov 22 2011 Karel Zak <kzak at redhat.com> 2.20.1-2.1
 - fix #748216 - util-linux requires pam >= 1.1.3-7
 


More information about the scm-commits mailing list