From 87a4e2a580be474bb0ce2b7063e8f21d2bc5c9c0 Mon Sep 17 00:00:00 2001 From: kzak Date: Wed, 5 Dec 2007 12:48:15 +0000 Subject: [PATCH] - fix #409551 - hwclock: check for ENODEV (upstream patch) - fix #408391 - setarch: add missing alpha subarchs (upstream patch) - mkswap: possible to crash with SELinux relabeling support (upstream patch) - mount: don't call canonicalize(SPEC) for cifs, smbfs and nfs (upstream patch) --- util-linux-ng-2.13-hwclock-ENODEV.patch | 36 +++++++++++ util-linux-ng-2.13-mkswap-selinux.patch | 53 +++++++++++++++ util-linux-ng-2.13-mount-canonicalize.patch | 72 +++++++++++++++++++++ util-linux-ng-2.13-setarch-alpha.patch | 29 +++++++++ util-linux-ng.spec | 22 ++++++- 5 files changed, 210 insertions(+), 2 deletions(-) create mode 100644 util-linux-ng-2.13-hwclock-ENODEV.patch create mode 100644 util-linux-ng-2.13-mkswap-selinux.patch create mode 100644 util-linux-ng-2.13-mount-canonicalize.patch create mode 100644 util-linux-ng-2.13-setarch-alpha.patch diff --git a/util-linux-ng-2.13-hwclock-ENODEV.patch b/util-linux-ng-2.13-hwclock-ENODEV.patch new file mode 100644 index 0000000..295ee68 --- /dev/null +++ b/util-linux-ng-2.13-hwclock-ENODEV.patch @@ -0,0 +1,36 @@ +From 833dd2913e940a9ce4589730086b124697e92d7a Mon Sep 17 00:00:00 2001 +From: David Woodhouse +Date: Tue, 4 Dec 2007 14:44:05 +0100 +Subject: [PATCH] hwclock: check for ENODEV + +/sbin/hwclock is supposed to fall back to using /dev/rtc0 if /dev/rtc isn't +working (which it isn't, because mkinitrd creates it with the old device +numbers, and we're switching to the new RTC_CLASS driver). + +Unfortunately, it'll only cope if the error it gets is ENOENT (i.e. the device +node doesn't exist). It doesn't fall back to the next device in the list if the +error is ENODEV, which is what happens when the device node exists, but there's +no driver. + +Signed-off-by: David Woodhouse +Signed-off-by: Karel Zak +--- + hwclock/rtc.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/hwclock/rtc.c b/hwclock/rtc.c +index 724daf9..46a5b52 100644 +--- a/hwclock/rtc.c ++++ b/hwclock/rtc.c +@@ -113,7 +113,7 @@ open_rtc(void) { + for (p=fls; *p; ++p) { + int fd = open(*p, O_RDONLY); + +- if (fd < 0 && errno == ENOENT) ++ if (fd < 0 && (errno == ENOENT || errno == ENODEV)) + continue; + rtc_dev_name = *p; + return fd; +-- +1.5.3.1 + diff --git a/util-linux-ng-2.13-mkswap-selinux.patch b/util-linux-ng-2.13-mkswap-selinux.patch new file mode 100644 index 0000000..f0db803 --- /dev/null +++ b/util-linux-ng-2.13-mkswap-selinux.patch @@ -0,0 +1,53 @@ +From fb2da4155d099aad2c9da2eecd138a7668975667 Mon Sep 17 00:00:00 2001 +From: KaiGai Kohei +Date: Mon, 22 Oct 2007 10:30:19 +0200 +Subject: [PATCH] mkswap: possible to crash with SELinux relabeling support + +When fgetfilecon() is failed with -ENODATA, this process does not +exit. However, "oldcontext" is not initialized in this case, so +context_new() will be called with uninitialized "oldcontext" at the +next. + +Finally, it makes a segmentation fault, because context_new() have to +refer an incorrect memory region. + +The attached patch fixes this matter using matchpathcon(). If we +cannot obtain actual file context due to -ENODATA, a context which is +returned by matchpathcon() is applied as oldcontext. Then, the type +of the context is relabeled to "swapfile_t" explicitly. + +Signed-off-by: KaiGai Kohei +Signed-off-by: Karel Zak +--- + disk-utils/mkswap.c | 15 +++++++++------ + 1 files changed, 9 insertions(+), 6 deletions(-) + +diff --git a/disk-utils/mkswap.c b/disk-utils/mkswap.c +index 6af1ff7..2394368 100644 +--- a/disk-utils/mkswap.c ++++ b/disk-utils/mkswap.c +@@ -738,12 +738,15 @@ the -f option to force it.\n"), + security_context_t oldcontext; + context_t newcontext; + +- if ((fgetfilecon(DEV, &oldcontext) < 0) && +- (errno != ENODATA)) { +- fprintf(stderr, _("%s: %s: unable to obtain selinux file label: %s\n"), +- program_name, device_name, +- strerror(errno)); +- exit(1); ++ if (fgetfilecon(DEV, &oldcontext) < 0) { ++ if (errno != ENODATA) { ++ fprintf(stderr, _("%s: %s: unable to obtain selinux file label: %s\n"), ++ program_name, device_name, ++ strerror(errno)); ++ exit(1); ++ } ++ if (matchpathcon(device_name, statbuf.st_mode, &oldcontext)) ++ die(_("unable to matchpathcon()")); + } + if (!(newcontext = context_new(oldcontext))) + die(_("unable to create new selinux context")); +-- +1.5.3.1 + diff --git a/util-linux-ng-2.13-mount-canonicalize.patch b/util-linux-ng-2.13-mount-canonicalize.patch new file mode 100644 index 0000000..8a2dbca --- /dev/null +++ b/util-linux-ng-2.13-mount-canonicalize.patch @@ -0,0 +1,72 @@ +From cd93e3f76272de50592a0eb7c343c65a803ef6d5 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Wed, 21 Nov 2007 01:46:57 +0100 +Subject: [PATCH] mount: don't call canonicalize(SPEC) for cifs, smbfs and nfs + +When calling "mount -t smbfs //foo/bar /mnt/foo", mount.smbfs will be +called with /foo/bar if /foo/bar exists locally, and will display its +usage. + +The patch also removes duplicate canonicalize() from mounted() +function. + +Reported-By: Pascal Terjan +Signed-off-by: Karel Zak +--- + mount/mount.c | 21 ++++++++++++--------- + 1 files changed, 12 insertions(+), 9 deletions(-) + +diff --git a/mount/mount.c b/mount/mount.c +index 96776db..7e3336a 100644 +--- a/mount/mount.c ++++ b/mount/mount.c +@@ -1385,11 +1385,6 @@ mount_one (const char *spec, const char *node, const char *types, + /* Merge the fstab and command line options. */ + opts = append_opt(opts, cmdlineopts, NULL); + +- /* Handle possible LABEL= and UUID= forms of spec */ +- nspec = fsprobe_get_devname_for_mounting(spec); +- if (nspec) +- spec = nspec; +- + if (types == NULL && !mounttype && !is_existing_file(spec)) { + if (strchr (spec, ':') != NULL) { + types = "nfs"; +@@ -1406,6 +1401,15 @@ mount_one (const char *spec, const char *node, const char *types, + } + } + ++ /* Handle possible LABEL= and UUID= forms of spec */ ++ if (types == NULL || (strncmp(types, "nfs", 3) && ++ strncmp(types, "cifs", 4) && ++ strncmp(types, "smbfs", 5))) { ++ nspec = fsprobe_get_devname_for_mounting(spec); ++ if (nspec) ++ spec = nspec; ++ } ++ + /* + * Try to mount the file system. When the exit status is EX_BG, + * we will retry in the background. Otherwise, we're done. +@@ -1439,15 +1443,14 @@ mount_one (const char *spec, const char *node, const char *types, + static int + mounted (const char *spec0, const char *node0) { + struct mntentchn *mc, *mc0; +- char *spec, *node; ++ const char *spec, *node; + int ret = 0; + + /* Handle possible UUID= and LABEL= in spec */ +- spec0 = fsprobe_get_devname(spec0); +- if (!spec0) ++ spec = fsprobe_get_devname(spec0); ++ if (!spec) + return ret; + +- spec = canonicalize(spec0); + node = canonicalize(node0); + + mc0 = mtab_head(); +-- +1.5.3.1 + diff --git a/util-linux-ng-2.13-setarch-alpha.patch b/util-linux-ng-2.13-setarch-alpha.patch new file mode 100644 index 0000000..240798f --- /dev/null +++ b/util-linux-ng-2.13-setarch-alpha.patch @@ -0,0 +1,29 @@ +From adf88e666acdd05da134bca50fb52daedb7b8952 Mon Sep 17 00:00:00 2001 +From: Oliver Falk +Date: Mon, 3 Dec 2007 13:34:42 +0100 +Subject: [PATCH] setarch: add missing alpha subarchs + +Signed-off-by: Oliver Falk +Signed-off-by: Karel Zak +--- + sys-utils/setarch.c | 4 ++++ + 1 files changed, 4 insertions(+), 0 deletions(-) + +diff --git a/sys-utils/setarch.c b/sys-utils/setarch.c +index a544853..aa7c810 100644 +--- a/sys-utils/setarch.c ++++ b/sys-utils/setarch.c +@@ -167,6 +167,10 @@ int set_arch(const char *pers, unsigned long options) + #endif + #if defined(__alpha__) + {PER_LINUX, "alpha", "alpha"}, ++ {PER_LINUX, "alphaev5", "alpha"}, ++ {PER_LINUX, "alphaev56", "alpha"}, ++ {PER_LINUX, "alphaev6", "alpha"}, ++ {PER_LINUX, "alphaev67", "alpha"}, + #endif + {-1, NULL, NULL} + }; +-- +1.5.3.1 + diff --git a/util-linux-ng.spec b/util-linux-ng.spec index 385bd7f..54e7840 100644 --- a/util-linux-ng.spec +++ b/util-linux-ng.spec @@ -2,7 +2,7 @@ Summary: A collection of basic system utilities Name: util-linux-ng Version: 2.13 -Release: 3%{?dist} +Release: 4%{?dist} License: GPLv2 and GPLv2+ and BSD with advertising and Public Domain Group: System Environment/Base URL: ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng @@ -97,7 +97,7 @@ Patch7: util-linux-ng-2.13-fdisk-b-4096.patch # 231192 - ipcs is not printing correct values on pLinux Patch8: util-linux-ng-2.13-ipcs-32bit.patch # 174111 - mount allows loopback devices to be mounted more than once to the -# same mount point (move to upstream?) +# same mount point Patch9: util-linux-ng-2.13-mount-twiceloop.patch # 165863 - swsusp swaps should be reinitialized Patch10: util-linux-ng-2.13-swapon-swsuspend.patch @@ -110,6 +110,14 @@ Patch12: util-linux-ng-2.13-blockdev-rmpart.patch Patch13: util-linux-ng-2.13-mount-LU.patch # script die on SIGWINCH (upstream patch) Patch14: util-linux-ng-2.13-script-SIGWINCH.patch +# hwclock: check for ENODEV (upstream patch) +Patch15: util-linux-ng-2.13-hwclock-ENODEV.patch +# mkswap: possible to crash with SELinux relabeling support (upstream patch) +Patch16: util-linux-ng-2.13-mkswap-selinux.patch +# mount: don't call canonicalize(SPEC) for cifs, smbfs and nfs (upstream patch) +Patch17: util-linux-ng-2.13-mount-canonicalize.patch +# setarch: add missing alpha subarchs (upstream patch) +Patch18: util-linux-ng-2.13-setarch-alpha.patch %description @@ -137,6 +145,10 @@ cp %{SOURCE8} %{SOURCE9} . %patch12 -p1 %patch13 -p1 %patch14 -p1 +%patch15 -p1 +%patch16 -p1 +%patch17 -p1 +%patch18 -p1 %build unset LINGUAS || : @@ -533,6 +545,12 @@ exit 0 /sbin/losetup %changelog +* Wed Dec 5 2007 Karel Zak 2.13-4 +- fix #409551 - hwclock: check for ENODEV (upstream patch) +- fix #408391 - setarch: add missing alpha subarchs (upstream patch) +- mkswap: possible to crash with SELinux relabeling support (upstream patch) +- mount: don't call canonicalize(SPEC) for cifs, smbfs and nfs (upstream patch) + * Tue Oct 16 2007 Karel Zak 2.13-3 - fix mount -L | -U segfault - fix script die on SIGWINCH