-
Notifications
You must be signed in to change notification settings - Fork 249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG_ON !ce
triggered in volumes.c
#209
Comments
adam900710
added a commit
to adam900710/btrfs-progs
that referenced
this issue
Dec 17, 2019
[BUG] For a fuzzed image, `btrfs check` both modes trigger BUG_ON(): Opening filesystem to check... volumes.c:1795: btrfs_chunk_readonly: BUG_ON `!ce` triggered, value 1 btrfs(+0x2f712)[0x557beff3b712] btrfs(+0x32059)[0x557beff3e059] btrfs(btrfs_read_block_groups+0x282)[0x557beff30972] btrfs(btrfs_setup_all_roots+0x3f3)[0x557beff2ab23] btrfs(+0x1ef53)[0x557beff2af53] btrfs(open_ctree_fs_info+0x90)[0x557beff2b1a0] btrfs(+0x6d3f9)[0x557beff793f9] btrfs(main+0x94)[0x557beff200c4] /usr/lib/libc.so.6(__libc_start_main+0xf3)[0x7f623ac97ee3] btrfs(_start+0x2e)[0x557beff2035e] [CAUSE] The fuzzed image has a bad extent tree: item 0 key (288230376165343232 BLOCK_GROUP_ITEM 8388608) itemoff 16259 itemsize 24 block group used 0 chunk_objectid 256 flags DATA There is no corresponding chunk for the block group. In then we hit the BUG_ON(), which expects chunk mapping for btrfs_chunk_readonly(). [FIX] Remove that BUG_ON() with proper error handling. Although this makes certain corrupted extent tree get early failure, btrfs-progs utilizing OPEN_CTREE_NO_BLOCK_GROUPS can skip extent tree errors without problem. Thus it won't cause extra problem. Issue: kdave#209 Signed-off-by: Qu Wenruo <wqu@suse.com>
adam900710
added a commit
to adam900710/btrfs-progs
that referenced
this issue
Dec 17, 2019
[BUG] For a fuzzed image, `btrfs check` both modes trigger BUG_ON(): Opening filesystem to check... volumes.c:1795: btrfs_chunk_readonly: BUG_ON `!ce` triggered, value 1 btrfs(+0x2f712)[0x557beff3b712] btrfs(+0x32059)[0x557beff3e059] btrfs(btrfs_read_block_groups+0x282)[0x557beff30972] btrfs(btrfs_setup_all_roots+0x3f3)[0x557beff2ab23] btrfs(+0x1ef53)[0x557beff2af53] btrfs(open_ctree_fs_info+0x90)[0x557beff2b1a0] btrfs(+0x6d3f9)[0x557beff793f9] btrfs(main+0x94)[0x557beff200c4] /usr/lib/libc.so.6(__libc_start_main+0xf3)[0x7f623ac97ee3] btrfs(_start+0x2e)[0x557beff2035e] [CAUSE] The fuzzed image has a bad extent tree: item 0 key (288230376165343232 BLOCK_GROUP_ITEM 8388608) itemoff 16259 itemsize 24 block group used 0 chunk_objectid 256 flags DATA There is no corresponding chunk for the block group. In then we hit the BUG_ON(), which expects chunk mapping for btrfs_chunk_readonly(). [FIX] Remove that BUG_ON() with proper error handling, and make btrfs_read_block_groups() handle the -ENOENT error from read_one_block_group() to continue. So one corrupted block group item won't screw up the remaining block group items. Issue: kdave#209 Signed-off-by: Qu Wenruo <wqu@suse.com>
adam900710
added a commit
to adam900710/btrfs-progs
that referenced
this issue
Dec 17, 2019
[BUG] For a fuzzed image, `btrfs check` both modes trigger BUG_ON(): Opening filesystem to check... volumes.c:1795: btrfs_chunk_readonly: BUG_ON `!ce` triggered, value 1 btrfs(+0x2f712)[0x557beff3b712] btrfs(+0x32059)[0x557beff3e059] btrfs(btrfs_read_block_groups+0x282)[0x557beff30972] btrfs(btrfs_setup_all_roots+0x3f3)[0x557beff2ab23] btrfs(+0x1ef53)[0x557beff2af53] btrfs(open_ctree_fs_info+0x90)[0x557beff2b1a0] btrfs(+0x6d3f9)[0x557beff793f9] btrfs(main+0x94)[0x557beff200c4] /usr/lib/libc.so.6(__libc_start_main+0xf3)[0x7f623ac97ee3] btrfs(_start+0x2e)[0x557beff2035e] [CAUSE] The fuzzed image has a bad extent tree: item 0 key (288230376165343232 BLOCK_GROUP_ITEM 8388608) itemoff 16259 itemsize 24 block group used 0 chunk_objectid 256 flags DATA There is no corresponding chunk for the block group. In then we hit the BUG_ON(), which expects chunk mapping for btrfs_chunk_readonly(). [FIX] Remove that BUG_ON() with proper error handling, and make btrfs_read_block_groups() handle the -ENOENT error from read_one_block_group() to continue. So one corrupted block group item won't screw up the remaining block group items. Issue: kdave#209 Signed-off-by: Qu Wenruo <wqu@suse.com>
kdave
pushed a commit
that referenced
this issue
Jan 2, 2020
[BUG] For a fuzzed image, `btrfs check` both modes trigger BUG_ON(): Opening filesystem to check... volumes.c:1795: btrfs_chunk_readonly: BUG_ON `!ce` triggered, value 1 btrfs(+0x2f712)[0x557beff3b712] btrfs(+0x32059)[0x557beff3e059] btrfs(btrfs_read_block_groups+0x282)[0x557beff30972] btrfs(btrfs_setup_all_roots+0x3f3)[0x557beff2ab23] btrfs(+0x1ef53)[0x557beff2af53] btrfs(open_ctree_fs_info+0x90)[0x557beff2b1a0] btrfs(+0x6d3f9)[0x557beff793f9] btrfs(main+0x94)[0x557beff200c4] /usr/lib/libc.so.6(__libc_start_main+0xf3)[0x7f623ac97ee3] btrfs(_start+0x2e)[0x557beff2035e] [CAUSE] The fuzzed image has a bad extent tree: item 0 key (288230376165343232 BLOCK_GROUP_ITEM 8388608) itemoff 16259 itemsize 24 block group used 0 chunk_objectid 256 flags DATA There is no corresponding chunk for the block group. In then we hit the BUG_ON(), which expects chunk mapping for btrfs_chunk_readonly(). [FIX] Remove that BUG_ON() with proper error handling, and make btrfs_read_block_groups() handle the -ENOENT error from read_one_block_group() to continue. So one corrupted block group item won't screw up the remaining block group items. Issue: #209 Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
kdave
pushed a commit
that referenced
this issue
Jan 9, 2020
[BUG] For a fuzzed image, `btrfs check` both modes trigger BUG_ON(): Opening filesystem to check... volumes.c:1795: btrfs_chunk_readonly: BUG_ON `!ce` triggered, value 1 btrfs(+0x2f712)[0x557beff3b712] btrfs(+0x32059)[0x557beff3e059] btrfs(btrfs_read_block_groups+0x282)[0x557beff30972] btrfs(btrfs_setup_all_roots+0x3f3)[0x557beff2ab23] btrfs(+0x1ef53)[0x557beff2af53] btrfs(open_ctree_fs_info+0x90)[0x557beff2b1a0] btrfs(+0x6d3f9)[0x557beff793f9] btrfs(main+0x94)[0x557beff200c4] /usr/lib/libc.so.6(__libc_start_main+0xf3)[0x7f623ac97ee3] btrfs(_start+0x2e)[0x557beff2035e] [CAUSE] The fuzzed image has a bad extent tree: item 0 key (288230376165343232 BLOCK_GROUP_ITEM 8388608) itemoff 16259 itemsize 24 block group used 0 chunk_objectid 256 flags DATA There is no corresponding chunk for the block group. In then we hit the BUG_ON(), which expects chunk mapping for btrfs_chunk_readonly(). [FIX] Remove that BUG_ON() with proper error handling, and make btrfs_read_block_groups() handle the -ENOENT error from read_one_block_group() to continue. So one corrupted block group item won't screw up the remaining block group items. Issue: #209 Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Fixed in 5.4.1. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Running
btrfs check
on the attached minimal file system causes the following:Tested versions:
Data to reproduce:
The text was updated successfully, but these errors were encountered: