diff options
| author | Andreas Wellving <andreas.wellving@enea.com> | 2018-10-12 15:09:52 +0200 |
|---|---|---|
| committer | Adrian Dudau <Adrian.Dudau@enea.com> | 2018-10-16 17:39:26 +0200 |
| commit | 5580db5bda636e69110ab0bf0733192bd1050fbc (patch) | |
| tree | f1f35e54bee0088a980540a53a7b3ce65f229c8d | |
| parent | 24146be922365586abe10ef58bee2198645abe5f (diff) | |
| download | enea-kernel-cache-5580db5bda636e69110ab0bf0733192bd1050fbc.tar.gz | |
ext4: CVE-2018-10879
ext4: make sure bitmaps and the inode table don't overlap with bg descriptors
References:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5369a762c882c0b6e9599e4ebbb3a9ba9eee7e2d
Signed-off-by: Andreas Wellving <andreas.wellving@enea.com>
Change-Id: I6b3e2539d53ec7021ecd4ff4055cf66e42a5248a
| -rw-r--r-- | patches/cve/4.9.x.scc | 1 | ||||
| -rw-r--r-- | patches/cve/CVE-2018-10879-ext4-make-sure-bitmaps-and-the-inode-table-don-t-ove.patch | 83 |
2 files changed, 84 insertions, 0 deletions
diff --git a/patches/cve/4.9.x.scc b/patches/cve/4.9.x.scc index 08429b4..e5bf4ac 100644 --- a/patches/cve/4.9.x.scc +++ b/patches/cve/4.9.x.scc | |||
| @@ -30,4 +30,5 @@ patch CVE-2018-9518-NFC-llcp-Limit-size-of-SDP-URI.patch | |||
| 30 | patch CVE-2018-10876-ext4-only-look-at-the-bg_flags-field-if-it-is-valid.patch | 30 | patch CVE-2018-10876-ext4-only-look-at-the-bg_flags-field-if-it-is-valid.patch |
| 31 | patch CVE-2018-10877-ext4-verify-the-depth-of-extent-tree-in-ext4_find_ex.patch | 31 | patch CVE-2018-10877-ext4-verify-the-depth-of-extent-tree-in-ext4_find_ex.patch |
| 32 | patch CVE-2018-10878-ext4-always-check-block-group-bounds-in-ext4_init_bl.patch | 32 | patch CVE-2018-10878-ext4-always-check-block-group-bounds-in-ext4_init_bl.patch |
| 33 | patch CVE-2018-10879-ext4-make-sure-bitmaps-and-the-inode-table-don-t-ove.patch | ||
| 33 | 34 | ||
diff --git a/patches/cve/CVE-2018-10879-ext4-make-sure-bitmaps-and-the-inode-table-don-t-ove.patch b/patches/cve/CVE-2018-10879-ext4-make-sure-bitmaps-and-the-inode-table-don-t-ove.patch new file mode 100644 index 0000000..439c9e9 --- /dev/null +++ b/patches/cve/CVE-2018-10879-ext4-make-sure-bitmaps-and-the-inode-table-don-t-ove.patch | |||
| @@ -0,0 +1,83 @@ | |||
| 1 | From 77260807d1170a8cf35dbb06e07461a655f67eee Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Theodore Ts'o <tytso@mit.edu> | ||
| 3 | Date: Wed, 13 Jun 2018 23:08:26 -0400 | ||
| 4 | Subject: [PATCH] ext4: make sure bitmaps and the inode table don't overlap | ||
| 5 | with bg descriptors | ||
| 6 | |||
| 7 | It's really bad when the allocation bitmaps and the inode table | ||
| 8 | overlap with the block group descriptors, since it causes random | ||
| 9 | corruption of the bg descriptors. So we really want to head those off | ||
| 10 | at the pass. | ||
| 11 | |||
| 12 | https://bugzilla.kernel.org/show_bug.cgi?id=199865 | ||
| 13 | |||
| 14 | CVE: CVE-2018-10879 | ||
| 15 | Upstream-Status: Backport | ||
| 16 | |||
| 17 | Signed-off-by: Theodore Ts'o <tytso@mit.edu> | ||
| 18 | Cc: stable@kernel.org | ||
| 19 | Signed-off-by: Andreas Wellving <andreas.wellving@enea.com> | ||
| 20 | --- | ||
| 21 | fs/ext4/super.c | 25 +++++++++++++++++++++++++ | ||
| 22 | 1 file changed, 25 insertions(+) | ||
| 23 | |||
| 24 | diff --git a/fs/ext4/super.c b/fs/ext4/super.c | ||
| 25 | index c8b7b83..c61675d 100644 | ||
| 26 | --- a/fs/ext4/super.c | ||
| 27 | +++ b/fs/ext4/super.c | ||
| 28 | @@ -2348,6 +2348,7 @@ static int ext4_check_descriptors(struct super_block *sb, | ||
| 29 | struct ext4_sb_info *sbi = EXT4_SB(sb); | ||
| 30 | ext4_fsblk_t first_block = le32_to_cpu(sbi->s_es->s_first_data_block); | ||
| 31 | ext4_fsblk_t last_block; | ||
| 32 | + ext4_fsblk_t last_bg_block = sb_block + ext4_bg_num_gdb(sb, 0) + 1; | ||
| 33 | ext4_fsblk_t block_bitmap; | ||
| 34 | ext4_fsblk_t inode_bitmap; | ||
| 35 | ext4_fsblk_t inode_table; | ||
| 36 | @@ -2380,6 +2381,14 @@ static int ext4_check_descriptors(struct super_block *sb, | ||
| 37 | if (!sb_rdonly(sb)) | ||
| 38 | return 0; | ||
| 39 | } | ||
| 40 | + if (block_bitmap >= sb_block + 1 && | ||
| 41 | + block_bitmap <= last_bg_block) { | ||
| 42 | + ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: " | ||
| 43 | + "Block bitmap for group %u overlaps " | ||
| 44 | + "block group descriptors", i); | ||
| 45 | + if (!sb_rdonly(sb)) | ||
| 46 | + return 0; | ||
| 47 | + } | ||
| 48 | if (block_bitmap < first_block || block_bitmap > last_block) { | ||
| 49 | ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: " | ||
| 50 | "Block bitmap for group %u not in group " | ||
| 51 | @@ -2394,6 +2403,14 @@ static int ext4_check_descriptors(struct super_block *sb, | ||
| 52 | if (!sb_rdonly(sb)) | ||
| 53 | return 0; | ||
| 54 | } | ||
| 55 | + if (inode_bitmap >= sb_block + 1 && | ||
| 56 | + inode_bitmap <= last_bg_block) { | ||
| 57 | + ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: " | ||
| 58 | + "Inode bitmap for group %u overlaps " | ||
| 59 | + "block group descriptors", i); | ||
| 60 | + if (!sb_rdonly(sb)) | ||
| 61 | + return 0; | ||
| 62 | + } | ||
| 63 | if (inode_bitmap < first_block || inode_bitmap > last_block) { | ||
| 64 | ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: " | ||
| 65 | "Inode bitmap for group %u not in group " | ||
| 66 | @@ -2408,6 +2425,14 @@ static int ext4_check_descriptors(struct super_block *sb, | ||
| 67 | if (!sb_rdonly(sb)) | ||
| 68 | return 0; | ||
| 69 | } | ||
| 70 | + if (inode_table >= sb_block + 1 && | ||
| 71 | + inode_table <= last_bg_block) { | ||
| 72 | + ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: " | ||
| 73 | + "Inode table for group %u overlaps " | ||
| 74 | + "block group descriptors", i); | ||
| 75 | + if (!sb_rdonly(sb)) | ||
| 76 | + return 0; | ||
| 77 | + } | ||
| 78 | if (inode_table < first_block || | ||
| 79 | inode_table + sbi->s_itb_per_group - 1 > last_block) { | ||
| 80 | ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: " | ||
| 81 | -- | ||
| 82 | 2.7.4 | ||
| 83 | |||
