svn commit: r370472 - in head/sysutils/e2fsprogs: . files
Matthias Andree
mandree at FreeBSD.org
Wed Oct 8 17:33:29 UTC 2014
Author: mandree
Date: Wed Oct 8 17:33:25 2014
New Revision: 370472
URL: https://svnweb.freebsd.org/changeset/ports/370472
QAT: https://qat.redports.org/buildarchive/r370472/
Log:
Unbreak port:
- Refresh old patches to avoid fuzz.
- Add two upstream patches to fix the use-after-free() issue.
- There seem to be double-free() issues left but these do not show during
self-test, only under valgrind instrumentation so we'll move the port
ahead and get packages while working with upstream to debug this through
the end.
- Bump PORTREVISION to 1.
Added:
head/sysutils/e2fsprogs/files/patch-zzz-f38676c3e4001359b96576204e9024557ef5fd1b (contents, props changed)
head/sysutils/e2fsprogs/files/patch-zzz-f8d3d1661885a07ac9ef639dda0ce23d181a2c73 (contents, props changed)
Modified:
head/sysutils/e2fsprogs/Makefile
head/sysutils/e2fsprogs/files/patch-e2fsck__unix.c
head/sysutils/e2fsprogs/files/patch-lib__ext2fs__ext2_fs.h
head/sysutils/e2fsprogs/files/patch-lib__ext2fs__tdb.c
head/sysutils/e2fsprogs/files/patch-lib__ext2fs__tst_bitops.c
head/sysutils/e2fsprogs/files/patch-lib__uuid__gen_uuid.c
head/sysutils/e2fsprogs/files/patch-misc__Makefile.in
head/sysutils/e2fsprogs/files/patch-misc__tune2fs.c
Modified: head/sysutils/e2fsprogs/Makefile
==============================================================================
--- head/sysutils/e2fsprogs/Makefile Wed Oct 8 17:24:36 2014 (r370471)
+++ head/sysutils/e2fsprogs/Makefile Wed Oct 8 17:33:25 2014 (r370472)
@@ -3,7 +3,7 @@
PORTNAME= e2fsprogs
PORTVERSION= 1.42.12
-PORTREVISION?= 0
+PORTREVISION?= 1
CATEGORIES?= sysutils
MASTER_SITES= KERNEL_ORG/linux/kernel/people/tytso/${PORTNAME}/v${PORTVERSION}
@@ -14,7 +14,6 @@ LICENSE= GPLv2
PORTSCOUT= ignore # cannot handle the version in the directory
-PATCH_STRIP= -p1
USES= gmake pkgconfig tar:xz
USE_CSTD= gnu99
USE_LDCONFIG= yes
@@ -80,16 +79,6 @@ post-patch::
.endfor
.if ${MASTERDIR} == ${.CURDIR}
-# Regression that apparently causes use-after-free in
-# http://git.kernel.org/cgit/fs/ext2/e2fsprogs.git/commit/?h=maint&id=47fee2ef6a23ae06f680336ffde57caa64604a4c
-# and can be reproduced under MALLOC_OPTIONS=J regime on 9.3-amd64, or
-# alternatively confirmed with valgrind, was reported upstream.
-#
-# Let's wait until 2014-10-15 whether upstream provides a fix,
-# else we'll bump PORTEPOCH and roll back to 1.42.10;
-# 1.42.11 is also faulty.
-BROKEN= Use-after-free bug, see ${.CURDIR}/Makefile comments for details
-
pre-build:
# fix up Makefile ordering for parallel builds
cd ${WRKSRC}/lib/et && ${DO_MAKE_BUILD} compile_et
Modified: head/sysutils/e2fsprogs/files/patch-e2fsck__unix.c
==============================================================================
--- head/sysutils/e2fsprogs/files/patch-e2fsck__unix.c Wed Oct 8 17:24:36 2014 (r370471)
+++ head/sysutils/e2fsprogs/files/patch-e2fsck__unix.c Wed Oct 8 17:33:25 2014 (r370472)
@@ -1,5 +1,5 @@
---- ./e2fsck/unix.c.orig 2013-12-29 05:18:02.000000000 +0100
-+++ ./e2fsck/unix.c 2014-01-06 23:26:48.000000000 +0100
+--- e2fsck/unix.c.orig 2014-08-12 18:19:37 UTC
++++ e2fsck/unix.c
@@ -9,8 +9,6 @@
* %End-Header%
*/
@@ -18,7 +18,7 @@
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
-@@ -584,6 +582,24 @@
+@@ -590,6 +588,24 @@
return 0;
}
@@ -43,7 +43,7 @@
#define PATH_SET "PATH=/sbin"
/*
-@@ -616,6 +632,17 @@
+@@ -622,6 +638,17 @@
ctx->progress = e2fsck_update_progress;
}
@@ -61,7 +61,7 @@
static void signal_progress_off(int sig EXT2FS_ATTR((unused)))
{
e2fsck_t ctx = e2fsck_global_ctx;
-@@ -995,6 +1022,8 @@
+@@ -1001,6 +1028,8 @@
sigaction(SIGUSR1, &sa, 0);
sa.sa_handler = signal_progress_off;
sigaction(SIGUSR2, &sa, 0);
Modified: head/sysutils/e2fsprogs/files/patch-lib__ext2fs__ext2_fs.h
==============================================================================
--- head/sysutils/e2fsprogs/files/patch-lib__ext2fs__ext2_fs.h Wed Oct 8 17:24:36 2014 (r370471)
+++ head/sysutils/e2fsprogs/files/patch-lib__ext2fs__ext2_fs.h Wed Oct 8 17:33:25 2014 (r370472)
@@ -1,6 +1,6 @@
---- ./lib/ext2fs/ext2_fs.h.orig 2013-12-29 05:18:02.000000000 +0100
-+++ ./lib/ext2fs/ext2_fs.h 2014-01-06 23:26:48.000000000 +0100
-@@ -456,7 +456,7 @@
+--- lib/ext2fs/ext2_fs.h.orig 2014-08-02 20:26:22 UTC
++++ lib/ext2fs/ext2_fs.h
+@@ -461,7 +461,7 @@
#define i_dir_acl i_size_high
Modified: head/sysutils/e2fsprogs/files/patch-lib__ext2fs__tdb.c
==============================================================================
--- head/sysutils/e2fsprogs/files/patch-lib__ext2fs__tdb.c Wed Oct 8 17:24:36 2014 (r370471)
+++ head/sysutils/e2fsprogs/files/patch-lib__ext2fs__tdb.c Wed Oct 8 17:33:25 2014 (r370472)
@@ -1,5 +1,5 @@
---- ./lib/ext2fs/tdb.c.orig 2012-07-06 15:37:27.000000000 +0200
-+++ ./lib/ext2fs/tdb.c 2014-01-06 23:26:48.000000000 +0100
+--- lib/ext2fs/tdb.c.orig 2014-06-25 19:19:40 UTC
++++ lib/ext2fs/tdb.c
@@ -36,7 +36,6 @@
#define HAVE_UTIME_H
#define HAVE_UTIME
Modified: head/sysutils/e2fsprogs/files/patch-lib__ext2fs__tst_bitops.c
==============================================================================
--- head/sysutils/e2fsprogs/files/patch-lib__ext2fs__tst_bitops.c Wed Oct 8 17:24:36 2014 (r370471)
+++ head/sysutils/e2fsprogs/files/patch-lib__ext2fs__tst_bitops.c Wed Oct 8 17:33:25 2014 (r370472)
@@ -1,5 +1,5 @@
---- ./lib/ext2fs/tst_bitops.c.orig 2012-07-06 15:37:27.000000000 +0200
-+++ ./lib/ext2fs/tst_bitops.c 2014-01-06 23:26:48.000000000 +0100
+--- lib/ext2fs/tst_bitops.c.orig 2014-06-25 19:19:15 UTC
++++ lib/ext2fs/tst_bitops.c
@@ -104,7 +104,7 @@
bigarray = malloc(1 << 29);
if (!bigarray) {
Modified: head/sysutils/e2fsprogs/files/patch-lib__uuid__gen_uuid.c
==============================================================================
--- head/sysutils/e2fsprogs/files/patch-lib__uuid__gen_uuid.c Wed Oct 8 17:24:36 2014 (r370471)
+++ head/sysutils/e2fsprogs/files/patch-lib__uuid__gen_uuid.c Wed Oct 8 17:33:25 2014 (r370472)
@@ -1,5 +1,5 @@
---- ./lib/uuid/gen_uuid.c.orig 2013-12-16 07:32:00.000000000 +0100
-+++ ./lib/uuid/gen_uuid.c 2014-01-06 23:26:48.000000000 +0100
+--- lib/uuid/gen_uuid.c.orig 2014-07-03 14:33:48 UTC
++++ lib/uuid/gen_uuid.c
@@ -91,6 +91,7 @@
#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
Modified: head/sysutils/e2fsprogs/files/patch-misc__Makefile.in
==============================================================================
--- head/sysutils/e2fsprogs/files/patch-misc__Makefile.in Wed Oct 8 17:24:36 2014 (r370471)
+++ head/sysutils/e2fsprogs/files/patch-misc__Makefile.in Wed Oct 8 17:33:25 2014 (r370472)
@@ -1,5 +1,5 @@
---- ./misc/Makefile.in.orig 2013-12-26 06:26:22.000000000 +0100
-+++ ./misc/Makefile.in 2014-01-06 23:26:48.000000000 +0100
+--- misc/Makefile.in.orig 2014-08-02 23:41:18 UTC
++++ misc/Makefile.in
@@ -28,15 +28,15 @@
SPROGS= mke2fs badblocks tune2fs dumpe2fs $(BLKID_PROG) logsave \
@@ -21,7 +21,7 @@
LPROGS= @E2INITRD_PROG@
-@@ -125,14 +125,14 @@
+@@ -127,14 +127,14 @@
mke2fs.conf: $(srcdir)/mke2fs.conf.in
if test -f $(srcdir)/mke2fs.conf.custom.in ; then \
@@ -39,7 +39,7 @@
> default_profile.c
profile.o:
$(E) " CC $<"
-@@ -498,34 +498,9 @@
+@@ -515,34 +515,9 @@
(cd $(DESTDIR)$(man5dir); \
$(LN) $(LINK_INSTALL_FLAGS) ext4.5 $$i.5); \
done
Modified: head/sysutils/e2fsprogs/files/patch-misc__tune2fs.c
==============================================================================
--- head/sysutils/e2fsprogs/files/patch-misc__tune2fs.c Wed Oct 8 17:24:36 2014 (r370471)
+++ head/sysutils/e2fsprogs/files/patch-misc__tune2fs.c Wed Oct 8 17:33:25 2014 (r370472)
@@ -1,5 +1,5 @@
---- ./misc/tune2fs.c.orig 2013-12-29 05:18:02.000000000 +0100
-+++ ./misc/tune2fs.c 2014-01-06 23:43:47.000000000 +0100
+--- misc/tune2fs.c.orig 2014-08-02 20:26:22 UTC
++++ misc/tune2fs.c
@@ -25,7 +25,6 @@
* 94/03/06 - Added the checks interval from Uwe Ohse (uwe at tirka.gun.de)
*/
Added: head/sysutils/e2fsprogs/files/patch-zzz-f38676c3e4001359b96576204e9024557ef5fd1b
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/sysutils/e2fsprogs/files/patch-zzz-f38676c3e4001359b96576204e9024557ef5fd1b Wed Oct 8 17:33:25 2014 (r370472)
@@ -0,0 +1,64 @@
+commit f38676c3e4001359b96576204e9024557ef5fd1b
+Author: Theodore Ts'o <tytso at mit.edu>
+Date: Wed Oct 8 11:47:00 2014 -0400
+
+ e2fsprogs: 1.42.11 regression in memory handling: use-after-free since commit 47fee2e "e2fsprogs: introduce ext2fs_close_free() helper"
+
+ Hi Matthias,
+
+ Thanks for reporting this. I'm not 100% sure this will fix your
+ problem, since your specific valgrind failures aren't reproducing for
+ me. That being said, I was able to find a valgrind failure, and after
+ looking closely at the commit that you bisected things to, I found a
+ bug which was introduced by commit 47fee2ef6a23a.
+
+ Could you check and see if this fixes the problems you are seeing?
+
+ Many thanks!!
+
+ - Ted
+
+ commit ebdf895b43a1ce499e4d2556a201e2a753fc422f
+ Author: Theodore Ts'o <tytso at mit.edu>
+ Date: Wed Oct 8 11:18:41 2014 -0400
+
+ e2fsck: fix free pointer dereferences
+
+ Commit 47fee2ef6a23a introduces some free pointer dereference bugs by
+ not clearing ctx->fs after calling ext2fs_close_free().
+
+ Reported-by: Matthias Andree <mandree at FreeBSD.org>
+ Cc: Lukas Czerner <lczerner at redhat.com>
+ Signed-off-by: Theodore Ts'o <tytso at mit.edu>
+
+diff --git a/e2fsck/unix.c b/e2fsck/unix.c
+index 66debcd..10036e7 100644
+--- ./e2fsck/unix.c
++++ ./e2fsck/unix.c
+@@ -458,7 +458,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);
+ }
+@@ -1462,7 +1462,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;
+ }
+@@ -1692,7 +1692,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_ABORT)
Added: head/sysutils/e2fsprogs/files/patch-zzz-f8d3d1661885a07ac9ef639dda0ce23d181a2c73
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/sysutils/e2fsprogs/files/patch-zzz-f8d3d1661885a07ac9ef639dda0ce23d181a2c73 Wed Oct 8 17:33:25 2014 (r370472)
@@ -0,0 +1,90 @@
+commit f8d3d1661885a07ac9ef639dda0ce23d181a2c73
+Author: Theodore Ts'o <tytso at mit.edu>
+Date: Wed Oct 8 12:18:32 2014 -0400
+
+ resize2fs: fix fs->blocksize dereference after fs has been freed]
+
+ FYI, you'll probably want this patch too, since it's applicable to 1.42.12.
+
+ - Ted
+
+ Commit 77255cf36944b introduced a use after free bug.
+
+ Signed-off-by: Theodore Ts'o <tytso at mit.edu>
+
+diff --git a/resize/main.c b/resize/main.c
+index c107028..983d8c2 100644
+--- ./resize/main.c
++++ ./resize/main.c
+@@ -181,6 +181,7 @@ int main (int argc, char ** argv)
+ ext2fs_struct_stat st_buf;
+ __s64 new_file_size;
+ unsigned int sys_page_size = 4096;
++ unsigned int blocksize;
+ long sysval;
+ int len, mount_flags;
+ char *mtpt;
+@@ -366,7 +367,8 @@ int main (int argc, char ** argv)
+ * defaults and for making sure the new filesystem doesn't
+ * exceed the partition size.
+ */
+- retval = ext2fs_get_device_size2(device_name, fs->blocksize,
++ blocksize = fs->blocksize;
++ retval = ext2fs_get_device_size2(device_name, blocksize,
+ &max_size);
+ if (retval) {
+ com_err(program_name, retval, "%s",
+@@ -386,8 +388,8 @@ int main (int argc, char ** argv)
+ } else {
+ new_size = max_size;
+ /* Round down to an even multiple of a pagesize */
+- if (sys_page_size > fs->blocksize)
+- new_size &= ~((sys_page_size / fs->blocksize)-1);
++ if (sys_page_size > blocksize)
++ new_size &= ~((sys_page_size / blocksize)-1);
+ }
+ if (!EXT2_HAS_INCOMPAT_FEATURE(fs->super,
+ EXT4_FEATURE_INCOMPAT_64BIT)) {
+@@ -423,7 +425,7 @@ int main (int argc, char ** argv)
+ * automatically extend it in a sparse fashion by writing the
+ * last requested block.
+ */
+- new_file_size = ((__u64) new_size) * fs->blocksize;
++ new_file_size = ((__u64) new_size) * blocksize;
+ if ((__u64) new_file_size >
+ (((__u64) 1) << (sizeof(st_buf.st_size)*8 - 1)) - 1)
+ fd = -1;
+@@ -437,13 +439,13 @@ int main (int argc, char ** argv)
+ fprintf(stderr, _("The containing partition (or device)"
+ " is only %llu (%dk) blocks.\nYou requested a new size"
+ " of %llu blocks.\n\n"), max_size,
+- fs->blocksize / 1024, new_size);
++ blocksize / 1024, new_size);
+ exit(1);
+ }
+ if (new_size == ext2fs_blocks_count(fs->super)) {
+ fprintf(stderr, _("The filesystem is already %llu (%dk) "
+ "blocks long. Nothing to do!\n\n"), new_size,
+- fs->blocksize / 1024);
++ blocksize / 1024);
+ exit(0);
+ }
+ if (mount_flags & EXT2_MF_MOUNTED) {
+@@ -453,7 +455,7 @@ int main (int argc, char ** argv)
+ bigalloc_check(fs, force);
+ printf(_("Resizing the filesystem on "
+ "%s to %llu (%dk) blocks.\n"),
+- device_name, new_size, fs->blocksize / 1024);
++ device_name, new_size, blocksize / 1024);
+ retval = resize_fs(fs, &new_size, flags,
+ ((flags & RESIZE_PERCENT_COMPLETE) ?
+ resize_progress_func : 0));
+@@ -470,7 +472,7 @@ int main (int argc, char ** argv)
+ exit(1);
+ }
+ printf(_("The filesystem on %s is now %llu (%dk) blocks long.\n\n"),
+- device_name, new_size, fs->blocksize / 1024);
++ device_name, new_size, blocksize / 1024);
+
+ if ((st_buf.st_size > new_file_size) &&
+ (fd > 0)) {
More information about the svn-ports-all
mailing list