Merge branch 'f18'
This commit is contained in:
commit
2adc0e74a6
34
0001-libmount-don-t-use-umount-optimization-for-l-or-f.patch
Normal file
34
0001-libmount-don-t-use-umount-optimization-for-l-or-f.patch
Normal file
@ -0,0 +1,34 @@
|
||||
From 6eeca6c7170295f325b814ee0cd1576da885cd30 Mon Sep 17 00:00:00 2001
|
||||
From: Karel Zak <kzak@redhat.com>
|
||||
Date: Mon, 15 Oct 2012 11:10:50 +0200
|
||||
Subject: [PATCH 01/11] libmount: don't use umount optimization for -l or -f
|
||||
|
||||
The options -l (lazy) and -f (force) means that the mountpoint may be
|
||||
unreadable (for example because NFS server is unreadable). So we
|
||||
should not try to be smart in this case and we should try to minimize
|
||||
number of situations when stat() or readlink() is used for the
|
||||
mountpoint.
|
||||
|
||||
Signed-off-by: Karel Zak <kzak@redhat.com>
|
||||
---
|
||||
libmount/src/context_umount.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libmount/src/context_umount.c b/libmount/src/context_umount.c
|
||||
index ce095bf..2c2e64c 100644
|
||||
--- a/libmount/src/context_umount.c
|
||||
+++ b/libmount/src/context_umount.c
|
||||
@@ -83,7 +83,9 @@ static int lookup_umount_fs(struct libmnt_context *cxt)
|
||||
* where LABEL, UUID or symlinks are to canonicalized. It means that
|
||||
* it's usable only for canonicalized stuff (e.g. kernel mountinfo).
|
||||
*/
|
||||
- if (!cxt->mtab_writable && *tgt == '/') {
|
||||
+ if (!cxt->mtab_writable && *tgt == '/' &&
|
||||
+ !mnt_context_is_force(cxt) && !mnt_context_is_lazy(cxt)) {
|
||||
+
|
||||
struct stat st;
|
||||
|
||||
if (stat(tgt, &st) == 0 && S_ISDIR(st.st_mode)) {
|
||||
--
|
||||
1.7.11.7
|
||||
|
27
0002-wipefs-use-O_EXCL.patch
Normal file
27
0002-wipefs-use-O_EXCL.patch
Normal file
@ -0,0 +1,27 @@
|
||||
From 9faf9c8494cf37fdcf68b1dfe10fd7900e93ec00 Mon Sep 17 00:00:00 2001
|
||||
From: Karel Zak <kzak@redhat.com>
|
||||
Date: Mon, 15 Oct 2012 12:38:09 +0200
|
||||
Subject: [PATCH 02/11] wipefs: use O_EXCL
|
||||
|
||||
Address: https://bugzilla.redhat.com/show_bug.cgi?id=865961
|
||||
Signed-off-by: Karel Zak <kzak@redhat.com>
|
||||
---
|
||||
misc-utils/wipefs.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/misc-utils/wipefs.c b/misc-utils/wipefs.c
|
||||
index cddad8a..0ddc148 100644
|
||||
--- a/misc-utils/wipefs.c
|
||||
+++ b/misc-utils/wipefs.c
|
||||
@@ -309,7 +309,7 @@ static void do_wipe_real(blkid_probe pr, const char *devname, struct wipe_desc *
|
||||
static struct wipe_desc *
|
||||
do_wipe(struct wipe_desc *wp, const char *devname, int noact, int all, int quiet)
|
||||
{
|
||||
- blkid_probe pr = new_probe(devname, O_RDWR);
|
||||
+ blkid_probe pr = new_probe(devname, O_RDWR | O_EXCL);
|
||||
struct wipe_desc *w, *wp0 = clone_offset(wp);
|
||||
int zap = all ? 1 : wp->zap;
|
||||
|
||||
--
|
||||
1.7.11.7
|
||||
|
37
0003-swapon-remove-loop-declaration-smatch-scan.patch
Normal file
37
0003-swapon-remove-loop-declaration-smatch-scan.patch
Normal file
@ -0,0 +1,37 @@
|
||||
From 10a9cbcf36d43c0d4a13bf5e91315b4ffd29e636 Mon Sep 17 00:00:00 2001
|
||||
From: Sami Kerola <kerolasa@iki.fi>
|
||||
Date: Mon, 8 Oct 2012 08:08:20 +0100
|
||||
Subject: [PATCH 03/11] swapon: remove loop declaration [smatch scan]
|
||||
|
||||
sys-utils/swapon.c:677:2: error: 'for' loop initial declarations are
|
||||
only allowed in C99 mode
|
||||
|
||||
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
|
||||
---
|
||||
sys-utils/swapon.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/sys-utils/swapon.c b/sys-utils/swapon.c
|
||||
index c9cabc1..0e1ab66 100644
|
||||
--- a/sys-utils/swapon.c
|
||||
+++ b/sys-utils/swapon.c
|
||||
@@ -642,6 +642,7 @@ static int swapon_all(void)
|
||||
|
||||
static void __attribute__ ((__noreturn__)) usage(FILE * out)
|
||||
{
|
||||
+ size_t i;
|
||||
fputs(USAGE_HEADER, out);
|
||||
|
||||
fprintf(out, _(" %s [options] [<spec>]\n"), program_invocation_short_name);
|
||||
@@ -674,7 +675,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out)
|
||||
" <file> name of file to be used\n"), out);
|
||||
|
||||
fputs(_("\nAvailable columns (for --show):\n"), out);
|
||||
- for (size_t i = 0; i < NCOLS; i++)
|
||||
+ for (i = 0; i < NCOLS; i++)
|
||||
fprintf(out, " %4s %s\n", infos[i].name, _(infos[i].help));
|
||||
|
||||
fprintf(out, USAGE_MAN_TAIL("swapon(8)"));
|
||||
--
|
||||
1.7.11.7
|
||||
|
35
0004-libblkid-fix-compiler-warning-Wstrict-aliasing.patch
Normal file
35
0004-libblkid-fix-compiler-warning-Wstrict-aliasing.patch
Normal file
@ -0,0 +1,35 @@
|
||||
From 9f6c8591eeffb6591dc6a18512e618f0acf09890 Mon Sep 17 00:00:00 2001
|
||||
From: Karel Zak <kzak@redhat.com>
|
||||
Date: Mon, 15 Oct 2012 17:01:30 +0200
|
||||
Subject: [PATCH 04/11] libblkid: fix compiler warning [-Wstrict-aliasing]
|
||||
|
||||
libblkid/src/superblocks/befs.c: In function 'get_uuid':
|
||||
libblkid/src/superblocks/befs.c:353:6: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
|
||||
|
||||
Signed-off-by: Karel Zak <kzak@redhat.com>
|
||||
---
|
||||
libblkid/src/superblocks/befs.c | 8 +++++---
|
||||
1 file changed, 5 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/libblkid/src/superblocks/befs.c b/libblkid/src/superblocks/befs.c
|
||||
index a7f4317..452da1e 100644
|
||||
--- a/libblkid/src/superblocks/befs.c
|
||||
+++ b/libblkid/src/superblocks/befs.c
|
||||
@@ -348,9 +348,11 @@ static int get_uuid(blkid_probe pr, const struct befs_super_block *bs,
|
||||
&& FS16_TO_CPU(sd->name_size, fs_le) == strlen(KEY_NAME)
|
||||
&& FS16_TO_CPU(sd->data_size, fs_le) == KEY_SIZE
|
||||
&& strcmp(sd->name, KEY_NAME) == 0) {
|
||||
- *uuid = *(uint64_t *) ((uint8_t *) sd->name
|
||||
- + FS16_TO_CPU(sd->name_size, fs_le)
|
||||
- + 3);
|
||||
+
|
||||
+ memcpy(uuid,
|
||||
+ sd->name + FS16_TO_CPU(sd->name_size, fs_le) + 3,
|
||||
+ sizeof(uint64_t));
|
||||
+
|
||||
break;
|
||||
} else if (FS32_TO_CPU(sd->type, fs_le) == 0
|
||||
&& FS16_TO_CPU(sd->name_size, fs_le) == 0
|
||||
--
|
||||
1.7.11.7
|
||||
|
@ -0,0 +1,31 @@
|
||||
From 532116d4dd16632806ed4a036c2e89b966221031 Mon Sep 17 00:00:00 2001
|
||||
From: Bill Pemberton <wfp5p@virginia.edu>
|
||||
Date: Wed, 10 Oct 2012 16:54:01 -0400
|
||||
Subject: [PATCH 05/11] mount: add -c abbreviation for --no-canonicalize to
|
||||
man page
|
||||
|
||||
The --no-canonicalize option can also be set using -c. The --help for
|
||||
mount shows this option but the man page did not. Add -c to the man
|
||||
page.
|
||||
|
||||
Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
|
||||
---
|
||||
sys-utils/mount.8 | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/sys-utils/mount.8 b/sys-utils/mount.8
|
||||
index dce4b8c..83a4518 100644
|
||||
--- a/sys-utils/mount.8
|
||||
+++ b/sys-utils/mount.8
|
||||
@@ -552,7 +552,7 @@ Mount without writing in
|
||||
This is necessary for example when
|
||||
.I /etc
|
||||
is on a read-only filesystem.
|
||||
-.IP "\fB\-\-no\-canonicalize\fP"
|
||||
+.IP "\fB\-c, \-\-no\-canonicalize\fP"
|
||||
Don't canonicalize paths. The mount command canonicalizes all paths
|
||||
(from command line or fstab) and stores canonicalized paths to the
|
||||
.IR /etc/mtab
|
||||
--
|
||||
1.7.11.7
|
||||
|
33
0006-mount-add-long-options-for-L-and-U-to-man-page.patch
Normal file
33
0006-mount-add-long-options-for-L-and-U-to-man-page.patch
Normal file
@ -0,0 +1,33 @@
|
||||
From b426209c5ba2126a9038363a269fec884af470fb Mon Sep 17 00:00:00 2001
|
||||
From: Bill Pemberton <wfp5p@virginia.edu>
|
||||
Date: Wed, 10 Oct 2012 16:54:02 -0400
|
||||
Subject: [PATCH 06/11] mount: add long options for -L and -U to man page
|
||||
|
||||
The -L and -U flags both have long options too (--label and --uuid).
|
||||
The usage() function will show them but the man page didn't list them.
|
||||
|
||||
Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
|
||||
---
|
||||
sys-utils/mount.8 | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/sys-utils/mount.8 b/sys-utils/mount.8
|
||||
index 83a4518..0b40bf7 100644
|
||||
--- a/sys-utils/mount.8
|
||||
+++ b/sys-utils/mount.8
|
||||
@@ -586,10 +586,10 @@ set the block device to read-only mode, see command
|
||||
.IP "\fB\-w, \-\-rw\fP"
|
||||
Mount the filesystem read/write. This is the default. A synonym is
|
||||
.BR "\-o rw" .
|
||||
-.IP "\fB\-L \fIlabel\fP"
|
||||
+.IP "\fB\-L, \-\-label \fIlabel\fP"
|
||||
Mount the partition that has the specified
|
||||
.IR label .
|
||||
-.IP "\fB\-U \fIuuid\fP"
|
||||
+.IP "\fB\-U, \-\-uuid \fIuuid\fP"
|
||||
Mount the partition that has the specified
|
||||
.IR uuid .
|
||||
These two options require the file
|
||||
--
|
||||
1.7.11.7
|
||||
|
107
0007-lib-loopdev-improve-debug-messages.patch
Normal file
107
0007-lib-loopdev-improve-debug-messages.patch
Normal file
@ -0,0 +1,107 @@
|
||||
From deb0e659451d4ade29df3dbb842607edd6080c0d Mon Sep 17 00:00:00 2001
|
||||
From: Karel Zak <kzak@redhat.com>
|
||||
Date: Wed, 17 Oct 2012 11:42:21 +0200
|
||||
Subject: [PATCH 07/11] lib/loopdev: improve debug messages
|
||||
|
||||
Signed-off-by: Karel Zak <kzak@redhat.com>
|
||||
---
|
||||
lib/loopdev.c | 22 ++++++++++++++++++----
|
||||
sys-utils/losetup.c | 2 --
|
||||
2 files changed, 18 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/lib/loopdev.c b/lib/loopdev.c
|
||||
index a9f6df2..0e6033a 100644
|
||||
--- a/lib/loopdev.c
|
||||
+++ b/lib/loopdev.c
|
||||
@@ -87,8 +87,10 @@ int loopcxt_set_device(struct loopdev_cxt *lc, const char *device)
|
||||
if (!lc)
|
||||
return -EINVAL;
|
||||
|
||||
- if (lc->fd >= 0)
|
||||
+ if (lc->fd >= 0) {
|
||||
close(lc->fd);
|
||||
+ DBG(lc, loopdev_debug("closing old open fd"));
|
||||
+ }
|
||||
lc->fd = -1;
|
||||
lc->mode = 0;
|
||||
lc->has_info = 0;
|
||||
@@ -158,19 +160,26 @@ int loopcxt_init(struct loopdev_cxt *lc, int flags)
|
||||
memcpy(lc, &dummy, sizeof(dummy));
|
||||
lc->flags = flags;
|
||||
|
||||
+ if (getenv("LOOPDEV_DEBUG"))
|
||||
+ loopcxt_enable_debug(lc, TRUE);
|
||||
+
|
||||
rc = loopcxt_set_device(lc, NULL);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
if (!(lc->flags & LOOPDEV_FL_NOSYSFS) &&
|
||||
- get_linux_version() >= KERNEL_VERSION(2,6,37))
|
||||
+ get_linux_version() >= KERNEL_VERSION(2,6,37)) {
|
||||
/*
|
||||
* Use only sysfs for basic information about loop devices
|
||||
*/
|
||||
lc->flags |= LOOPDEV_FL_NOIOCTL;
|
||||
+ DBG(lc, loopdev_debug("init: ignore ioctls"));
|
||||
+ }
|
||||
|
||||
- if (!(lc->flags & LOOPDEV_FL_CONTROL) && !stat(_PATH_DEV_LOOPCTL, &st))
|
||||
+ if (!(lc->flags & LOOPDEV_FL_CONTROL) && !stat(_PATH_DEV_LOOPCTL, &st)) {
|
||||
lc->flags |= LOOPDEV_FL_CONTROL;
|
||||
+ DBG(lc, loopdev_debug("init: loop-control detected "));
|
||||
+ }
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -272,7 +281,9 @@ int loopcxt_get_fd(struct loopdev_cxt *lc)
|
||||
if (lc->fd < 0) {
|
||||
lc->mode = lc->flags & LOOPDEV_FL_RDWR ? O_RDWR : O_RDONLY;
|
||||
lc->fd = open(lc->device, lc->mode);
|
||||
- DBG(lc, loopdev_debug("open %s", lc->fd < 0 ? "failed" : "ok"));
|
||||
+ DBG(lc, loopdev_debug("open %s [%s]: %s", lc->device,
|
||||
+ lc->flags & LOOPDEV_FL_RDWR ? "rw" : "ro",
|
||||
+ lc->fd < 0 ? "failed" : "ok"));
|
||||
}
|
||||
return lc->fd;
|
||||
}
|
||||
@@ -576,6 +587,7 @@ int loopcxt_next(struct loopdev_cxt *lc)
|
||||
* of loop devices). This is enough for 99% of all cases.
|
||||
*/
|
||||
if (iter->default_check) {
|
||||
+ DBG(lc, loopdev_debug("iter: next: default check"));
|
||||
for (++iter->ncur; iter->ncur < LOOPDEV_DEFAULT_NNODES;
|
||||
iter->ncur++) {
|
||||
char name[16];
|
||||
@@ -590,6 +602,7 @@ int loopcxt_next(struct loopdev_cxt *lc)
|
||||
/* C) the worst possibility, scan whole /dev or /dev/loop/<N>
|
||||
*/
|
||||
if (!iter->minors) {
|
||||
+ DBG(lc, loopdev_debug("iter: next: scan /dev"));
|
||||
iter->nminors = (lc->flags & LOOPDEV_FL_DEVSUBDIR) ?
|
||||
loop_scandir(_PATH_DEV_LOOP, &iter->minors, 0) :
|
||||
loop_scandir(_PATH_DEV, &iter->minors, 1);
|
||||
@@ -1150,6 +1163,7 @@ int loopcxt_setup_device(struct loopdev_cxt *lc)
|
||||
DBG(lc, loopdev_debug("setup: backing file open: OK"));
|
||||
|
||||
if (lc->fd != -1 && lc->mode != mode) {
|
||||
+ DBG(lc, loopdev_debug("closing already open device (mode mismatch)"));
|
||||
close(lc->fd);
|
||||
lc->fd = -1;
|
||||
lc->mode = 0;
|
||||
diff --git a/sys-utils/losetup.c b/sys-utils/losetup.c
|
||||
index fdcc0be..a8381a8 100644
|
||||
--- a/sys-utils/losetup.c
|
||||
+++ b/sys-utils/losetup.c
|
||||
@@ -250,8 +250,6 @@ int main(int argc, char **argv)
|
||||
if (loopcxt_init(&lc, 0))
|
||||
err(EXIT_FAILURE, _("failed to initialize loopcxt"));
|
||||
|
||||
- loopcxt_enable_debug(&lc, getenv("LOOPDEV_DEBUG") ? TRUE : FALSE);
|
||||
-
|
||||
while ((c = getopt_long(argc, argv, "ac:d:De:E:fhj:o:p:PrvV",
|
||||
longopts, NULL)) != -1) {
|
||||
|
||||
--
|
||||
1.7.11.7
|
||||
|
35
0008-lib-loopdev-check-for-sys.patch
Normal file
35
0008-lib-loopdev-check-for-sys.patch
Normal file
@ -0,0 +1,35 @@
|
||||
From 939636dd664cc608232c272de77be96e6f089235 Mon Sep 17 00:00:00 2001
|
||||
From: Karel Zak <kzak@redhat.com>
|
||||
Date: Wed, 17 Oct 2012 11:43:39 +0200
|
||||
Subject: [PATCH 08/11] lib/loopdev: check for /sys
|
||||
|
||||
The current loopdev code prefers /sys to get information about
|
||||
loop devices. The old methods like scan /dev are fallback solution
|
||||
only. Unfortunately, the code does not check if /sys is mounted.
|
||||
|
||||
Addresses: http://blog.flameeyes.eu/2012/10/sophistication-can-be-bad
|
||||
Signed-off-by: Karel Zak <kzak@redhat.com>
|
||||
---
|
||||
lib/loopdev.c | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/lib/loopdev.c b/lib/loopdev.c
|
||||
index 0e6033a..f62af83 100644
|
||||
--- a/lib/loopdev.c
|
||||
+++ b/lib/loopdev.c
|
||||
@@ -167,6 +167,12 @@ int loopcxt_init(struct loopdev_cxt *lc, int flags)
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
+ if (stat(_PATH_SYS_BLOCK, &st) || !S_ISDIR(st.st_mode)) {
|
||||
+ lc->flags |= LOOPDEV_FL_NOSYSFS;
|
||||
+ lc->flags &= ~LOOPDEV_FL_NOIOCTL;
|
||||
+ DBG(lc, loopdev_debug("init: disable /sys usage"));
|
||||
+ }
|
||||
+
|
||||
if (!(lc->flags & LOOPDEV_FL_NOSYSFS) &&
|
||||
get_linux_version() >= KERNEL_VERSION(2,6,37)) {
|
||||
/*
|
||||
--
|
||||
1.7.11.7
|
||||
|
@ -0,0 +1,49 @@
|
||||
From 75f03f036011003c2a9e8e634ca3ce7930873318 Mon Sep 17 00:00:00 2001
|
||||
From: Karel Zak <kzak@redhat.com>
|
||||
Date: Mon, 22 Oct 2012 10:10:55 +0200
|
||||
Subject: [PATCH 09/11] fsck.cramfs: compile with -DINCLUDE_FS_TESTS for make
|
||||
check
|
||||
|
||||
make check
|
||||
sudo su -
|
||||
cd tests
|
||||
./run.sh cramfs
|
||||
|
||||
Signed-off-by: Karel Zak <kzak@redhat.com>
|
||||
---
|
||||
disk-utils/Makemodule.am | 5 +++++
|
||||
tests/commands.sh | 2 +-
|
||||
2 files changed, 6 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/disk-utils/Makemodule.am b/disk-utils/Makemodule.am
|
||||
index f2360bf..b329a99 100644
|
||||
--- a/disk-utils/Makemodule.am
|
||||
+++ b/disk-utils/Makemodule.am
|
||||
@@ -97,6 +97,11 @@ fsck_cramfs_LDADD = $(LDADD) -lz libcommon.la
|
||||
sbin_PROGRAMS += mkfs.cramfs
|
||||
mkfs_cramfs_SOURCES = disk-utils/mkfs.cramfs.c $(cramfs_common_sources)
|
||||
mkfs_cramfs_LDADD = $(LDADD) -lz libcommon.la
|
||||
+
|
||||
+check_PROGRAMS += test_fsck.cramfs
|
||||
+test_fsck_cramfs_SOURCES = $(fsck_cramfs_SOURCES)
|
||||
+test_fsck_cramfs_LDADD = $(fsck_cramfs_LDADD)
|
||||
+test_fsck_cramfs_CFLAGS = $(AM_CFLAGS) -DINCLUDE_FS_TESTS
|
||||
endif
|
||||
|
||||
|
||||
diff --git a/tests/commands.sh b/tests/commands.sh
|
||||
index 8a1577e..db1d4ac 100644
|
||||
--- a/tests/commands.sh
|
||||
+++ b/tests/commands.sh
|
||||
@@ -37,7 +37,7 @@ TS_CMD_LOSETUP=${TS_CMD_LOSETUP:-"$top_builddir/losetup"}
|
||||
TS_CMD_MKSWAP=${TS_CMD_MKSWAP:-"$top_builddir/mkswap"}
|
||||
TS_CMD_MKCRAMFS=${TS_CMD_MKCRAMFS:-"$top_builddir/mkfs.cramfs"}
|
||||
TS_CMD_MKMINIX=${TS_CMD_MKMINIX:-"$top_builddir/mkfs.minix"}
|
||||
-TS_CMD_FSCKCRAMFS=${TS_CMD_FSCKCRAMFS:-"$top_builddir/fsck.cramfs"}
|
||||
+TS_CMD_FSCKCRAMFS=${TS_CMD_FSCKCRAMFS:-"$top_builddir/test_fsck.cramfs"}
|
||||
TS_CMD_FSCKMINIX=${TS_CMD_FSCKMINIX:-"$top_builddir/fsck.minix"}
|
||||
|
||||
TS_CMD_IPCS=${TS_CMD_IPCS:-"$top_builddir/ipcs"}
|
||||
--
|
||||
1.7.11.7
|
||||
|
44
0010-login-fix-compiler-warning-Wunused-result.patch
Normal file
44
0010-login-fix-compiler-warning-Wunused-result.patch
Normal file
@ -0,0 +1,44 @@
|
||||
From ed68f1e2f5609a3f42492df407d62b8fc006ea17 Mon Sep 17 00:00:00 2001
|
||||
From: Karel Zak <kzak@redhat.com>
|
||||
Date: Mon, 22 Oct 2012 13:13:02 +0200
|
||||
Subject: [PATCH 10/11] login: fix compiler warning [-Wunused-result]
|
||||
|
||||
It's probably unnecessary paranoia, but let's check if we're able to
|
||||
restore the original IDs after ~/.hushlogin file check.
|
||||
|
||||
Signed-off-by: Karel Zak <kzak@redhat.com>
|
||||
---
|
||||
login-utils/login.c | 16 ++++++++++------
|
||||
1 file changed, 10 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/login-utils/login.c b/login-utils/login.c
|
||||
index 8ae5266..f5896da 100644
|
||||
--- a/login-utils/login.c
|
||||
+++ b/login-utils/login.c
|
||||
@@ -1031,13 +1031,17 @@ static int get_hushlogin_status(struct passwd *pwd)
|
||||
gid_t egid = getegid();
|
||||
|
||||
sprintf(buf, "%s/%s", pwd->pw_dir, file);
|
||||
- setregid(-1, pwd->pw_gid);
|
||||
- setreuid(0, pwd->pw_uid);
|
||||
- ok = effective_access(buf, O_RDONLY) == 0;
|
||||
- setuid(0); /* setreuid doesn't do it alone! */
|
||||
- setreuid(ruid, 0);
|
||||
- setregid(-1, egid);
|
||||
|
||||
+ if (setregid(-1, pwd->pw_gid) == 0 &&
|
||||
+ setreuid(0, pwd->pw_uid) == 0)
|
||||
+ ok = effective_access(buf, O_RDONLY) == 0;
|
||||
+
|
||||
+ if (setuid(0) != 0 ||
|
||||
+ setreuid(ruid, 0) != 0 ||
|
||||
+ setregid(-1, egid) != 0) {
|
||||
+ syslog(LOG_ALERT, _("hush login status: restore original IDs failed"));
|
||||
+ exit(EXIT_FAILURE);
|
||||
+ }
|
||||
if (ok)
|
||||
return 1; /* enabled by user */
|
||||
}
|
||||
--
|
||||
1.7.11.7
|
||||
|
63
0011-misc-make-readlink-usage-more-robust.patch
Normal file
63
0011-misc-make-readlink-usage-more-robust.patch
Normal file
@ -0,0 +1,63 @@
|
||||
From a3528342bc716ecdabdd86609ae5a3198f560870 Mon Sep 17 00:00:00 2001
|
||||
From: Karel Zak <kzak@redhat.com>
|
||||
Date: Tue, 23 Oct 2012 12:40:39 +0200
|
||||
Subject: [PATCH 11/11] misc: make readlink() usage more robust
|
||||
|
||||
Signed-off-by: Karel Zak <kzak@redhat.com>
|
||||
---
|
||||
misc-utils/lsblk.c | 4 ++--
|
||||
misc-utils/lslocks.c | 2 +-
|
||||
sys-utils/eject.c | 2 +-
|
||||
3 files changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c
|
||||
index cc97c05..9c25dd0 100644
|
||||
--- a/misc-utils/lsblk.c
|
||||
+++ b/misc-utils/lsblk.c
|
||||
@@ -962,7 +962,7 @@ static int get_wholedisk_from_partition_dirent(DIR *dir, const char *dirname,
|
||||
int len;
|
||||
|
||||
if ((len = readlink_at(dirfd(dir), dirname,
|
||||
- d->d_name, path, sizeof(path))) < 0)
|
||||
+ d->d_name, path, sizeof(path) - 1)) < 0)
|
||||
return 0;
|
||||
|
||||
path[len] = '\0';
|
||||
@@ -1075,7 +1075,7 @@ static char *devno_to_sysfs_name(dev_t devno, char *devname, char *buf, size_t b
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- len = readlink(path, buf, buf_size);
|
||||
+ len = readlink(path, buf, buf_size - 1);
|
||||
if (len < 0) {
|
||||
warn(_("%s: failed to read link"), path);
|
||||
return NULL;
|
||||
diff --git a/misc-utils/lslocks.c b/misc-utils/lslocks.c
|
||||
index 45fb6de..495eb80 100644
|
||||
--- a/misc-utils/lslocks.c
|
||||
+++ b/misc-utils/lslocks.c
|
||||
@@ -196,7 +196,7 @@ static char *get_filename_sz(ino_t inode, pid_t pid, size_t *size)
|
||||
continue;
|
||||
|
||||
if ((len = readlink_at(fd, path, dp->d_name,
|
||||
- sym, sizeof(path))) < 1)
|
||||
+ sym, sizeof(sym) - 1)) < 1)
|
||||
goto out;
|
||||
|
||||
*size = sb.st_size;
|
||||
diff --git a/sys-utils/eject.c b/sys-utils/eject.c
|
||||
index 1a5b834..6d0da18 100644
|
||||
--- a/sys-utils/eject.c
|
||||
+++ b/sys-utils/eject.c
|
||||
@@ -837,7 +837,7 @@ static char *get_subsystem(char *chain, char *buf, size_t bufsz)
|
||||
memcpy(chain + len, SUBSYSTEM_LINKNAME, sizeof(SUBSYSTEM_LINKNAME));
|
||||
|
||||
/* try if subsystem symlink exists */
|
||||
- sz = readlink(chain, buf, bufsz);
|
||||
+ sz = readlink(chain, buf, bufsz - 1);
|
||||
|
||||
/* remove last subsystem from chain */
|
||||
chain[len] = '\0';
|
||||
--
|
||||
1.7.11.7
|
||||
|
@ -2,7 +2,7 @@
|
||||
Summary: A collection of basic system utilities
|
||||
Name: util-linux
|
||||
Version: 2.22.1
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
License: GPLv2 and GPLv2+ and GPLv3+ and LGPLv2+ and BSD with advertising and Public Domain
|
||||
Group: System Environment/Base
|
||||
URL: http://en.wikipedia.org/wiki/Util-linux
|
||||
@ -83,6 +83,23 @@ Patch3: util-linux-ng-2.21-login-lastlog.patch
|
||||
# 231192 - ipcs is not printing correct values on pLinux
|
||||
Patch4: util-linux-2.21-ipcs-32bit.patch
|
||||
|
||||
|
||||
### Upstream patches from proposed stable/v2.22.2 branch
|
||||
### (remove after update to the final 2.22.2)
|
||||
###
|
||||
Patch101: 0001-libmount-don-t-use-umount-optimization-for-l-or-f.patch
|
||||
Patch102: 0002-wipefs-use-O_EXCL.patch
|
||||
Patch103: 0003-swapon-remove-loop-declaration-smatch-scan.patch
|
||||
Patch104: 0004-libblkid-fix-compiler-warning-Wstrict-aliasing.patch
|
||||
Patch105: 0005-mount-add-c-abbreviation-for-no-canonicalize-to-man-.patch
|
||||
Patch106: 0006-mount-add-long-options-for-L-and-U-to-man-page.patch
|
||||
Patch107: 0007-lib-loopdev-improve-debug-messages.patch
|
||||
Patch108: 0008-lib-loopdev-check-for-sys.patch
|
||||
Patch109: 0009-fsck.cramfs-compile-with-DINCLUDE_FS_TESTS-for-make-.patch
|
||||
Patch110: 0010-login-fix-compiler-warning-Wunused-result.patch
|
||||
Patch111: 0011-misc-make-readlink-usage-more-robust.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,6 +216,18 @@ cp %{SOURCE8} %{SOURCE9} .
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
|
||||
%patch101 -p1
|
||||
%patch102 -p1
|
||||
%patch103 -p1
|
||||
%patch104 -p1
|
||||
%patch105 -p1
|
||||
%patch106 -p1
|
||||
%patch107 -p1
|
||||
%patch108 -p1
|
||||
%patch109 -p1
|
||||
%patch110 -p1
|
||||
%patch111 -p1
|
||||
|
||||
%build
|
||||
unset LINGUAS || :
|
||||
|
||||
@ -725,6 +754,10 @@ fi
|
||||
|
||||
|
||||
%changelog
|
||||
* Thu Nov 1 2012 Karel Zak <kzak@redhat.com> 2.22.1-2
|
||||
- apply pathes from upstream stable/v2.22 branch
|
||||
- fix #865961 - wipefs -a should use O_EXCL
|
||||
|
||||
* Thu Oct 10 2012 Karel Zak <kzak@redhat.com> 2.22.1-1
|
||||
- upgrade to the release 2.22.1
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user