[arch-commits] Commit in util-linux/trunk (2 files)

Dave Reisner dreisner at nymeria.archlinux.org
Fri Apr 4 13:14:06 UTC 2014


    Date: Friday, April 4, 2014 @ 15:14:06
  Author: dreisner
Revision: 209804

upgpkg: util-linux 2.24.1-6

- backport fix for switch_root failure in devno comparison (FS#39734)

Added:
  util-linux/trunk/0001-switch_root-verify-initramfs-by-f_type-not-devno.patch
Modified:
  util-linux/trunk/PKGBUILD

-------------------------------------------------------------+
 0001-switch_root-verify-initramfs-by-f_type-not-devno.patch |   59 ++++++++++
 PKGBUILD                                                    |    5 
 2 files changed, 63 insertions(+), 1 deletion(-)

Added: 0001-switch_root-verify-initramfs-by-f_type-not-devno.patch
===================================================================
--- 0001-switch_root-verify-initramfs-by-f_type-not-devno.patch	                        (rev 0)
+++ 0001-switch_root-verify-initramfs-by-f_type-not-devno.patch	2014-04-04 13:14:06 UTC (rev 209804)
@@ -0,0 +1,59 @@
+From 751c39383adaf5ff5a860516238d524b0e20f835 Mon Sep 17 00:00:00 2001
+From: Dave Reisner <dreisner at 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 at 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
+

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2014-04-04 13:10:29 UTC (rev 209803)
+++ PKGBUILD	2014-04-04 13:14:06 UTC (rev 209804)
@@ -6,7 +6,7 @@
 pkgbase=util-linux
 pkgname=(util-linux libutil-linux)
 pkgver=2.24.1
-pkgrel=5
+pkgrel=6
 pkgdesc="Miscellaneous system utilities for Linux"
 url="http://www.kernel.org/pub/linux/utils/util-linux/"
 arch=('i686' 'x86_64')
@@ -21,6 +21,7 @@
         pam-common
         pam-su
         move_is_mountinfo.patch
+        0001-switch_root-verify-initramfs-by-f_type-not-devno.patch
         0001-libmount-FS-id-and-parent-ID-could-be-zero.patch)
 md5sums=('88d46ae23ca599ac5af9cf96b531590f'
          'a39554bfd65cccfd8254bb46922f4a67'
@@ -28,6 +29,7 @@
          'a31374fef2cba0ca34dfc7078e2969e4'
          'fa85e5cce5d723275b14365ba71a8aad'
          '4cdc5f9a6e51b032274761a82937d438'
+         'b7ca79a0d5318b7cd813bb2573a3f9a9'
          '2f4bc305bd11d6bfaa81e6c1eb0c6f1b')
 
 prepare() {
@@ -35,6 +37,7 @@
 
   patch -p1 -i "${srcdir}/move_is_mountinfo.patch"
   patch -p1 -i "${srcdir}/0001-libmount-FS-id-and-parent-ID-could-be-zero.patch"
+  patch -p1 -i "${srcdir}/0001-switch_root-verify-initramfs-by-f_type-not-devno.patch"
 }
 
 build() {




More information about the arch-commits mailing list