diff options
author | Theodore Ts'o <tytso@mit.edu> | 2017-09-06 21:13:09 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2017-09-06 21:13:09 -0400 |
commit | 364959c39447cf3c5474debd0e432e1c3e96cc71 (patch) | |
tree | bf31fa75432fa07eae6d177c2a1b52d0692d8f29 | |
parent | c8fd5f2338c743f0bfd468999820c318a45ab737 (diff) | |
parent | 7488c6b08df7081c1120f6f7f0c5b186a5121a44 (diff) | |
download | e2fsprogs-364959c39447cf3c5474debd0e432e1c3e96cc71.tar.gz |
Merge branch 'maint' into next
-rw-r--r-- | debian/control.in | 19 | ||||
-rwxr-xr-x | debian/rules | 37 | ||||
-rw-r--r-- | e2fsck/super.c | 31 | ||||
-rw-r--r-- | lib/ext2fs/openfs.c | 12 |
4 files changed, 70 insertions, 29 deletions
diff --git a/debian/control.in b/debian/control.in index 32703c67b..683f63e94 100644 --- a/debian/control.in +++ b/debian/control.in @@ -6,7 +6,6 @@ Build-Depends: gettext, texinfo, pkg-config, libfuse-dev [linux-any kfreebsd-any Standards-Version: 4.0.0 Homepage: http://e2fsprogs.sourceforge.net -ifdef(`FUSE2FS',`` Package: fuse2fs Priority: optional Depends: ${shlibs:Depends}, ${misc:Depends} @@ -15,13 +14,12 @@ Description: ext2 / ext3 / ext4 file system driver for FUSE fuse2fs is a FUSE file system client that supports reading and writing from devices or image files containing ext2, ext3, and ext4 file systems. -'')dnl ifdef(`E2FSCK_STATIC',`` Package: e2fsck-static Priority: optional Depends: ${misc:Depends} -Recommends: sash | bash-static | zsh-static | busybox-static | zsh30-static +Recommends: sash | bash-static | zsh-static | busybox-static Architecture: any Description: statically-linked version of the ext2/ext3/ext4 filesystem checker This may be of some help to you if your filesystem gets corrupted enough @@ -35,10 +33,10 @@ Description: statically-linked version of the ext2/ext3/ext4 filesystem checker '')dnl Package: e2fsprogs-l10n -Priority: extra -Depends: e2fsprogs (= ${binary:Version}) +Priority: optional +Depends: e2fsprogs (= ${binary:Version}), ${misc:Depends} Replaces: e2fsprogs (<< 1.43.5-1) -Architecture: any +Architecture: all Description: ext2/ext3/ext4 file system utilities - translations The ext2, ext3 and ext4 file systems are successors of the original ext ("extended") file system. They are the main file system types used for @@ -62,7 +60,7 @@ Description: common error description library Package: comerr-dev Section: libdevel -Priority: extra +Priority: optional Depends: libc6-dev | libc-dev, libcomerr2 (= ${mainBinary}), ${misc:Depends} Suggests: doc-base Replaces: e2fslibs-dev (<< 1.33-2), libkrb5-dev (<< 1.3) @@ -90,7 +88,7 @@ Description: command-line interface parsing library Package: ss-dev Section: libdevel -Priority: extra +Priority: optional Depends: libc6-dev | libc-dev, libss2 (= ${mainBinary}), comerr-dev, ${misc:Depends} Architecture: any Description: command-line interface parsing library - headers and static libraries @@ -137,7 +135,7 @@ Description: ext2/ext3/ext4 file system libraries Package: e2fslibs-dev Section: libdevel -Priority: extra +Priority: optional Depends: libc6-dev | libc-dev, comerr-dev, e2fslibs (= ${binary:Version}), ${misc:Depends} Suggests: doc-base Provides: ext2fs-dev, e2p-dev @@ -155,7 +153,8 @@ Package: e2fsprogs Essential: yes Pre-Depends: ${shlibs:Depends}, ${misc:Depends}, libblkid1, libuuid1 Multi-Arch: foreign -Suggests: gpart, parted, fuse2fs, e2fsck-static, e2fsprogs-l10n +Suggests: gpart, parted, fuse2fs, e2fsck-static +Recommends: e2fsprogs-l10n Architecture: any Description: ext2/ext3/ext4 file system utilities The ext2, ext3 and ext4 file systems are successors of the original ext diff --git a/debian/rules b/debian/rules index 903c77c55..81eafc315 100755 --- a/debian/rules +++ b/debian/rules @@ -22,11 +22,12 @@ DEB_HOST_OS ?= $(shell dpkg-architecture -qDEB_HOST_OS) DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) +DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS) # Allow distro-specific behaviour DISTRO :=$(shell sed -ne '/DISTRIB_ID/s/.*=//p' /etc/lsb-release 2>/dev/null || echo Debian) -ifeq ($(DEB_BUILD_GNU_SYSTEM), gnu) +ifeq ($(DEB_HOST_ARCH_OS), hurd) SKIP_FUSE2FS=yes endif @@ -146,7 +147,7 @@ endif BACKTRACE_CONF_FLAGS ?= $(shell if ${debdir}/scripts/test-backtrace ; then echo --disable-backtrace ; fi) -COMMON_CONF_FLAGS = --disable-e2initrd-helper --enable-quota \ +COMMON_CONF_FLAGS = --disable-e2initrd-helper \ --infodir=/usr/share/info --enable-symlink-install \ --with-multiarch=$(DEB_HOST_MULTIARCH) \ $(BACKTRACE_CONF_FLAGS) $(UTIL_CONF_FLAGS) @@ -180,12 +181,6 @@ else M4_ARGS+=-UUDEB_PKGS endif -ifeq ($(SKIP_FUSE2FS),) -M4_ARGS+=-DFUSE2FS -else -M4_ARGS+=-UFUSE2FS -endif - debian-files: debian/control mrproper: clean @@ -333,7 +328,7 @@ ifneq ($(BUILD_E2FSCK_STATIC),no) cp ${mandir}/man8/e2fsck.8 ${mandir}/man8/e2fsck.static.8 endif -ifeq ($(DEB_BUILD_GNU_SYSTEM), gnu) +ifeq ($(DEB_HOST_ARCH_OS), hurd) ${INSTALL} -m 0644 misc/mke2fs-hurd.conf ${tmpdir}/etc/mke2fs.conf endif @@ -364,10 +359,22 @@ install-udeb: build ln -sf mke2fs mkfs.ext2 ; ln -sf mke2fs mkfs.ext3 ; \ ln -sf mke2fs mkfs.ext4) -binary-indep: - # no arch-independant debs. - -binary-arch: DH_OPTIONS= -a +binary-indep: install + dh_testdir + dh_testroot + dh_lintian -i + dh_installchangelogs -i + dh_fixperms -i + dh_compress -i + dh_installdeb -i + dh_gencontrol -i + dh_md5sums -i + dh_builddeb -i + +# binary-arch builds a superset of binary-indep. This is because +# building e2fsprogs-l10n.deb unnecessarily takes less time than +# running the install recipe twice. At some point when we rototill +# the rules file we can clean this up in a better way. binary-arch: install $(INSTALL_UDEB) dh_testdir dh_testroot @@ -470,7 +477,9 @@ endif dh_md5sums dh_builddeb -binary: binary-indep binary-arch +# binary-arch builds a superset of binary-indep. See the comment +# before the binary-arch rule for more details. +binary: binary-arch .PHONY: binary binary-arch binary-indep clean checkroot mrproper \ debug_flags debian-files diff --git a/e2fsck/super.c b/e2fsck/super.c index 8153f2bfe..47c89c56f 100644 --- a/e2fsck/super.c +++ b/e2fsck/super.c @@ -41,6 +41,23 @@ static void check_super_value(e2fsck_t ctx, const char *descr, } } +static void check_super_value64(e2fsck_t ctx, const char *descr, + __u64 value, int flags, + __u64 min_val, __u64 max_val) +{ + struct problem_context pctx; + + if ((flags & MIN_CHECK && value < min_val) || + (flags & MAX_CHECK && value > max_val) || + (flags & LOG2_CHECK && (value & (value - 1)) != 0)) { + clear_problem_context(&pctx); + pctx.num = value; + pctx.str = descr; + fix_problem(ctx, PR_0_MISC_CORRUPT_SUPER, &pctx); + ctx->flags |= E2F_FLAG_ABORT; /* never get here! */ + } +} + /* * helper function to release an inode */ @@ -468,6 +485,7 @@ void check_super_block(e2fsck_t ctx) problem_t problem; blk64_t blocks_per_group = fs->super->s_blocks_per_group; __u32 bpg_max, cpg_max; + __u64 blks_max; int inodes_per_block; int inode_size; int accept_time_fudge; @@ -497,6 +515,15 @@ void check_super_block(e2fsck_t ctx) ctx->invalid_inode_table_flag = (int *) e2fsck_allocate_memory(ctx, sizeof(int) * fs->group_desc_count, "invalid_inode_table"); + blks_max = (1ULL << 32) * EXT2_MAX_BLOCKS_PER_GROUP(fs->super); + if (ext2fs_has_feature_64bit(fs->super)) { + if (blks_max > ((1ULL << 48) - 1)) + blks_max = (1ULL << 48) - 1; + } else { + if (blks_max > ((1ULL << 32) - 1)) + blks_max = (1ULL << 32) - 1; + } + clear_problem_context(&pctx); /* @@ -504,8 +531,8 @@ void check_super_block(e2fsck_t ctx) */ check_super_value(ctx, "inodes_count", sb->s_inodes_count, MIN_CHECK, 1, 0); - check_super_value(ctx, "blocks_count", ext2fs_blocks_count(sb), - MIN_CHECK, 1, 0); + check_super_value64(ctx, "blocks_count", ext2fs_blocks_count(sb), + MIN_CHECK | MAX_CHECK, 1, blks_max); check_super_value(ctx, "first_data_block", sb->s_first_data_block, MAX_CHECK, 0, ext2fs_blocks_count(sb)); check_super_value(ctx, "log_block_size", sb->s_log_block_size, diff --git a/lib/ext2fs/openfs.c b/lib/ext2fs/openfs.c index da03bc147..f74cd2458 100644 --- a/lib/ext2fs/openfs.c +++ b/lib/ext2fs/openfs.c @@ -122,6 +122,7 @@ errcode_t ext2fs_open2(const char *name, const char *io_options, char *dest, *cp; int group_zero_adjust = 0; int inode_size; + __u64 groups_cnt; #ifdef WORDS_BIGENDIAN unsigned int groups_per_block; struct ext2_group_desc *gdp; @@ -371,9 +372,14 @@ errcode_t ext2fs_open2(const char *name, const char *io_options, retval = EXT2_ET_CORRUPT_SUPERBLOCK; goto cleanup; } - fs->group_desc_count = ext2fs_div64_ceil(ext2fs_blocks_count(fs->super) - - fs->super->s_first_data_block, - blocks_per_group); + groups_cnt = ext2fs_div64_ceil(ext2fs_blocks_count(fs->super) - + fs->super->s_first_data_block, + blocks_per_group); + if (groups_cnt >> 32) { + retval = EXT2_ET_CORRUPT_SUPERBLOCK; + goto cleanup; + } + fs->group_desc_count = groups_cnt; if (fs->group_desc_count * EXT2_INODES_PER_GROUP(fs->super) != fs->super->s_inodes_count) { retval = EXT2_ET_CORRUPT_SUPERBLOCK; |