e2fsprogs: update to v1.45.6 version
e2fsprogs: update to v1.45.6 version Signed-off-by: Zhiqiang Liu <lzhq28@mail.ustc.edu.cn>
This commit is contained in:
parent
3e6c8cad72
commit
1a2f87eb42
@ -1,53 +0,0 @@
|
|||||||
From 8dd73c149f418238f19791f9d666089ef9734dff Mon Sep 17 00:00:00 2001
|
|
||||||
From: Theodore Ts'o <tytso@mit.edu>
|
|
||||||
Date: Thu, 19 Dec 2019 19:37:34 -0500
|
|
||||||
Subject: [PATCH] e2fsck: abort if there is a corrupted directory block when
|
|
||||||
rehashing
|
|
||||||
|
|
||||||
In e2fsck pass 3a, when we are rehashing directories, at least in
|
|
||||||
theory, all of the directories should have had corruptions with
|
|
||||||
respect to directory entry structure fixed. However, it's possible
|
|
||||||
(for example, if the user declined a fix) that we can reach this stage
|
|
||||||
of processing with a corrupted directory entries.
|
|
||||||
|
|
||||||
So check for that case and don't try to process a corrupted directory
|
|
||||||
block so we don't run into trouble in mutate_name() if there is a
|
|
||||||
zero-length file name.
|
|
||||||
|
|
||||||
Addresses: TALOS-2019-0973
|
|
||||||
Addresses: CVE-2019-5188
|
|
||||||
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
|
|
||||||
---
|
|
||||||
e2fsck/rehash.c | 9 +++++++++
|
|
||||||
1 file changed, 9 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/e2fsck/rehash.c b/e2fsck/rehash.c
|
|
||||||
index a5fc1be..3dd1e94 100644
|
|
||||||
--- a/e2fsck/rehash.c
|
|
||||||
+++ b/e2fsck/rehash.c
|
|
||||||
@@ -160,6 +160,10 @@ static int fill_dir_block(ext2_filsys fs,
|
|
||||||
dir_offset += rec_len;
|
|
||||||
if (dirent->inode == 0)
|
|
||||||
continue;
|
|
||||||
+ if ((name_len) == 0) {
|
|
||||||
+ fd->err = EXT2_ET_DIR_CORRUPTED;
|
|
||||||
+ return BLOCK_ABORT;
|
|
||||||
+ }
|
|
||||||
if (!fd->compress && (name_len == 1) &&
|
|
||||||
(dirent->name[0] == '.'))
|
|
||||||
continue;
|
|
||||||
@@ -401,6 +405,11 @@ static int duplicate_search_and_fix(e2fsck_t ctx, ext2_filsys fs,
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
new_len = ext2fs_dirent_name_len(ent->dir);
|
|
||||||
+ if (new_len == 0) {
|
|
||||||
+ /* should never happen */
|
|
||||||
+ ext2fs_unmark_valid(fs);
|
|
||||||
+ continue;
|
|
||||||
+ }
|
|
||||||
memcpy(new_name, ent->dir->name, new_len);
|
|
||||||
mutate_name(new_name, &new_len);
|
|
||||||
for (j=0; j < fd->num_array; j++) {
|
|
||||||
--
|
|
||||||
1.8.3.1
|
|
||||||
|
|
||||||
@ -0,0 +1,63 @@
|
|||||||
|
From 851e3f835614371ab4e21c36f2ddcb6f0312a8bb Mon Sep 17 00:00:00 2001
|
||||||
|
From: ZhiqiangLiu <lzhq28@mail.ustc.edu.cn>
|
||||||
|
Date: Wed, 15 Jul 2020 21:20:25 +0800
|
||||||
|
Subject: [PATCH] e2fsprogs: set hugefile from 4T to 1T in hugefile test
|
||||||
|
|
||||||
|
When execing make check, 4T is too large for CI,
|
||||||
|
so set hugefile from 4T to 1T in hugefile test.
|
||||||
|
|
||||||
|
Signed-off-by: Zhiqiang Liu <lzhq28@mail.ustc.edu.cn>
|
||||||
|
---
|
||||||
|
tests/m_hugefile/expect | 14 +++++++-------
|
||||||
|
tests/m_hugefile/script | 4 ++--
|
||||||
|
2 files changed, 9 insertions(+), 9 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/tests/m_hugefile/expect b/tests/m_hugefile/expect
|
||||||
|
index ee33fe5..170387a 100644
|
||||||
|
--- a/tests/m_hugefile/expect
|
||||||
|
+++ b/tests/m_hugefile/expect
|
||||||
|
@@ -1,19 +1,19 @@
|
||||||
|
-mke2fs -F -T hugefile test.img 4T
|
||||||
|
-Creating filesystem with 1073741824 4k blocks and 1048576 inodes
|
||||||
|
+mke2fs -F -T hugefile test.img 1T
|
||||||
|
+Creating filesystem with 268435456 4k blocks and 262144 inodes
|
||||||
|
Superblock backups stored on blocks:
|
||||||
|
|
||||||
|
Allocating group tables: done
|
||||||
|
-Writing inode tables: done
|
||||||
|
+Writing inode tables: done
|
||||||
|
Creating 1 huge file(s) : done
|
||||||
|
-Writing superblocks and filesystem accounting information: done
|
||||||
|
+Writing superblocks and filesystem accounting information: done
|
||||||
|
|
||||||
|
Pass 1: Checking inodes, blocks, and sizes
|
||||||
|
Pass 2: Checking directory structure
|
||||||
|
Pass 3: Checking directory connectivity
|
||||||
|
Pass 4: Checking reference counts
|
||||||
|
Pass 5: Checking group summary information
|
||||||
|
-test_filesys: 13/1048576 files (0.0% non-contiguous), 1073709417/1073741824 blocks
|
||||||
|
+test_filesys: 13/262144 files (0.0% non-contiguous), 268394593/268435456 blocks
|
||||||
|
Exit status is 0
|
||||||
|
debugfs -R "extents /store/big-data" test.img
|
||||||
|
-Last logical block: 1073610751
|
||||||
|
-Last physical block: 1073741823
|
||||||
|
+Last logical block: 268369919
|
||||||
|
+Last physical block: 268435455
|
||||||
|
diff --git a/tests/m_hugefile/script b/tests/m_hugefile/script
|
||||||
|
index 1abdb7d..e576a21 100644
|
||||||
|
--- a/tests/m_hugefile/script
|
||||||
|
+++ b/tests/m_hugefile/script
|
||||||
|
@@ -35,8 +35,8 @@ cat > $CONF << ENDL
|
||||||
|
}
|
||||||
|
ENDL
|
||||||
|
|
||||||
|
-echo "mke2fs -F -T hugefile test.img 4T" > $OUT
|
||||||
|
-MKE2FS_CONFIG=$CONF $MKE2FS -F -T hugefile $TMPFILE 4T >> $OUT 2>&1
|
||||||
|
+echo "mke2fs -F -T hugefile test.img 1T" > $OUT
|
||||||
|
+MKE2FS_CONFIG=$CONF $MKE2FS -F -T hugefile $TMPFILE 1T >> $OUT 2>&1
|
||||||
|
rm -f $CONF
|
||||||
|
|
||||||
|
# check the file system if we get this far, we succeeded...
|
||||||
|
--
|
||||||
|
2.21.1 (Apple Git-122.3)
|
||||||
|
|
||||||
@ -1,212 +0,0 @@
|
|||||||
From 8dbe7b475ec5e91ed767239f0e85880f416fc384 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Theodore Ts'o <tytso@mit.edu>
|
|
||||||
Date: Sun, 1 Sep 2019 00:59:16 -0400
|
|
||||||
Subject: [PATCH] libsupport: add checks to prevent buffer overrun bugs in
|
|
||||||
quota code
|
|
||||||
|
|
||||||
A maliciously corrupted file systems can trigger buffer overruns in
|
|
||||||
the quota code used by e2fsck. To fix this, add sanity checks to the
|
|
||||||
quota header fields as well as to block number references in the quota
|
|
||||||
tree.
|
|
||||||
|
|
||||||
Addresses: CVE-2019-5094
|
|
||||||
Addresses: TALOS-2019-0887
|
|
||||||
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
|
|
||||||
---
|
|
||||||
lib/support/mkquota.c | 1 +
|
|
||||||
lib/support/quotaio_tree.c | 71 ++++++++++++++++++++++++++++++----------------
|
|
||||||
lib/support/quotaio_v2.c | 28 ++++++++++++++++++
|
|
||||||
3 files changed, 76 insertions(+), 24 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/lib/support/mkquota.c b/lib/support/mkquota.c
|
|
||||||
index 0b9e766..ddb5312 100644
|
|
||||||
--- a/lib/support/mkquota.c
|
|
||||||
+++ b/lib/support/mkquota.c
|
|
||||||
@@ -671,6 +671,7 @@ errcode_t quota_compare_and_update(quota_ctx_t qctx, enum quota_type qtype,
|
|
||||||
err = qh.qh_ops->scan_dquots(&qh, scan_dquots_callback, &scan_data);
|
|
||||||
if (err) {
|
|
||||||
log_debug("Error scanning dquots");
|
|
||||||
+ *usage_inconsistent = 1;
|
|
||||||
goto out_close_qh;
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/lib/support/quotaio_tree.c b/lib/support/quotaio_tree.c
|
|
||||||
index a7c2028..6cc4fb5 100644
|
|
||||||
--- a/lib/support/quotaio_tree.c
|
|
||||||
+++ b/lib/support/quotaio_tree.c
|
|
||||||
@@ -540,6 +540,17 @@ struct dquot *qtree_read_dquot(struct quota_handle *h, qid_t id)
|
|
||||||
return dquot;
|
|
||||||
}
|
|
||||||
|
|
||||||
+static int check_reference(struct quota_handle *h, unsigned int blk)
|
|
||||||
+{
|
|
||||||
+ if (blk >= h->qh_info.u.v2_mdqi.dqi_qtree.dqi_blocks) {
|
|
||||||
+ log_err("Illegal reference (%u >= %u) in %s quota file",
|
|
||||||
+ blk, h->qh_info.u.v2_mdqi.dqi_qtree.dqi_blocks,
|
|
||||||
+ quota_type2name(h->qh_type));
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
/*
|
|
||||||
* Scan all dquots in file and call callback on each
|
|
||||||
*/
|
|
||||||
@@ -558,7 +569,7 @@ static int report_block(struct dquot *dquot, unsigned int blk, char *bitmap,
|
|
||||||
int entries, i;
|
|
||||||
|
|
||||||
if (!buf)
|
|
||||||
- return 0;
|
|
||||||
+ return -1;
|
|
||||||
|
|
||||||
set_bit(bitmap, blk);
|
|
||||||
read_blk(dquot->dq_h, blk, buf);
|
|
||||||
@@ -580,23 +591,12 @@ static int report_block(struct dquot *dquot, unsigned int blk, char *bitmap,
|
|
||||||
return entries;
|
|
||||||
}
|
|
||||||
|
|
||||||
-static void check_reference(struct quota_handle *h, unsigned int blk)
|
|
||||||
-{
|
|
||||||
- if (blk >= h->qh_info.u.v2_mdqi.dqi_qtree.dqi_blocks)
|
|
||||||
- log_err("Illegal reference (%u >= %u) in %s quota file. "
|
|
||||||
- "Quota file is probably corrupted.\n"
|
|
||||||
- "Please run e2fsck (8) to fix it.",
|
|
||||||
- blk,
|
|
||||||
- h->qh_info.u.v2_mdqi.dqi_qtree.dqi_blocks,
|
|
||||||
- quota_type2name(h->qh_type));
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
static int report_tree(struct dquot *dquot, unsigned int blk, int depth,
|
|
||||||
char *bitmap,
|
|
||||||
int (*process_dquot) (struct dquot *, void *),
|
|
||||||
void *data)
|
|
||||||
{
|
|
||||||
- int entries = 0, i;
|
|
||||||
+ int entries = 0, ret, i;
|
|
||||||
dqbuf_t buf = getdqbuf();
|
|
||||||
__le32 *ref = (__le32 *) buf;
|
|
||||||
|
|
||||||
@@ -607,22 +607,40 @@ static int report_tree(struct dquot *dquot, unsigned int blk, int depth,
|
|
||||||
if (depth == QT_TREEDEPTH - 1) {
|
|
||||||
for (i = 0; i < QT_BLKSIZE >> 2; i++) {
|
|
||||||
blk = ext2fs_le32_to_cpu(ref[i]);
|
|
||||||
- check_reference(dquot->dq_h, blk);
|
|
||||||
- if (blk && !get_bit(bitmap, blk))
|
|
||||||
- entries += report_block(dquot, blk, bitmap,
|
|
||||||
- process_dquot, data);
|
|
||||||
+ if (check_reference(dquot->dq_h, blk)) {
|
|
||||||
+ entries = -1;
|
|
||||||
+ goto errout;
|
|
||||||
+ }
|
|
||||||
+ if (blk && !get_bit(bitmap, blk)) {
|
|
||||||
+ ret = report_block(dquot, blk, bitmap,
|
|
||||||
+ process_dquot, data);
|
|
||||||
+ if (ret < 0) {
|
|
||||||
+ entries = ret;
|
|
||||||
+ goto errout;
|
|
||||||
+ }
|
|
||||||
+ entries += ret;
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (i = 0; i < QT_BLKSIZE >> 2; i++) {
|
|
||||||
blk = ext2fs_le32_to_cpu(ref[i]);
|
|
||||||
if (blk) {
|
|
||||||
- check_reference(dquot->dq_h, blk);
|
|
||||||
- entries += report_tree(dquot, blk, depth + 1,
|
|
||||||
- bitmap, process_dquot,
|
|
||||||
- data);
|
|
||||||
+ if (check_reference(dquot->dq_h, blk)) {
|
|
||||||
+ entries = -1;
|
|
||||||
+ goto errout;
|
|
||||||
+ }
|
|
||||||
+ ret = report_tree(dquot, blk, depth + 1,
|
|
||||||
+ bitmap, process_dquot,
|
|
||||||
+ data);
|
|
||||||
+ if (ret < 0) {
|
|
||||||
+ entries = ret;
|
|
||||||
+ goto errout;
|
|
||||||
+ }
|
|
||||||
+ entries += ret;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+errout:
|
|
||||||
freedqbuf(buf);
|
|
||||||
return entries;
|
|
||||||
}
|
|
||||||
@@ -642,6 +660,7 @@ int qtree_scan_dquots(struct quota_handle *h,
|
|
||||||
int (*process_dquot) (struct dquot *, void *),
|
|
||||||
void *data)
|
|
||||||
{
|
|
||||||
+ int ret;
|
|
||||||
char *bitmap;
|
|
||||||
struct v2_mem_dqinfo *v2info = &h->qh_info.u.v2_mdqi;
|
|
||||||
struct qtree_mem_dqinfo *info = &v2info->dqi_qtree;
|
|
||||||
@@ -655,10 +674,14 @@ int qtree_scan_dquots(struct quota_handle *h,
|
|
||||||
ext2fs_free_mem(&dquot);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
- v2info->dqi_used_entries = report_tree(dquot, QT_TREEOFF, 0, bitmap,
|
|
||||||
- process_dquot, data);
|
|
||||||
+ ret = report_tree(dquot, QT_TREEOFF, 0, bitmap, process_dquot, data);
|
|
||||||
+ if (ret < 0)
|
|
||||||
+ goto errout;
|
|
||||||
+ v2info->dqi_used_entries = ret;
|
|
||||||
v2info->dqi_data_blocks = find_set_bits(bitmap, info->dqi_blocks);
|
|
||||||
+ ret = 0;
|
|
||||||
+errout:
|
|
||||||
ext2fs_free_mem(&bitmap);
|
|
||||||
ext2fs_free_mem(&dquot);
|
|
||||||
- return 0;
|
|
||||||
+ return ret;
|
|
||||||
}
|
|
||||||
diff --git a/lib/support/quotaio_v2.c b/lib/support/quotaio_v2.c
|
|
||||||
index 38be2a3..7390667 100644
|
|
||||||
--- a/lib/support/quotaio_v2.c
|
|
||||||
+++ b/lib/support/quotaio_v2.c
|
|
||||||
@@ -175,6 +175,8 @@ static int v2_check_file(struct quota_handle *h, int type, int fmt)
|
|
||||||
static int v2_init_io(struct quota_handle *h)
|
|
||||||
{
|
|
||||||
struct v2_disk_dqinfo ddqinfo;
|
|
||||||
+ struct v2_mem_dqinfo *info;
|
|
||||||
+ __u64 filesize;
|
|
||||||
|
|
||||||
h->qh_info.u.v2_mdqi.dqi_qtree.dqi_entry_size =
|
|
||||||
sizeof(struct v2r1_disk_dqblk);
|
|
||||||
@@ -185,6 +187,32 @@ static int v2_init_io(struct quota_handle *h)
|
|
||||||
sizeof(ddqinfo)) != sizeof(ddqinfo))
|
|
||||||
return -1;
|
|
||||||
v2_disk2memdqinfo(&h->qh_info, &ddqinfo);
|
|
||||||
+
|
|
||||||
+ /* Check to make sure quota file info is sane */
|
|
||||||
+ info = &h->qh_info.u.v2_mdqi;
|
|
||||||
+ if (ext2fs_file_get_lsize(h->qh_qf.e2_file, &filesize))
|
|
||||||
+ return -1;
|
|
||||||
+ if ((filesize > (1U << 31)) ||
|
|
||||||
+ (info->dqi_qtree.dqi_blocks >
|
|
||||||
+ (filesize + QT_BLKSIZE - 1) >> QT_BLKSIZE_BITS)) {
|
|
||||||
+ log_err("Quota inode %u corrupted: file size %llu; "
|
|
||||||
+ "dqi_blocks %u", h->qh_qf.ino,
|
|
||||||
+ filesize, info->dqi_qtree.dqi_blocks);
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
+ if (info->dqi_qtree.dqi_free_blk >= info->dqi_qtree.dqi_blocks) {
|
|
||||||
+ log_err("Quota inode %u corrupted: free_blk %u; dqi_blocks %u",
|
|
||||||
+ h->qh_qf.ino, info->dqi_qtree.dqi_free_blk,
|
|
||||||
+ info->dqi_qtree.dqi_blocks);
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
+ if (info->dqi_qtree.dqi_free_entry >= info->dqi_qtree.dqi_blocks) {
|
|
||||||
+ log_err("Quota inode %u corrupted: free_entry %u; "
|
|
||||||
+ "dqi_blocks %u", h->qh_qf.ino,
|
|
||||||
+ info->dqi_qtree.dqi_free_entry,
|
|
||||||
+ info->dqi_qtree.dqi_blocks);
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
--
|
|
||||||
1.8.3.1
|
|
||||||
|
|
||||||
Binary file not shown.
BIN
e2fsprogs-1.45.6.tar.xz
Normal file
BIN
e2fsprogs-1.45.6.tar.xz
Normal file
Binary file not shown.
@ -1,14 +1,12 @@
|
|||||||
Name: e2fsprogs
|
Name: e2fsprogs
|
||||||
Version: 1.45.3
|
Version: 1.45.6
|
||||||
Release: 5
|
Release: 1
|
||||||
Summary: Second extended file system management tools
|
Summary: Second extended file system management tools
|
||||||
License: GPLv2 and LGPLv2 and MIT
|
License: GPLv2 and LGPLv2 and MIT
|
||||||
URL: http://e2fsprogs.sourceforge.net/
|
URL: http://e2fsprogs.sourceforge.net/
|
||||||
Source0: https://www.kernel.org/pub/linux/kernel/people/tytso/%{name}/v%{version}/%{name}-%{version}.tar.xz
|
Source0: https://www.kernel.org/pub/linux/kernel/people/tytso/%{name}/v%{version}/%{name}-%{version}.tar.xz
|
||||||
|
|
||||||
Patch0: 0000-e2fsck-abort-if-there-is-a-corrupted-directory-block.patch
|
Patch1: 0001-e2fsprogs-set-hugefile-from-4T-to-1T-in-hugefile-tes.patch
|
||||||
Patch1: 0001-libsupport-add-checks-to-prevent-buffer-overrun-bugs.patch
|
|
||||||
Patch2: 0002-mke2fs-check.patch
|
|
||||||
|
|
||||||
BuildRequires: gcc git pkgconfig texinfo
|
BuildRequires: gcc git pkgconfig texinfo
|
||||||
BuildRequires: fuse-devel libblkid-devel libuuid-devel
|
BuildRequires: fuse-devel libblkid-devel libuuid-devel
|
||||||
@ -128,6 +126,9 @@ exit 0
|
|||||||
%{_mandir}/man8/*
|
%{_mandir}/man8/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Jul 15 2020 Zhiqiang Liu <lzhq28@mail.ustc.edu.cn> - 1.45.6-1
|
||||||
|
- rebuild package
|
||||||
|
|
||||||
* Wed Jul 1 2020 Wu Bo <wubo009@163.com> - 1.45.3-5
|
* Wed Jul 1 2020 Wu Bo <wubo009@163.com> - 1.45.3-5
|
||||||
- rebuild package
|
- rebuild package
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user