- libext2fs-Fix-fsync-2-detection.patch: libext2fs: Fix fsync(2) detection

(bsc#1038194)
- Add references from old package:
  Fix resize2fs-Fix-32-64-bit-overflow-when-multiplying-by-blocks-cl.patch
  in 1.42.12 (bsc#1009532)
  Fix libext2fs-fix-potential-buffer-overflow-in-closefs.patch
  in 1.42.13 (bsc#918346 CVE-2015-1572)
  Fix libext2fs-avoid-buffer-overflow-if-s_first_meta_bg-i.patch
  in 1.42.12 (bsc#915402 CVE-2015-0247)
  Got specfile fix through Factory (bsc#960273)
  Fix libext2fs-don-t-ignore-fsync-errors.patch in 1.43.4 (bsc#1038194)

Rev SUSE:SLE-12-SP4:GA/2 Md5 9ff012c479fd9bfdaa0270cb441edbaf 2018-06-08 14:13:20 rtsvetkov None
This commit is contained in:
OBS User rtsvetkov 2018-06-08 14:13:20 +00:00 committed by Git OBS Bridge
parent 3e56c90bb6
commit 9c3893cce8
15 changed files with 415 additions and 772 deletions

View File

@ -1,47 +0,0 @@
From ebdf895b43a1ce499e4d2556a201e2a753fc422f Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <tytso@mit.edu>
Date: Wed, 8 Oct 2014 11:18:41 -0400
Subject: [PATCH] e2fsck: fix free pointer dereferences
References: bnc#912229
Commit 47fee2ef6a23a introduces some free pointer dereference bugs by
not clearing ctx->fs after calling ext2fs_close_free().
Reported-by: Matthias Andree <mandree@FreeBSD.org>
Cc: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
e2fsck/unix.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
Index: e2fsprogs-1.42.11/e2fsck/unix.c
===================================================================
--- e2fsprogs-1.42.11.orig/e2fsck/unix.c
+++ e2fsprogs-1.42.11/e2fsck/unix.c
@@ -459,7 +459,7 @@ static void check_if_skip(e2fsck_t ctx)
}
log_out(ctx, "\n");
skip:
- ext2fs_close_free(&fs);
+ ext2fs_close_free(&ctx->fs);
e2fsck_free_context(ctx);
exit(FSCK_OK);
}
@@ -1465,7 +1465,7 @@ failure:
/*
* Restart in order to reopen fs but this time start mmp.
*/
- ext2fs_close_free(&fs);
+ ext2fs_close_free(&ctx->fs);
flags &= ~EXT2_FLAG_SKIP_MMP;
goto restart;
}
@@ -1695,7 +1695,7 @@ no_journal:
_("while resetting context"));
fatal_error(ctx, 0);
}
- ext2fs_close_free(&fs);
+ ext2fs_close_free(&ctx->fs);
goto restart;
}
if (run_result & E2F_FLAG_CANCEL) {

View File

@ -1,34 +0,0 @@
From a82d88ea99d3c5c21bf538b886da0482bf143fd5 Mon Sep 17 00:00:00 2001
From: "Darrick J. Wong" <darrick.wong@oracle.com>
Date: Thu, 24 Jul 2014 21:03:54 -0400
Subject: [PATCH] e2fsck: free ctx->fs, not fs, at the end of fsck
References: bnc#912229
When we call ext2fs_close_free at the end of main(), we need to supply
the address of ctx->fs, because the subsequent e2fsck_free_context
call will try to access ctx->fs (which is now set to a freed block) to
see if it should free the directory block list. This is clearly not
desirable, so fix the problem.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
e2fsck/unix.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/e2fsck/unix.c b/e2fsck/unix.c
index 8d1bdf3e03cb..fc05bdeec257 100644
--- a/e2fsck/unix.c
+++ b/e2fsck/unix.c
@@ -1774,7 +1774,7 @@ no_journal:
io_channel_flush(ctx->fs->io);
print_resource_track(ctx, NULL, &ctx->global_rtrack, ctx->fs->io);
- ext2fs_close_free(&fs);
+ ext2fs_close_free(&ctx->fs);
free(ctx->journal_name);
e2fsck_free_context(ctx);
--
2.1.2

View File

@ -1,188 +0,0 @@
Index: e2fsck/Makefile.in
===================================================================
--- e2fsck/Makefile.in.orig
+++ e2fsck/Makefile.in
@@ -61,7 +61,7 @@ OBJS= crc32.o dict.o unix.o e2fsck.o sup
pass3.o pass4.o pass5.o journal.o badblocks.o util.o dirinfo.o \
dx_dirinfo.o ehandler.o problem.o message.o quota.o recovery.o \
region.o revoke.o ea_refcount.o rehash.o profile.o prof_err.o \
- logfile.o sigcatcher.o $(MTRACE_OBJ)
+ logfile.o sigcatcher.o splash.o $(MTRACE_OBJ)
PROFILED_OBJS= profiled/dict.o profiled/unix.o profiled/e2fsck.o \
profiled/super.o profiled/pass1.o profiled/pass1b.o \
@@ -100,6 +100,7 @@ SRCS= $(srcdir)/e2fsck.c \
$(srcdir)/rehash.c \
$(srcdir)/region.c \
$(srcdir)/profile.c \
+ $(srcdir)/splash.c \
$(srcdir)/sigcatcher.c \
$(srcdir)/logfile.c \
prof_err.c \
@@ -519,6 +520,7 @@ region.o: $(srcdir)/region.c $(top_build
$(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/quotaio.h \
$(top_srcdir)/lib/quota/dqblk_v2.h $(top_srcdir)/lib/quota/quotaio_tree.h \
$(top_srcdir)/lib/../e2fsck/dict.h
+splash.o: $(srcdir)/splash.c $(srcdir)/splash.h
profile.o: $(srcdir)/profile.c $(top_builddir)/lib/config.h \
$(top_builddir)/lib/dirpaths.h $(top_srcdir)/lib/et/com_err.h \
$(srcdir)/profile.h prof_err.h
Index: e2fsck/splash.c
===================================================================
--- /dev/null
+++ e2fsck/splash.c
@@ -0,0 +1,100 @@
+/*
+ * add support for switching the splash screen on boot
+ */
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <errno.h>
+#include "splash.h"
+
+static int verbose = 0;
+
+/* nop implementation
+ */
+static void nop(void)
+{
+}
+
+static struct splash_ops nop_ops = {
+ .splash_on = nop,
+ .splash_off = nop
+};
+
+/*
+ * bootsplash implementation
+ */
+#define BOOTSPLASH_CTL "/proc/splash"
+
+static int bootsplash_exists(void)
+{
+ struct stat sb;
+
+ if (stat(BOOTSPLASH_CTL, &sb) == -1)
+ return 0;
+
+ if (S_ISREG(sb.st_mode))
+ return 1;
+
+ return 0;
+}
+
+/* write msg to splash control */
+static void bootsplash_msg(const char *msg, size_t size)
+{
+ int fd;
+ size_t written;
+
+ fd = open(BOOTSPLASH_CTL, O_WRONLY);
+ if (fd == -1) {
+ if (verbose)
+ printf("cannot open %s\n", BOOTSPLASH_CTL);
+ return;
+ }
+
+ written = write(fd, msg, size);
+ if (written != size) {
+ if (verbose)
+ printf("size = %zd, written = %zd\n", size, written);
+ }
+
+ close(fd);
+}
+
+static void bootsplash_on(void)
+{
+ if (verbose)
+ printf("setting bootsplash silent\n");
+ bootsplash_msg("silent\n", 7);
+}
+
+static void bootsplash_off(void)
+{
+ if (verbose)
+ printf("setting bootsplash verbose\n");
+ bootsplash_msg("verbose\n", 8);
+}
+
+static struct splash_ops bootsplash_ops = {
+ .splash_on = bootsplash_on,
+ .splash_off = bootsplash_off
+};
+
+/*
+ * Initialisation
+ */
+void splash_init(struct splash_ops **ops)
+{
+ if (bootsplash_exists())
+ *ops = &bootsplash_ops;
+ else
+ *ops = &nop_ops;
+}
+
+void splash_set_verbose(void)
+{
+ verbose = 1;
+}
+
Index: e2fsck/splash.h
===================================================================
--- /dev/null
+++ e2fsck/splash.h
@@ -0,0 +1,13 @@
+#ifndef _SPLASH_H
+#define _SPLASH_H
+
+struct splash_ops {
+ void (*splash_on)(void);
+ void (*splash_off)(void);
+};
+
+void splash_init(struct splash_ops **ops);
+void splash_set_verbose(void);
+
+#endif /* _SPLASH_H */
+
Index: e2fsck/unix.c
===================================================================
--- e2fsck/unix.c.orig
+++ e2fsck/unix.c
@@ -51,6 +51,7 @@ extern int optind;
#include "e2p/e2p.h"
#include "e2fsck.h"
#include "problem.h"
+#include "splash.h"
#include "../version.h"
/* Command line options */
@@ -1177,6 +1178,7 @@ int main (int argc, char *argv[])
e2fsck_t ctx;
blk64_t orig_superblock;
struct problem_context pctx;
+ struct splash_ops *sops;
int flags, run_result;
int journal_size;
int sysval, sys_page_size = 4096;
@@ -1215,6 +1217,7 @@ int main (int argc, char *argv[])
exit(FSCK_ERROR);
}
reserve_stdio_fds();
+ splash_init(&sops);
set_up_logging(ctx);
if (ctx->logf) {
@@ -1590,6 +1593,7 @@ print_unsupp_features:
fatal_error(ctx, 0);
check_if_skip(ctx);
check_resize_inode(ctx);
+ sops->splash_off();
if (bad_blocks_file)
read_bad_blocks_file(ctx, bad_blocks_file, replace_bad_blocks);
else if (cflag)

View File

@ -1,10 +1,10 @@
Index: lib/ext2fs/ext2fs.h
===================================================================
--- lib/ext2fs/ext2fs.h.orig 2012-06-04 18:42:23.000000000 +0200
+++ lib/ext2fs/ext2fs.h 2012-06-14 09:53:19.190709779 +0200
@@ -53,6 +53,7 @@ extern "C" {
#include <stdlib.h>
--- lib/ext2fs/ext2fs.h.orig
+++ lib/ext2fs/ext2fs.h
@@ -62,6 +62,7 @@ extern "C" {
#include <string.h>
#include <time.h>
#include <errno.h>
+#include <unistd.h>

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4bd8a770b6925c3f4ec5dce82c55774e4566cd6f3ffb5805177e3c92c8910b76
size 6353078

3
e2fsprogs-1.43.8.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6f831e372afeabc188d3e87dba9d8ff48f9f24cf3c5e354dcfa525ae9381dc27
size 7474876

View File

@ -1,56 +1,211 @@
-------------------------------------------------------------------
Wed Jun 7 13:06:21 UTC 2017 - jack@suse.cz
- libext2fs-don-t-ignore-fsync-errors.patch: libext2fs: don't ignore fsync
errors (bsc#1038194)
-------------------------------------------------------------------
Wed May 31 13:34:50 UTC 2017 - jack@suse.cz
Fri Jun 1 16:31:22 UTC 2018 - jack@suse.cz
- libext2fs-Fix-fsync-2-detection.patch: libext2fs: Fix fsync(2) detection
(bsc#1038194)
-------------------------------------------------------------------
Thu Nov 24 15:41:57 UTC 2016 - jack@suse.cz
Fri Jun 1 15:57:14 UTC 2018 - jack@suse.cz
- resize2fs-Fix-32-64-bit-overflow-when-multiplying-by-blocks-cl.patch: Fix
32/64-bit overflow when multiplying by blocks/clusters per group
(bsc#1009532)
- Add references from old package:
Fix resize2fs-Fix-32-64-bit-overflow-when-multiplying-by-blocks-cl.patch
in 1.42.12 (bsc#1009532)
Fix libext2fs-fix-potential-buffer-overflow-in-closefs.patch
in 1.42.13 (bsc#918346 CVE-2015-1572)
Fix libext2fs-avoid-buffer-overflow-if-s_first_meta_bg-i.patch
in 1.42.12 (bsc#915402 CVE-2015-0247)
Got specfile fix through Factory (bsc#960273)
Fix libext2fs-don-t-ignore-fsync-errors.patch in 1.43.4 (bsc#1038194)
-------------------------------------------------------------------
Thu Aug 11 09:13:57 UTC 2016 - jack@suse.cz
Wed Jan 24 14:41:11 UTC 2018 - jack@suse.cz
- Update spec file to regenerate initrd when e2fsprogs is updated or
uninstalled (bsc#960273)
- libext2fs-fix-build-failure-in-swapfs.c-on-big-endia.patch:
libext2fs: fix build failure in swapfs.c on big-endian systems (bsc#1077420)
-------------------------------------------------------------------
Tue May 26 11:42:47 UTC 2015 - jack@suse.cz
Tue Jan 9 10:16:04 UTC 2018 - jack@suse.cz
- libext2fs-fix-potential-buffer-overflow-in-closefs.patch: libext2fs: fix
potential buffer overflow in closefs() (bsc#918346 CVE-2015-1572)
- Update to 1.43.8
* add forgotten byteswap of some new superblock fields
* fix use-after-free in e2fsck for corrupted root inode
* fix floating point exception due to corrupted superblock in e2fsck
* fix resize2fs's free block sanity checks
* updated translations
-------------------------------------------------------------------
Tue May 26 11:30:53 UTC 2015 - jack@suse.cz
Tue Nov 14 09:49:57 UTC 2017 - jack@suse.cz
- libext2fs-avoid-buffer-overflow-if-s_first_meta_bg-i.patch: libext2fs:
avoid buffer overflow if s_first_meta_bg is too big (bsc#915402 CVE-2015-0247)
- Added %license tag to specfile
-------------------------------------------------------------------
Fri Jan 9 09:05:27 UTC 2015 - jack@suse.cz
Tue Nov 7 09:23:56 UTC 2017 - jack@suse.cz
- e2fsck-fix-free-pointer-dereferences.patch:
e2fsck-free-ctx-fs-not-fs-at-the-end-of-fsck.patch:
Fix use after free issues (bnc#912229)
- Update to 1.43.7
* debugfs, tune2fs, fuse2fs fixes of error handling in journal replay
* e2fsck and debugfs fixes so that malicious filesystems do not cause
buffer overflows
* fix corner cases in offline resizing in resize2fs
* updated translations
-------------------------------------------------------------------
Mon Jul 21 17:54:46 UTC 2014 - jack@suse.cz
Mon Sep 18 14:42:48 CEST 2017 - ro@suse.de
- ignore errors for install-info calls in post scripts,
otherwise installing with "--excludedocs" fails
-------------------------------------------------------------------
Tue Sep 5 15:33:16 UTC 2017 - jack@suse.cz
- Update to 1.43.6
* fix printing of quota inconsistency messages
* fix out of bounds checks in e2fsck
* optimize e2fsck CPU usage for large sparse files
* increase inode size to 256 bytes if features require it
* various UI fixes
* updated translations
-------------------------------------------------------------------
Mon Aug 28 13:42:33 UTC 2017 - mmarek@suse.com
- Add missing coreutils dependency for initrd macros (bsc#1055492).
-------------------------------------------------------------------
Mon Aug 21 13:14:25 UTC 2017 - jack@suse.cz
- Update to 1.43.5
* fix e2fsck infinite loop when rebuilding encrypted directories
* fix tune2fs support for enabling /disabling project quota
* fixes in debugfs, dumpe2fs, e2fsck, tune2fs, and resize2fs for maliciously
corrupted filesystems
* fix e2fsck to verify invalid quota inode numbers
* fix byte-swapping of backup superblocks
* fix e2fsck -E bmap2extent to work for sparse files
* fix e2fsck to correctly handle quota accounting for multiply claimed blocks
* lots of other fixes
-------------------------------------------------------------------
Fri Mar 3 09:47:06 UTC 2017 - jack@suse.cz
- Update to 1.43.4
* fix e2fsck handling of system.data extended attributes for small files
* fixes in mke2fs -d
* make mke2fs refuse absurdly large devices
* make mke2fs properly report IO errors
* clarify default in mke2fs questions
* re-add uninit_bg to mke2fs.conf
* add support for project quota to debugfs
* improve xattr support in debugfs
* remove mkfs.ext4dev and fsck.ext4dev
-------------------------------------------------------------------
Mon Oct 3 12:02:04 UTC 2016 - jack@suse.cz
- Remove suse-module-tools dependency as it creates cycle in dependency list
-------------------------------------------------------------------
Tue Sep 27 12:41:57 UTC 2016 - jack@suse.cz
- Update download URL to poing to ftp.kernel.org which is more reliable
-------------------------------------------------------------------
Mon Sep 26 12:56:47 UTC 2016 - jack@suse.cz
- Update to 1.43.3
* mke2fs will use larger journal for large filesystems by default
* e2fsck journal replay bugfixes
* debugfs improvements and fixes
* fix resize2fs migration of attribute blocks
- fuse2fs manpage is no longer installed when fuse2fs is not built
-------------------------------------------------------------------
Mon Sep 12 11:02:14 UTC 2016 - dmueller@suse.com
- fix last change
-------------------------------------------------------------------
Sat Jul 23 18:24:39 UTC 2016 - crrodriguez@opensuse.org
- Rebuild the initrd if this package changes (and we are not
building the -mini version)
-------------------------------------------------------------------
Mon Jun 20 14:58:12 UTC 2016 - jack@suse.cz
- Update to 1.43.1
* Add support for the ext4 metadata checksum, checksum seed, inline data,
encryption, project quota, and read-only features
* Support for the very old, experimental, and never-added-to-mainline
compression feature has been removed
* Mke2fs will now create file systems with the metadata_csum and 64bit
features enabled by default
* The tune2fs program will ask the user for confirmation before starting
dangerous operations if the terminal is available, and it will replay
the journal if necessary
* Add an ext2/3/4 FUSE server
* The resize2fs command can now convert file systems between 64-bit and
32-bit mode
* We now use a new e2undo file format which is much more efficient and
faster than the old tdb-based scheme. Since it so much faster, e2fsck,
tune2fs, debugfs, and resize2fs now also can support using creating an
undo file.
* Multiple e2fsck fixes
* Multiple mke2fs improvements
* Multiple debugfs improvements
-------------------------------------------------------------------
Fri Aug 7 00:00:00 CEST 2015 - dsterba@suse.com
- spec: add static library dependencies
-------------------------------------------------------------------
Mon Jul 27 00:00:00 CEST 2015 - dsterba@suse.com
- enable static build and package static libraries
-------------------------------------------------------------------
Sat Jun 20 23:33:05 UTC 2015 - crrodriguez@opensuse.org
- e2fsprogs-1.41.1-splash_support.patch: Drop it, this patch
depends on the old in kernel "bootsplash" patches that were
removed after the introduction of plymouth.
-------------------------------------------------------------------
Tue May 26 12:15:35 UTC 2015 - jack@suse.cz
- Update to 1.42.13
* fix potential buffer overflow while closing a filesystem
* fix deadlock which occurs when using systemd and e2fsck.conf's logging
feature
* make tune2fs clear journal superblock backup when removing journal
* fix use after free bugs in resize2fs and e2fsck
* fix endianity bugs in libext2fs
...
- Remove e2fsck-fix-free-pointer-dereferences.patch: Merged upstream
-------------------------------------------------------------------
Fri Jan 9 08:48:40 UTC 2015 - jack@suse.cz
- e2fsck-fix-free-pointer-dereferences.patch: Fix use after free (bnc#912229)
-------------------------------------------------------------------
Tue Sep 2 13:39:35 UTC 2014 - jack@suse.cz
- Update to 1.42.12
* fix e2fsck bugs when repairing bigalloc filesystems
* fix rare e2fsck bugs discovered by fs fuzzing
* resize2fs will use less memory when resizing large filesystems
...
-------------------------------------------------------------------
Tue Jul 15 15:52:16 UTC 2014 - jack@suse.cz
- Remove e2fsck.conf since we don't need the changed default anymore. e2fsck
handles this type of problems automatically now and broken_system_clock has
other undesired sideeffects like skipped periodic checks (bnc#866283)
-------------------------------------------------------------------
Mon Jul 21 17:53:39 UTC 2014 - jack@suse.cz
Tue Jul 15 15:43:06 UTC 2014 - jack@suse.cz
- Update to 1.42.11
* fix aborted journal replay in e2fsck with bigalloc
@ -60,19 +215,24 @@ Mon Jul 21 17:53:39 UTC 2014 - jack@suse.cz
* mke2fs asks before wiping preexisting filesystem
* mke2fs can create filesystems with all metadata in the beginning
* fix resize2fs shrink operation in some corner cases
* fix quota handling in e2fsck
...
- Remove filefrag-print-shared-extent-flag.patch: Merged upstream
-------------------------------------------------------------------
Thu Apr 17 21:49:40 UTC 2014 - mfasheh@suse.com
Mon Apr 28 17:45:46 UTC 2014 - mfasheh@suse.com
- Add filefrag-print-shared-extent-flag.patch: let's filefrag print shared
- Add filefrag-print-shared-extent-flag.patch: lets filefrag print shared
extent flag when it gets it. Helps with fate#316317 / bnc#868847. Patch
sent to upstream 4/17/2014.
-------------------------------------------------------------------
Tue Feb 4 00:08:18 UTC 2014 - jack@suse.cz
Mon Jan 27 13:05:33 UTC 2014 - jack@suse.cz
- Removed "-mini" spec file for now as it is causing troubles in Factory
and according to Coolo may not be needed after all.
-------------------------------------------------------------------
Mon Jan 27 09:22:23 UTC 2014 - jack@suse.cz
- update to 1.42.9
* fixes in resize2fs, e2fsck, debugfs, and libext2fs to correctly handle
@ -83,11 +243,20 @@ Tue Feb 4 00:08:18 UTC 2014 - jack@suse.cz
* fix tune2fs to properly update all backup superblocks when disabling quota
feature
* e2image support for efficient copying of filesystems
* fix complaint about uninitialized extents beyond EOF in e2fsck
* fix complaint about uninitialized extents beyond EOF in e2fsck
* fix resize2fs to not corrupt filesystem in some corner cases
* fix e2fsck crashes when deleting invalid symlink, directory larger than 2GB
...
-------------------------------------------------------------------
Tue Dec 10 00:45:47 UTC 2013 - nfbrown@suse.com
- Created "-mini" version of package which doesn't
build "info" and so doesn't depend on makeinfo,
texinfo, and all of tex. This should allow packages
in the bootstrap cycle (such as krb5-mini) to
build-depends of libraries from here.
-------------------------------------------------------------------
Thu Jun 27 10:54:12 UTC 2013 - jack@suse.cz

View File

@ -1,7 +1,7 @@
#
# spec file for package e2fsprogs
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -16,6 +16,8 @@
#
%define build_mini 0
Name: e2fsprogs
%if 0%{?suse_version} >= 1010
# Hint for ZYPP
@ -26,6 +28,7 @@ BuildRequires: automake
BuildRequires: libblkid-devel
BuildRequires: libuuid-devel
BuildRequires: pkg-config
%if ! %{build_mini}
%if 0%{?suse_version} > 1220
BuildRequires: makeinfo
%endif
@ -36,38 +39,49 @@ BuildRequires: makeinfo
%define install_info_delete sbin/install-info --delete
%endif
Requires: %install_info_prereq
%endif
# bug437293
%ifarch ppc64
Obsoletes: e2fsprogs-64bit
%endif
%if %{build_mini}
Conflicts: e2fsprogs
Conflicts: e2fsprogs-devel
Conflicts: libext2fs2
Conflicts: libext2fs-devel
Conflicts: libcom_err2
Conflicts: libcom_err-devel
%else
Conflicts: e2fsprogs-mini
Conflicts: e2fsprogs-mini-devel
Conflicts: libext2fs2-mini
Conflicts: libext2fs-mini-devel
Conflicts: libcom_err2-mini
Conflicts: libcom_err-mini-devel
%endif
#
Version: 1.42.11
Version: 1.43.8
Release: 0
Summary: Utilities for the Second Extended File System
License: GPL-2.0
Group: System/Filesystems
Url: http://e2fsprogs.sourceforge.net
Requires(post): coreutils
Requires: libcom_err2 >= %{version}
Requires: libext2fs2 >= %{version}
Source: http://downloads.sourceforge.net/project/e2fsprogs/e2fsprogs/v%{version}/e2fsprogs-%{version}.tar.gz
Source: http://www.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v%{version}/e2fsprogs-%{version}.tar.gz
Source2: README.SUSE
Source3: baselibs.conf
#
# e2fsprogs patches
#
Patch1: e2fsprogs-1.41.1-splash_support.patch
Patch1: libext2fs-fix-build-failure-in-swapfs.c-on-big-endia.patch
# libcom_err patches
Patch3: libcom_err-compile_et_permissions.patch
Patch4: e2fsprogs-1.42-implicit_fortify_decl.patch
Patch5: e2fsprogs-1.42-ext2fsh_implicit.patch
Patch6: e2fsck-free-ctx-fs-not-fs-at-the-end-of-fsck.patch
Patch7: e2fsck-fix-free-pointer-dereferences.patch
Patch8: libext2fs-avoid-buffer-overflow-if-s_first_meta_bg-i.patch
Patch9: libext2fs-fix-potential-buffer-overflow-in-closefs.patch
Patch10: resize2fs-Fix-32-64-bit-overflow-when-multiplying-by-blocks-cl.patch
Patch11: libext2fs-don-t-ignore-fsync-errors.patch
Patch12: libext2fs-Fix-fsync-2-detection.patch
Patch6: libext2fs-Fix-fsync-2-detection.patch
# Do not suppress make commands
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@ -92,25 +106,58 @@ Requires: libuuid-devel
%description devel
Dummy development package for backwards compatibility.
%if %{build_mini}
%package -n libext2fs2-mini
%else
%package -n libext2fs2
%endif
Summary: Ext2fs library
License: LGPL-2.0
Group: System/Filesystems
%if %{build_mini}
%description -n libext2fs2-mini
%else
%description -n libext2fs2
%endif
The basic Ext2fs shared library.
%if %{build_mini}
%package -n libext2fs-mini-devel
%else
%package -n libext2fs-devel
%endif
Summary: Development files for libext2fs
License: LGPL-2.0
Group: Development/Libraries/C and C++
Requires: libcom_err-devel
Requires: libext2fs2 = %version
%if %{build_mini}
%description -n libext2fs-mini-devel
%else
%description -n libext2fs-devel
%endif
Development files for libext2fs.
%if ! %{build_mini}
%package -n libext2fs-devel-static
Summary: Development files for libext2fs
License: LGPL-2.0
Group: Development/Libraries/C and C++
Requires: libext2fs-devel = %{version}
Provides: libext2fs-devel:%{_libdir}/libe2p.a
Provides: libext2fs-devel:%{_libdir}/libext2fs.a
%description -n libext2fs-devel-static
Development files for libext2fs. Static libraries.
%endif
%if %{build_mini}
%package -n libcom_err2-mini
%else
%package -n libcom_err2
%endif
Summary: E2fsprogs error reporting library
# bug437293
License: MIT
@ -123,10 +170,18 @@ Obsoletes: libcom_err2-64bit
Provides: libcom_err = %{version}
Obsoletes: libcom_err <= 1.40
%if %{build_mini}
%description -n libcom_err2-mini
%else
%description -n libcom_err2
%endif
com_err is an error message display library.
%if %{build_mini}
%package -n libcom_err-mini-devel
%else
%package -n libcom_err-devel
%endif
Summary: Development files for libcom_err
# bug437293
License: MIT
@ -138,24 +193,40 @@ Obsoletes: libcom_err-devel-64bit
Requires: glibc-devel
Requires: libcom_err2 = %version
%if %{build_mini}
%description -n libcom_err-mini-devel
%else
%description -n libcom_err-devel
%endif
Development files for the com_err error message display library.
%if ! %{build_mini}
%package -n libcom_err-devel-static
Summary: Development files for libcom_err, static libraries
License: MIT
Group: Development/Libraries/C and C++
Requires: libcom_err-devel = %{version}
Provides: libcom_err-devel:%{_libdir}/libcom_err.a
Provides: libcom_err-devel:%{_libdir}/libss.a
# bug437293
%ifarch ppc64
Obsoletes: libcom_err-devel-64bit
%endif
#
%description -n libcom_err-devel-static
Development files for the com_err error message display library. Static libraries.
%endif
%prep
%setup -q -n e2fsprogs-%{version}
# e2fsprogs patches
%patch1
%patch1 -p1
# libcom_err patches
%patch3 -p1
%patch4
%patch5
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
cp %{SOURCE2} .
%build
@ -168,7 +239,11 @@ autoreconf --force --install
--disable-libuuid \
--disable-uuidd \
--disable-fsck \
--enable-static \
CFLAGS="$RPM_OPT_FLAGS"
%if %{build_mini}
rm -rf doc
%endif
make %{?_smp_mflags} V=1
#Guarantee that tranlations match the source messages
make -C po update-po
@ -176,20 +251,10 @@ make -C po update-po
%install
make install install-libs DESTDIR=$RPM_BUILD_ROOT ELF_INSTALL_DIR=/%{_libdir}
%{find_lang} %{name}
%{find_lang} e2fsprogs
rm $RPM_BUILD_ROOT%{_libdir}/e2initrd_helper
rm -f $RPM_BUILD_ROOT/%{_sbindir}/mkfs.ext4dev
rm -f $RPM_BUILD_ROOT/%{_sbindir}/fsck.ext4dev
rm -f $RPM_BUILD_ROOT/usr/share/man/man8/mkfs.ext4dev.8*
rm -f $RPM_BUILD_ROOT/usr/share/man/man8/fsck.ext4dev.8*
# Need libext2fs.a for silo
find "%buildroot/%_libdir" -type f -name "*.a" \
%ifarch %sparc
! -name libext2fs.a \
%endif
-print -delete
#UsrMerge
mkdir %{buildroot}/sbin
ln -s %{_sbindir}/badblocks %{buildroot}/sbin/badblocks
@ -219,25 +284,53 @@ done
#EndUsrMerge
%post
/sbin/ldconfig
%install_info --info-dir=%{_infodir} %{_infodir}/libext2fs.info.gz
%if ! %{build_mini}
%install_info --info-dir=%{_infodir} %{_infodir}/libext2fs.info.gz || :
%{?regenerate_initrd_post}
%endif
%postun
/sbin/ldconfig
%install_info_delete --info-dir=%{_infodir} %{_infodir}/libext2fs.info.gz
%if ! %{build_mini}
%install_info_delete --info-dir=%{_infodir} %{_infodir}/libext2fs.info.gz || :
%{?regenerate_initrd_post}
%endif
%if ! %{build_mini}
%posttrans
%{?regenerate_initrd_posttrans}
%endif
%if %{build_mini}
%post -n libext2fs2-mini -p /sbin/ldconfig
%else
%post -n libext2fs2 -p /sbin/ldconfig
%endif
%if %{build_mini}
%postun -n libext2fs2-mini -p /sbin/ldconfig
%else
%postun -n libext2fs2 -p /sbin/ldconfig
%endif
%if %{build_mini}
%post -n libcom_err2-mini -p /sbin/ldconfig
%else
%post -n libcom_err2 -p /sbin/ldconfig
%endif
%if %{build_mini}
%postun -n libcom_err2-mini -p /sbin/ldconfig
%else
%postun -n libcom_err2 -p /sbin/ldconfig
%endif
%files -f %{name}.lang
%files -f e2fsprogs.lang
%defattr(-, root, root)
%doc RELEASE-NOTES README
%if 0%{?sle_version} > 120200
%license NOTICE
%endif
%config /etc/mke2fs.conf
#UsrMerge
/sbin/badblocks
@ -281,7 +374,10 @@ done
%{_sbindir}/filefrag
%{_sbindir}/e2freefrag
%{_sbindir}/e4defrag
%{_sbindir}/e4crypt
%if ! %{build_mini}
%{_infodir}/libext2fs.info.gz
%endif
%{_mandir}/man1/chattr.1.gz
%{_mandir}/man1/lsattr.1.gz
%{_mandir}/man5/ext?.5.gz
@ -293,7 +389,11 @@ done
%defattr(-,root,root)
%doc README.SUSE
%if %{build_mini}
%files -n libext2fs2-mini
%else
%files -n libext2fs2
%endif
%defattr(-, root, root)
#UsrMerge
/%{_lib}/libext2fs.so.*
@ -302,19 +402,24 @@ done
%{_libdir}/libext2fs.so.*
%{_libdir}/libe2p.so.*
%if %{build_mini}
%files -n libext2fs-mini-devel
%else
%files -n libext2fs-devel
%endif
%defattr(-, root, root)
%{_libdir}/libext2fs.so
%ifarch %sparc
%{_libdir}/libext2fs.a
%endif
%{_libdir}/libe2p.so
/usr/include/ext2fs
/usr/include/e2p
%_libdir/pkgconfig/e2p.pc
%_libdir/pkgconfig/ext2fs.pc
%if %{build_mini}
%files -n libcom_err2-mini
%else
%files -n libcom_err2
%endif
%defattr(-, root, root)
#UsrMerge
/%{_lib}/libcom_err.so.*
@ -323,7 +428,11 @@ done
%{_libdir}/libcom_err.so.*
%{_libdir}/libss.so.*
%if %{build_mini}
%files -n libcom_err-mini-devel
%else
%files -n libcom_err-devel
%endif
%defattr(-, root, root)
%_bindir/compile_et
%_bindir/mk_cmds
@ -340,4 +449,16 @@ done
%{_mandir}/man1/mk_cmds.1.gz
%{_mandir}/man3/com_err.3.gz
%if ! %{build_mini}
%files -n libcom_err-devel-static
%defattr(-, root, root)
%{_libdir}/libcom_err.a
%{_libdir}/libss.a
%files -n libext2fs-devel-static
%defattr(-, root, root)
%{_libdir}/libext2fs.a
%{_libdir}/libe2p.a
%endif
%changelog

View File

@ -1,13 +1,13 @@
Index: e2fsprogs-1.41.7/lib/et/compile_et.sh.in
Index: e2fsprogs-1.42.13/lib/et/compile_et.sh.in
===================================================================
--- e2fsprogs-1.41.7.orig/lib/et/compile_et.sh.in
+++ e2fsprogs-1.41.7/lib/et/compile_et.sh.in
--- e2fsprogs-1.42.13.orig/lib/et/compile_et.sh.in
+++ e2fsprogs-1.42.13/lib/et/compile_et.sh.in
@@ -51,7 +51,7 @@ if test -f ${BASE}.h && cmp -s ${BASE}.h
rm -f ${BASE}.h.$$
else
mv -f ${BASE}.h.$$ ${BASE}.h
- chmod -w ${BASE}.h
+# chmod -w ${BASE}.h
- chmod a-w ${BASE}.h
+# chmod a-w ${BASE}.h
fi
$AWK -f "${DIR}/et_c.awk" "outfile=${BASE}.c.$$" "outfn=${BASE}.c" "$ROOT.et"
if test -f ${BASE}.c && cmp -s ${BASE}.c.$$ ${BASE}.c ; then

View File

@ -1,58 +0,0 @@
From f66e6ce4446738c2c7f43d41988a3eb73347e2f5 Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <tytso@mit.edu>
Date: Sat, 9 Aug 2014 12:24:54 -0400
Subject: [PATCH] libext2fs: avoid buffer overflow if s_first_meta_bg is too
big
References: bsc#915402 CVE-2015-0247
If s_first_meta_bg is greater than the of number block group
descriptor blocks, then reading or writing the block group descriptors
will end up overruning the memory buffer allocated for the
descriptors. Fix this by limiting first_meta_bg to no more than
fs->desc_blocks. This doesn't correct the bad s_first_meta_bg value,
but it avoids causing the e2fsprogs userspace programs from
potentially crashing.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Acked-by: Jan Kara <jack@suse.cz>
---
lib/ext2fs/closefs.c | 6 ++++--
lib/ext2fs/openfs.c | 6 ++++--
2 files changed, 8 insertions(+), 4 deletions(-)
Index: e2fsprogs-1.42.11/lib/ext2fs/closefs.c
===================================================================
--- e2fsprogs-1.42.11.orig/lib/ext2fs/closefs.c
+++ e2fsprogs-1.42.11/lib/ext2fs/closefs.c
@@ -344,9 +344,11 @@ errcode_t ext2fs_flush2(ext2_filsys fs,
* superblocks and group descriptors.
*/
group_ptr = (char *) group_shadow;
- if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG)
+ if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG) {
old_desc_blocks = fs->super->s_first_meta_bg;
- else
+ if (old_desc_blocks > fs->super->s_first_meta_bg)
+ old_desc_blocks = fs->desc_blocks;
+ } else
old_desc_blocks = fs->desc_blocks;
ext2fs_numeric_progress_init(fs, &progress, NULL,
Index: e2fsprogs-1.42.11/lib/ext2fs/openfs.c
===================================================================
--- e2fsprogs-1.42.11.orig/lib/ext2fs/openfs.c
+++ e2fsprogs-1.42.11/lib/ext2fs/openfs.c
@@ -378,9 +378,11 @@ errcode_t ext2fs_open2(const char *name,
#ifdef WORDS_BIGENDIAN
groups_per_block = EXT2_DESC_PER_BLOCK(fs->super);
#endif
- if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG)
+ if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG) {
first_meta_bg = fs->super->s_first_meta_bg;
- else
+ if (first_meta_bg > fs->desc_blocks)
+ first_meta_bg = fs->desc_blocks;
+ } else
first_meta_bg = fs->desc_blocks;
if (first_meta_bg) {
retval = io_channel_read_blk(fs->io, group_block +

View File

@ -1,86 +0,0 @@
From: Eric Sandeen <sandeen@redhat.com>
Date: Tue, 20 Dec 2016 09:23:29 -0600
Subject: [PATCH] libext2fs: don't ignore fsync errors
Git-commit: 025d31b17a67953ce96741588bd911e6e66b6e03
References: bsc#1038194
Today, if mke2fs experiences IO errors (say, on a thin device
which filled up during mkfs), mke2fs is silent and returns
success even though the filesystem was not properly created.
Catch errors from the io_channel_flush() callchain to
fix this up. Fix formatting of the printed error as
well:
...
Creating journal (262144 blocks): done
Writing superblocks and filesystem accounting information:
Warning, had trouble writing out superblocks.
# echo $?
5
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Acked-by: Jan Kara <jack@suse.cz>
---
lib/ext2fs/closefs.c | 10 ++++++++--
lib/ext2fs/unix_io.c | 3 ++-
misc/mke2fs.c | 2 +-
3 files changed, 11 insertions(+), 4 deletions(-)
Index: e2fsprogs-1.42.11/lib/ext2fs/closefs.c
===================================================================
--- e2fsprogs-1.42.11.orig/lib/ext2fs/closefs.c
+++ e2fsprogs-1.42.11/lib/ext2fs/closefs.c
@@ -418,16 +418,22 @@ write_primary_superblock_only:
ext2fs_swap_super(super_shadow);
#endif
- if (!(flags & EXT2_FLAG_FLUSH_NO_SYNC))
+ if (!(flags & EXT2_FLAG_FLUSH_NO_SYNC)) {
retval = io_channel_flush(fs->io);
+ if (retval)
+ goto errout;
+ }
retval = write_primary_superblock(fs, super_shadow);
if (retval)
goto errout;
fs->flags &= ~EXT2_FLAG_DIRTY;
- if (!(flags & EXT2_FLAG_FLUSH_NO_SYNC))
+ if (!(flags & EXT2_FLAG_FLUSH_NO_SYNC)) {
retval = io_channel_flush(fs->io);
+ if (retval)
+ goto errout;
+ }
errout:
fs->super->s_state = fs_state;
#ifdef WORDS_BIGENDIAN
Index: e2fsprogs-1.42.11/lib/ext2fs/unix_io.c
===================================================================
--- e2fsprogs-1.42.11.orig/lib/ext2fs/unix_io.c
+++ e2fsprogs-1.42.11/lib/ext2fs/unix_io.c
@@ -843,7 +843,8 @@ static errcode_t unix_flush(io_channel c
#ifndef NO_IO_CACHE
retval = flush_cached_blocks(channel, data, 0);
#endif
- fsync(data->dev);
+ if (!retval && fsync(data->dev) != 0)
+ return errno;
return retval;
}
Index: e2fsprogs-1.42.11/misc/mke2fs.c
===================================================================
--- e2fsprogs-1.42.11.orig/misc/mke2fs.c
+++ e2fsprogs-1.42.11/misc/mke2fs.c
@@ -2925,7 +2925,7 @@ no_journal:
retval = ext2fs_close_free(&fs);
if (retval) {
fprintf(stderr, "%s",
- _("\nWarning, had trouble writing out superblocks."));
+ _("\nWarning, had trouble writing out superblocks.\n"));
} else if (!quiet) {
printf("%s", _("done\n\n"));
if (!getenv("MKE2FS_SKIP_CHECK_MSG"))

View File

@ -0,0 +1,40 @@
From 876d9b0c8eac2fd80dd62bfa1b09adea62aa08f3 Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <tytso@mit.edu>
Date: Wed, 3 Jan 2018 01:32:02 -0500
Subject: [PATCH] libext2fs: fix build failure in swapfs.c on big-endian
systems
References: bsc#1077420
Addresses-Debian-Bug: #886119
Reported-by: James Clarke <jrtc27@debian.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Acked-by: Jan Kara <jack@suse.cz>
---
lib/ext2fs/swapfs.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/ext2fs/swapfs.c b/lib/ext2fs/swapfs.c
index 6e5cff97e505..b13dc4229225 100644
--- a/lib/ext2fs/swapfs.c
+++ b/lib/ext2fs/swapfs.c
@@ -19,6 +19,7 @@
#include "ext2_fs.h"
#include "ext2fs.h"
+#include "ext2fsP.h"
#include <ext2fs/ext2_ext_attr.h>
#ifdef WORDS_BIGENDIAN
@@ -358,7 +359,7 @@ void ext2fs_swap_inode_full(ext2_filsys fs, struct ext2_inode_large *t,
if (inode_includes(inode_size, i_projid))
t->i_projid = ext2fs_swab16(f->i_projid);
/* catch new static fields added after i_projid */
- EXT2FS_BUILD_BUG_ON(sizeof(ext2_inode_large) != 160);
+ EXT2FS_BUILD_BUG_ON(sizeof(struct ext2_inode_large) != 160);
i = sizeof(struct ext2_inode) + extra_isize + sizeof(__u32);
if (bufsize < (int) i)
--
2.13.6

View File

@ -1,58 +0,0 @@
From 49d0fe2a14f2a23da2fe299643379b8c1d37df73 Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <tytso@mit.edu>
Date: Fri, 6 Feb 2015 12:46:39 -0500
Subject: [PATCH] libext2fs: fix potential buffer overflow in closefs()
References: bsc#918346 CVE-2015-1572
The bug fix in f66e6ce4446: "libext2fs: avoid buffer overflow if
s_first_meta_bg is too big" had a typo in the fix for
ext2fs_closefs(). In practice most of the security exposure was from
the openfs path, since this meant if there was a carefully crafted
file system, buffer overrun would be triggered when the file system was
opened.
However, if corrupted file system didn't trip over some corruption
check, and then the file system was modified via tune2fs or debugfs,
such that the superblock was marked dirty and then written out via the
closefs() path, it's possible that the buffer overrun could be
triggered when the file system is closed.
Also clear up a signed vs unsigned warning while we're at it.
Thanks to Nick Kralevich <nnk@google.com> for asking me to look at
compiler warning in the code in question, which led me to notice the
bug in f66e6ce4446.
Addresses: CVE-2015-1572
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Acked-by: Jan Kara <jack@suse.cz>
---
lib/ext2fs/closefs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/ext2fs/closefs.c b/lib/ext2fs/closefs.c
index 1f9911311a1a..ab5b2fb2365e 100644
--- a/lib/ext2fs/closefs.c
+++ b/lib/ext2fs/closefs.c
@@ -287,7 +287,7 @@ errcode_t ext2fs_flush2(ext2_filsys fs, int flags)
dgrp_t j;
#endif
char *group_ptr;
- int old_desc_blocks;
+ blk64_t old_desc_blocks;
struct ext2fs_numeric_progress_struct progress;
EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
@@ -346,7 +346,7 @@ errcode_t ext2fs_flush2(ext2_filsys fs, int flags)
group_ptr = (char *) group_shadow;
if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG) {
old_desc_blocks = fs->super->s_first_meta_bg;
- if (old_desc_blocks > fs->super->s_first_meta_bg)
+ if (old_desc_blocks > fs->desc_blocks)
old_desc_blocks = fs->desc_blocks;
} else
old_desc_blocks = fs->desc_blocks;
--
2.1.4

6
pre_checkin.sh Normal file
View File

@ -0,0 +1,6 @@
#!/bin/sh
sed -e 's/Name:.*/Name: e2fsprogs-mini/' \
-e 's/spec file for package.*/&-mini/' \
-e 's/%define.*build_mini.*/%define build_mini 1/' e2fsprogs.spec > e2fsprogs-mini.spec
cp e2fsprogs.changes e2fsprogs-mini.changes

View File

@ -1,222 +0,0 @@
From 1e33a8b408123a4e02a6b9135807f6fd61f3e235 Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <tytso@mit.edu>
Date: Sat, 26 Jul 2014 07:40:36 -0400
Subject: [PATCH] Fix 32/64-bit overflow when multiplying by blocks/clusters
per group
References: bsc#1009532
There are a number of places where we need convert groups to blocks or
clusters by multiply the groups by blocks/clusters per group.
Unfortunately, both quantities are 32-bit, but the result needs to be
64-bit, and very often the cast to 64-bit gets lost.
Fix this by adding new macros, EXT2_GROUPS_TO_BLOCKS() and
EXT2_GROUPS_TO_CLUSTERS().
This should fix a bug where resizing a 64bit file system can result in
calculate_minimum_resize_size() looping forever.
Addresses-Launchpad-Bug: #1321958
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
e2fsck/pass5.c | 2 +-
e2fsck/super.c | 2 +-
lib/ext2fs/blknum.c | 2 +-
lib/ext2fs/ext2_fs.h | 5 +++++
lib/ext2fs/imager.c | 14 +++++++-------
lib/ext2fs/rw_bitmaps.c | 4 ++--
misc/tune2fs.c | 2 +-
resize/resize2fs.c | 11 +++++------
8 files changed, 23 insertions(+), 19 deletions(-)
diff --git a/e2fsck/pass5.c b/e2fsck/pass5.c
index d0b1ced512ce..bc9a32a321e0 100644
--- a/e2fsck/pass5.c
+++ b/e2fsck/pass5.c
@@ -776,7 +776,7 @@ static void check_block_end(e2fsck_t ctx)
clear_problem_context(&pctx);
end = ext2fs_get_block_bitmap_start2(fs->block_map) +
- ((blk64_t)EXT2_CLUSTERS_PER_GROUP(fs->super) * fs->group_desc_count) - 1;
+ EXT2_GROUPS_TO_CLUSTERS(fs->super, fs->group_desc_count) - 1;
pctx.errcode = ext2fs_fudge_block_bitmap_end2(fs->block_map, end,
&save_blocks_count);
if (pctx.errcode) {
diff --git a/e2fsck/super.c b/e2fsck/super.c
index 81503d4b9b70..8d468e63d517 100644
--- a/e2fsck/super.c
+++ b/e2fsck/super.c
@@ -421,7 +421,7 @@ void check_resize_inode(e2fsck_t ctx)
for (j = 1; j < fs->group_desc_count; j++) {
if (!ext2fs_bg_has_super(fs, j))
continue;
- expect = pblk + (j * fs->super->s_blocks_per_group);
+ expect = pblk + EXT2_GROUPS_TO_BLOCKS(fs->super, j);
if (ind_buf[ind_off] != expect)
goto resize_inode_invalid;
ind_off++;
diff --git a/lib/ext2fs/blknum.c b/lib/ext2fs/blknum.c
index 8ced1eec6838..7ce6053497f9 100644
--- a/lib/ext2fs/blknum.c
+++ b/lib/ext2fs/blknum.c
@@ -29,7 +29,7 @@ dgrp_t ext2fs_group_of_blk2(ext2_filsys fs, blk64_t blk)
blk64_t ext2fs_group_first_block2(ext2_filsys fs, dgrp_t group)
{
return fs->super->s_first_data_block +
- ((blk64_t)group * fs->super->s_blocks_per_group);
+ EXT2_GROUPS_TO_BLOCKS(fs->super, group);
}
/*
diff --git a/lib/ext2fs/ext2_fs.h b/lib/ext2fs/ext2_fs.h
index d9e14d7cee6c..6c3620cbe6e0 100644
--- a/lib/ext2fs/ext2_fs.h
+++ b/lib/ext2fs/ext2_fs.h
@@ -264,6 +264,11 @@ struct ext2_dx_countlimit {
#define EXT2_DESC_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / EXT2_DESC_SIZE(s))
#endif
+#define EXT2_GROUPS_TO_BLOCKS(s, g) ((blk64_t) EXT2_BLOCKS_PER_GROUP(s) * \
+ (g))
+#define EXT2_GROUPS_TO_CLUSTERS(s, g) ((blk64_t) EXT2_CLUSTERS_PER_GROUP(s) * \
+ (g))
+
/*
* Constants relative to the data blocks
*/
diff --git a/lib/ext2fs/imager.c b/lib/ext2fs/imager.c
index 378a3c885989..b643cc6f3fa0 100644
--- a/lib/ext2fs/imager.c
+++ b/lib/ext2fs/imager.c
@@ -286,8 +286,8 @@ errcode_t ext2fs_image_bitmap_write(ext2_filsys fs, int fd, int flags)
ext2fs_generic_bitmap bmap;
errcode_t retval;
ssize_t actual;
- __u32 itr, cnt, size;
- int c, total_size;
+ size_t c;
+ __u64 itr, cnt, size, total_size;
char buf[1024];
if (flags & IMAGER_FLAG_INODEMAP) {
@@ -308,7 +308,7 @@ errcode_t ext2fs_image_bitmap_write(ext2_filsys fs, int fd, int flags)
}
bmap = fs->block_map;
itr = fs->super->s_first_data_block;
- cnt = EXT2_BLOCKS_PER_GROUP(fs->super) * fs->group_desc_count;
+ cnt = EXT2_GROUPS_TO_BLOCKS(fs->super, fs->group_desc_count);
size = EXT2_BLOCKS_PER_GROUP(fs->super) / 8;
}
total_size = size * fs->group_desc_count;
@@ -342,9 +342,9 @@ errcode_t ext2fs_image_bitmap_write(ext2_filsys fs, int fd, int flags)
if (c > (int) sizeof(buf))
c = sizeof(buf);
actual = write(fd, buf, c);
- if (actual == -1)
+ if (actual < 0)
return errno;
- if (actual != c)
+ if ((size_t) actual != c)
return EXT2_ET_SHORT_WRITE;
size -= c;
}
@@ -360,7 +360,7 @@ errcode_t ext2fs_image_bitmap_read(ext2_filsys fs, int fd, int flags)
{
ext2fs_generic_bitmap bmap;
errcode_t retval;
- __u32 itr, cnt;
+ __u64 itr, cnt;
char buf[1024];
unsigned int size;
ssize_t actual;
@@ -383,7 +383,7 @@ errcode_t ext2fs_image_bitmap_read(ext2_filsys fs, int fd, int flags)
}
bmap = fs->block_map;
itr = fs->super->s_first_data_block;
- cnt = EXT2_BLOCKS_PER_GROUP(fs->super) * fs->group_desc_count;
+ cnt = EXT2_GROUPS_TO_BLOCKS(fs->super, fs->group_desc_count);
size = EXT2_BLOCKS_PER_GROUP(fs->super) / 8;
}
diff --git a/lib/ext2fs/rw_bitmaps.c b/lib/ext2fs/rw_bitmaps.c
index d24ba9a3feca..a07ecd579a77 100644
--- a/lib/ext2fs/rw_bitmaps.c
+++ b/lib/ext2fs/rw_bitmaps.c
@@ -262,8 +262,8 @@ static errcode_t read_bitmaps(ext2_filsys fs, int do_inode, int do_block)
}
blk = (fs->image_header->offset_blockmap /
fs->blocksize);
- blk_cnt = (blk64_t)EXT2_CLUSTERS_PER_GROUP(fs->super) *
- fs->group_desc_count;
+ blk_cnt = EXT2_GROUPS_TO_CLUSTERS(fs->super,
+ fs->group_desc_count);
while (block_nbytes > 0) {
retval = io_channel_read_blk64(fs->image_io, blk++,
1, block_bitmap);
diff --git a/misc/tune2fs.c b/misc/tune2fs.c
index 6b2123518240..ad0b05f1931b 100644
--- a/misc/tune2fs.c
+++ b/misc/tune2fs.c
@@ -1383,7 +1383,7 @@ static int ext2fs_is_block_in_group(ext2_filsys fs, dgrp_t group, blk64_t blk)
{
blk64_t start_blk, end_blk;
start_blk = fs->super->s_first_data_block +
- EXT2_BLOCKS_PER_GROUP(fs->super) * group;
+ EXT2_GROUPS_TO_BLOCKS(fs->super, group);
/*
* We cannot get new block beyond end_blk for for the last block group
* so we can check with EXT2_BLOCKS_PER_GROUP even for last block group
diff --git a/resize/resize2fs.c b/resize/resize2fs.c
index 6bd2e1c62f7b..9641b1e5807e 100644
--- a/resize/resize2fs.c
+++ b/resize/resize2fs.c
@@ -436,8 +436,7 @@ retry:
fs->inode_map);
if (retval) goto errout;
- real_end = (((blk64_t) EXT2_BLOCKS_PER_GROUP(fs->super) *
- fs->group_desc_count)) - 1 +
+ real_end = EXT2_GROUPS_TO_BLOCKS(fs->super, fs->group_desc_count) - 1 +
fs->super->s_first_data_block;
retval = ext2fs_resize_block_bitmap2(new_size - 1,
real_end, fs->block_map);
@@ -2318,7 +2317,7 @@ blk64_t calculate_minimum_resize_size(ext2_filsys fs, int flags)
fs->super->s_free_inodes_count;
blks_needed = ext2fs_div_ceil(inode_count,
fs->super->s_inodes_per_group) *
- EXT2_BLOCKS_PER_GROUP(fs->super);
+ (blk64_t) EXT2_BLOCKS_PER_GROUP(fs->super);
groups = ext2fs_div64_ceil(blks_needed,
EXT2_BLOCKS_PER_GROUP(fs->super));
#ifdef RESIZE2FS_DEBUG
@@ -2365,7 +2364,7 @@ blk64_t calculate_minimum_resize_size(ext2_filsys fs, int flags)
* figure out how many data blocks we have given the number of groups
* we need for our inodes
*/
- data_blocks = groups * EXT2_BLOCKS_PER_GROUP(fs->super);
+ data_blocks = EXT2_GROUPS_TO_BLOCKS(fs->super, groups);
last_start = 0;
for (grp = 0; grp < flex_groups; grp++) {
overhead = calc_group_overhead(fs, grp, old_desc_blocks);
@@ -2403,7 +2402,7 @@ blk64_t calculate_minimum_resize_size(ext2_filsys fs, int flags)
extra_grps = ext2fs_div64_ceil(remainder,
EXT2_BLOCKS_PER_GROUP(fs->super));
- data_blocks += extra_grps * EXT2_BLOCKS_PER_GROUP(fs->super);
+ data_blocks += EXT2_GROUPS_TO_BLOCKS(fs->super, extra_grps);
/* ok we have to account for the last group */
overhead = calc_group_overhead(fs, groups-1, old_desc_blocks);
@@ -2501,7 +2500,7 @@ blk64_t calculate_minimum_resize_size(ext2_filsys fs, int flags)
* blocks needed to handle the group descriptor metadata+data
* that we need
*/
- blks_needed = (groups-1) * EXT2_BLOCKS_PER_GROUP(fs->super);
+ blks_needed = EXT2_GROUPS_TO_BLOCKS(fs->super, groups - 1);
blks_needed += overhead;
/*
--
2.6.6