[util-linux/f19] 2.23-0.2: libmount fixes
kzak
kzak at fedoraproject.org
Wed Mar 27 09:53:47 UTC 2013
commit 4788cbd6e78c7063c6607e89457eab611e4f4700
Author: Karel Zak <kzak at redhat.com>
Date: Wed Mar 27 10:53:32 2013 +0100
2.23-0.2: libmount fixes
Signed-off-by: Karel Zak <kzak at redhat.com>
...x-user-mount-by-root-for-mount.-type-help.patch | 50 ++++++++++++++
...ount-crashes-when-trying-to-umount-a-non-.patch | 69 ++++++++++++++++++++
util-linux.spec | 11 +++-
3 files changed, 129 insertions(+), 1 deletions(-)
---
diff --git a/0001-libmount-fix-user-mount-by-root-for-mount.-type-help.patch b/0001-libmount-fix-user-mount-by-root-for-mount.-type-help.patch
new file mode 100644
index 0000000..f6523b5
--- /dev/null
+++ b/0001-libmount-fix-user-mount-by-root-for-mount.-type-help.patch
@@ -0,0 +1,50 @@
+From 17206c059dc2e42e7081079b76eafda68cc9a5b8 Mon Sep 17 00:00:00 2001
+From: Karel Zak <kzak at redhat.com>
+Date: Tue, 26 Mar 2013 16:05:07 +0100
+Subject: [PATCH] libmount: fix user-mount by root for mount.<type> helpers
+
+Append options like "exec" "suid" and "dev" to mount.<type> helpers
+command line if the options are in fstab. This is relevant for root
+user who calls mount(8) for fstab entries with "user,exec" etc.
+
+Signed-off-by: Karel Zak <kzak at redhat.com>
+---
+ libmount/src/context_mount.c | 22 ++++++++++++++++++++++
+ 1 file changed, 22 insertions(+)
+
+diff --git a/libmount/src/context_mount.c b/libmount/src/context_mount.c
+index 00738b4..3b280ab 100644
+--- a/libmount/src/context_mount.c
++++ b/libmount/src/context_mount.c
+@@ -275,6 +275,28 @@ static int generate_helper_optstr(struct libmnt_context *cxt, char **optstr)
+ if (!*optstr)
+ return -ENOMEM;
+
++ if (cxt->user_mountflags & MNT_MS_USER) {
++ /*
++ * This is unnecessary for real user-mounts as mount.<type>
++ * helpers have to always follow fstab rather than mount
++ * options on command line.
++ *
++ * But if you call mount.<type> as root then the helper follows
++ * command line. If there is (for example) "user,exec" in fstab
++ * then we have to manually append the "exec" back to the options
++ * string, bacause there is nothing like MS_EXEC (we have only
++ * MS_NOEXEC in mount flags and we don't care about the original
++ * mount string in libmount for VFS options).
++ */
++ if (!(cxt->mountflags & MS_NOEXEC))
++ mnt_optstr_append_option(optstr, "exec", NULL);
++ if (!(cxt->mountflags & MS_NOSUID))
++ mnt_optstr_append_option(optstr, "suid", NULL);
++ if (!(cxt->mountflags & MS_NODEV))
++ mnt_optstr_append_option(optstr, "dev", NULL);
++ }
++
++
+ if (cxt->flags & MNT_FL_SAVED_USER)
+ rc = mnt_optstr_set_option(optstr, "user", cxt->orig_user);
+ if (rc)
+--
+1.8.1.4
+
diff --git a/0001-libmount-umount-crashes-when-trying-to-umount-a-non-.patch b/0001-libmount-umount-crashes-when-trying-to-umount-a-non-.patch
new file mode 100644
index 0000000..ed498b6
--- /dev/null
+++ b/0001-libmount-umount-crashes-when-trying-to-umount-a-non-.patch
@@ -0,0 +1,69 @@
+From 52a285bf4e8d3a78d7211694977f5894a748bdac Mon Sep 17 00:00:00 2001
+From: Karel Zak <kzak at redhat.com>
+Date: Mon, 25 Mar 2013 09:17:52 +0100
+Subject: [PATCH] libmount: umount crashes when trying to umount a
+ non-mountpoint
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Reported-by: Mantas Mikulėnas <grawity at gmail.com>
+Signed-off-by: Karel Zak <kzak at redhat.com>
+---
+ libmount/src/context_umount.c | 4 ++--
+ libmount/src/fs.c | 3 +++
+ libmount/src/libmount.h.in | 2 +-
+ 3 files changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/libmount/src/context_umount.c b/libmount/src/context_umount.c
+index 113c53e..96ae87a 100644
+--- a/libmount/src/context_umount.c
++++ b/libmount/src/context_umount.c
+@@ -183,7 +183,7 @@ err:
+ static int lookup_umount_fs(struct libmnt_context *cxt)
+ {
+ const char *tgt;
+- struct libmnt_fs *fs;
++ struct libmnt_fs *fs = NULL;
+ int rc;
+
+ assert(cxt);
+@@ -198,7 +198,7 @@ static int lookup_umount_fs(struct libmnt_context *cxt)
+ rc = mnt_context_find_umount_fs(cxt, tgt, &fs);
+ if (rc < 0)
+ return rc;
+- if (!fs) {
++ if (rc == 1 || !fs) {
+ DBG(CXT, mnt_debug_h(cxt, "umount: cannot find %s in mtab", tgt));
+ return 0;
+ }
+diff --git a/libmount/src/fs.c b/libmount/src/fs.c
+index 96c13d3..bb9006d 100644
+--- a/libmount/src/fs.c
++++ b/libmount/src/fs.c
+@@ -129,6 +129,9 @@ struct libmnt_fs *mnt_copy_fs(struct libmnt_fs *dest,
+ {
+ const struct libmnt_fs *org = dest;
+
++ if (!src)
++ return NULL;
++
+ if (!dest) {
+ dest = mnt_new_fs();
+ if (!dest)
+diff --git a/libmount/src/libmount.h.in b/libmount/src/libmount.h.in
+index ccd260d..bb18ba1 100644
+--- a/libmount/src/libmount.h.in
++++ b/libmount/src/libmount.h.in
+@@ -318,7 +318,7 @@ extern void mnt_reset_fs(struct libmnt_fs *fs)
+ __ul_attribute__((nonnull));
+ extern struct libmnt_fs *mnt_copy_fs(struct libmnt_fs *dest,
+ const struct libmnt_fs *src)
+- __ul_attribute__((nonnull(2), warn_unused_result));
++ __ul_attribute__((warn_unused_result));
+ extern void *mnt_fs_get_userdata(struct libmnt_fs *fs)
+ __ul_attribute__((nonnull));
+ extern int mnt_fs_set_userdata(struct libmnt_fs *fs, void *data);
+--
+1.8.1.4
+
diff --git a/util-linux.spec b/util-linux.spec
index d6af783..dcd74c5 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.23
-Release: 0.1%{?dist}
+Release: 0.2%{?dist}
License: GPLv2 and GPLv2+ and LGPLv2+ and BSD with advertising and Public Domain
Group: System Environment/Base
URL: http://en.wikipedia.org/wiki/Util-linux
@@ -86,6 +86,12 @@ Patch2: util-linux-2.19-floppy-generic.patch
# 151635 - makeing /var/log/lastlog
Patch3: util-linux-ng-2.22-login-lastlog.patch
+### Upstream patches for v2.23-rc2
+###
+Patch100: 0001-libmount-fix-user-mount-by-root-for-mount.-type-help.patch
+Patch101: 0001-libmount-umount-crashes-when-trying-to-umount-a-non-.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
@@ -745,6 +751,9 @@ fi
%{_libdir}/pkgconfig/uuid.pc
%changelog
+* Wed Mar 27 2013 Karel Zak <kzak at redhat.com> 2.23-0.2
+- add upstream patches for to fix umount and mount.<type>
+
* Fri Mar 22 2013 Karel Zak <kzak at redhat.com> 2.23-0.1
- upgrade to the release 2.22-rc1
ftp://ftp.kernel.org/pub/linux/utils/util-linux/v2.23/v2.23-ReleaseNotes
More information about the scm-commits
mailing list