]> code.ossystems Code Review - openembedded-core.git/commitdiff
e2fsprogs: CVE-2015-0247
authorSona Sarmadi <sona.sarmadi@enea.com>
Thu, 12 Mar 2015 10:01:01 +0000 (11:01 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 17 Apr 2015 21:38:34 +0000 (22:38 +0100)
Fixes a heap buffer overflow in lib/ext2fs/openfs.c which allows
a trivial arbitrary memory write under certain conditions.

References
http://git.kernel.org/cgit/fs/ext2/e2fsprogs.git/commit/?id=f66e6ce4
http://www.ocert.org/advisories/ocert-2015-002.html

(From OE-Core rev: 572437720b6698a3a10627fcd9654ef10f827836)

Signed-off-by: Sona Sarmadi <sona.sarmadi@enea.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
meta/recipes-devtools/e2fsprogs/e2fsprogs/CVE-2015-0247.patch [new file with mode: 0644]
meta/recipes-devtools/e2fsprogs/e2fsprogs_1.42.9.bb

diff --git a/meta/recipes-devtools/e2fsprogs/e2fsprogs/CVE-2015-0247.patch b/meta/recipes-devtools/e2fsprogs/e2fsprogs/CVE-2015-0247.patch
new file mode 100644 (file)
index 0000000..4de67c9
--- /dev/null
@@ -0,0 +1,58 @@
+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: libext2fs: avoid buffer overflow if s_first_meta_bg is too big
+
+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.
+
+Fixes CVE-2015-0247
+Upstream-Status: Backport
+
+Signed-off-by: Theodore Ts'o <tytso@mit.edu>
+Signed-off-by: Sona Sarmadi <sona.sarmadi@enea.com>
+
+diff --git a/lib/ext2fs/closefs.c b/lib/ext2fs/closefs.c
+index 4599eef..1f99113 100644
+--- a/lib/ext2fs/closefs.c
++++ b/lib/ext2fs/closefs.c
+@@ -344,9 +344,11 @@ errcode_t ext2fs_flush2(ext2_filsys fs, int flags)
+        * 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,
+diff --git a/lib/ext2fs/openfs.c b/lib/ext2fs/openfs.c
+index a1a3517..ba501e6 100644
+--- a/lib/ext2fs/openfs.c
++++ b/lib/ext2fs/openfs.c
+@@ -378,9 +378,11 @@ errcode_t ext2fs_open2(const char *name, const char *io_options,
+ #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 +
+-- 
+cgit v0.10.2
+
index 2dd3d547df0cbc0ffab2211e502b7fb45b7da625..70ccdfd540055f16457e118d4360bdc9591f2fb9 100644 (file)
@@ -20,6 +20,7 @@ SRC_URI += "file://acinclude.m4 \
             file://0001-e2fsprogs-fix-cross-compilation-problem.patch \
             file://misc-mke2fs.c-return-error-when-failed-to-populate-fs.patch \
             file://cache_inode.patch \
+            file://CVE-2015-0247.patch \
 "
 
 SRC_URI[md5sum] = "3f8e41e63b432ba114b33f58674563f7"