diff options
author | Nicolas Iooss | 2014-04-24 11:56:08 +0200 |
---|---|---|
committer | Nicolas Iooss | 2015-06-27 11:44:55 +0800 |
commit | 7730817ab25d87856acbd8b882a6630a6b29a4eb (patch) | |
tree | 34549fe700cdda68b9df9bfdbcf485c96c85fcf8 /0001-switch_root-verify-initramfs-by-f_type-not-devno.patch | |
parent | bc3a70c1713241761bcbf11c58dadb1448cd234f (diff) | |
download | aur-7730817ab25d87856acbd8b882a6630a6b29a4eb.tar.gz |
util-linux-selinux 2.24.1-4 update
Apply changes from:
https://projects.archlinux.org/svntogit/packages.git/log/trunk?h=packages/util-linux
Diffstat (limited to '0001-switch_root-verify-initramfs-by-f_type-not-devno.patch')
-rw-r--r-- | 0001-switch_root-verify-initramfs-by-f_type-not-devno.patch | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/0001-switch_root-verify-initramfs-by-f_type-not-devno.patch b/0001-switch_root-verify-initramfs-by-f_type-not-devno.patch new file mode 100644 index 000000000000..56191a30e760 --- /dev/null +++ b/0001-switch_root-verify-initramfs-by-f_type-not-devno.patch @@ -0,0 +1,59 @@ +From 751c39383adaf5ff5a860516238d524b0e20f835 Mon Sep 17 00:00:00 2001 +From: Dave Reisner <dreisner@archlinux.org> +Date: Wed, 2 Apr 2014 10:41:30 -0400 +Subject: [PATCH] switch_root: verify initramfs by f_type, not devno + +As of linux 3.14, the initramfs device will have both major and +minor 0, causing our paranoia check to fail. Make this version agnostic +by checking the filesystem type, rather than a device number. + +[adopted from master for backport into 2.24.x branch] + +Signed-off-by: Dave Reisner <dreisner@archlinux.org> +--- + sys-utils/switch_root.c | 15 +++++++++------ + 1 file changed, 9 insertions(+), 6 deletions(-) + +diff --git a/sys-utils/switch_root.c b/sys-utils/switch_root.c +index f26f7da..40e222d 100644 +--- a/sys-utils/switch_root.c ++++ b/sys-utils/switch_root.c +@@ -23,6 +23,7 @@ + #include <sys/mount.h> + #include <sys/types.h> + #include <sys/stat.h> ++#include <sys/statfs.h> + #include <sys/param.h> + #include <fcntl.h> + #include <stdio.h> +@@ -33,6 +34,8 @@ + #include <ctype.h> + #include <dirent.h> + ++#include <linux/magic.h> ++ + #include "c.h" + #include "nls.h" + #include "closestream.h" +@@ -174,12 +177,12 @@ static int switchroot(const char *newroot) + if (cfd >= 0) { + pid = fork(); + if (pid <= 0) { +- if (fstat(cfd, &sb) == 0) { +- if (sb.st_dev == makedev(0, 1)) +- recursiveRemove(cfd); +- else +- warn(_("old root filesystem is not an initramfs")); +- } ++ struct statfs stfs; ++ if (fstatfs(cfd, &stfs) == 0 && ++ (stfs.f_type == RAMFS_MAGIC || stfs.f_type == TMPFS_MAGIC)) ++ recursiveRemove(cfd); ++ else ++ warn(_("old root filesystem is not an initramfs")); + + if (pid == 0) + exit(EXIT_SUCCESS); +-- +1.9.1 + |