Package: e2fsprogs
Version: 1.42.12-1
Severity: normal
Tags: patch

Dear Maintainer,

e2fsck accesses the field osd2.linux2.l_i_file_acl_high field without
checking that the filesystem is indeed created for Linux.  This leads
to e2fsck constantly complaining about certain nodes:

i_file_acl_hi for inode XXX (/dev/console) is 32, should be zero.

By "correcting" this problem, e2fsck clobbers the field
osd2.hurd2.h_i_mode_high.

A patch is attached that properly guards access to the OS dependent
fields.

Thanks,
Justus

-- System Information:
Debian Release: jessie/sid
  APT prefers unreleased
  APT policy: (500, 'unreleased'), (500, 'unstable')
Architecture: hurd-i386 (i686-AT386)

Kernel: GNU-Mach 1.4-486-dbg/Hurd-0.5
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages e2fsprogs depends on:
ii  e2fslibs    1.42.11-1
ii  libblkid1   2.20.1-5.8
ii  libc0.3     2.19-10
ii  libcomerr2  1.42.11-1
ii  libss2      1.42.11-1
ii  libuuid1    2.20.1-5.8
ii  util-linux  2.20.1-5.8

e2fsprogs recommends no packages.

Versions of packages e2fsprogs suggests:
pn  e2fsck-static  <none>
pn  gpart          <none>
pn  parted         <none>

-- no debconf information
>From be14c28db9db5c528ebb746259ebe6957761f559 Mon Sep 17 00:00:00 2001
From: Justus Winter <[email protected]>
Date: Tue, 2 Sep 2014 12:55:53 +0200
Subject: [PATCH] e2fsck: fix corruption of Hurd filesystems

Previously, e2fsck accessed the field osd2.linux2.l_i_file_acl_high
field without checking that the filesystem is indeed created for
Linux.  This lead to e2fsck constantly complaining about certain
nodes:

i_file_acl_hi for inode XXX (/dev/console) is 32, should be zero.

By "correcting" this problem, e2fsck would clobber the field
osd2.hurd2.h_i_mode_high.

Properly guard access to the OS dependent fields.
---
 e2fsck/pass1.c | 14 ++++++++------
 e2fsck/pass2.c |  3 ++-
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c
index 50a8b99..3bf481f 100644
--- a/e2fsck/pass1.c
+++ b/e2fsck/pass1.c
@@ -1082,7 +1082,8 @@ void e2fsck_pass1(e2fsck_t ctx)
 		if (inode->i_faddr || frag || fsize ||
 		    (LINUX_S_ISDIR(inode->i_mode) && inode->i_dir_acl))
 			mark_inode_bad(ctx, ino);
-		if (!(fs->super->s_feature_incompat & 
+		if ((fs->super->s_creator_os == EXT2_OS_LINUX) &&
+		    !(fs->super->s_feature_incompat &
 		      EXT4_FEATURE_INCOMPAT_64BIT) &&
 		    inode->osd2.linux2.l_i_file_acl_high != 0)
 			mark_inode_bad(ctx, ino);
@@ -2354,11 +2355,12 @@ static void check_blocks(e2fsck_t ctx, struct problem_context *pctx,
 	if (LINUX_S_ISREG(inode->i_mode) &&
 	    ext2fs_needs_large_file_feature(EXT2_I_SIZE(inode)))
 		ctx->large_files++;
-	if ((pb.num_blocks != ext2fs_inode_i_blocks(fs, inode)) ||
-	    ((fs->super->s_feature_ro_compat &
-	      EXT4_FEATURE_RO_COMPAT_HUGE_FILE) &&
-	     (inode->i_flags & EXT4_HUGE_FILE_FL) &&
-	     (inode->osd2.linux2.l_i_blocks_hi != 0))) {
+	if ((fs->super->s_creator_os == EXT2_OS_LINUX) &&
+	    ((pb.num_blocks != ext2fs_inode_i_blocks(fs, inode)) ||
+	     ((fs->super->s_feature_ro_compat &
+	       EXT4_FEATURE_RO_COMPAT_HUGE_FILE) &&
+	      (inode->i_flags & EXT4_HUGE_FILE_FL) &&
+	      (inode->osd2.linux2.l_i_blocks_hi != 0)))) {
 		pctx->num = pb.num_blocks;
 		if (fix_problem(ctx, PR_1_BAD_I_BLOCKS, pctx)) {
 			inode->i_blocks = pb.num_blocks;
diff --git a/e2fsck/pass2.c b/e2fsck/pass2.c
index 2b7bff4..143cf38 100644
--- a/e2fsck/pass2.c
+++ b/e2fsck/pass2.c
@@ -1364,7 +1364,8 @@ int e2fsck_process_bad_inode(e2fsck_t ctx, ext2_ino_t dir,
 		}
 	}
 
-	if (!(fs->super->s_feature_incompat & 
+	if ((fs->super->s_creator_os == EXT2_OS_LINUX) &&
+	    !(fs->super->s_feature_incompat &
 	     EXT4_FEATURE_INCOMPAT_64BIT) &&
 	    inode.osd2.linux2.l_i_file_acl_high != 0) {
 		pctx.num = inode.osd2.linux2.l_i_file_acl_high;
-- 
2.1.0

Reply via email to