Bug 202821

Summary: kernel BUG at fs/btrfs/ctree.c:3894!
Product: File System Reporter: Jungyeon (jungyeon)
Component: btrfsAssignee: BTRFS virtual assignee (fs_btrfs)
Status: NEW ---    
Severity: normal    
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 5.0-rc8 Subsystem:
Regression: No Bisected commit-id:
Attachments: The (compressed) crafted image which causes crash
03.c

Description Jungyeon 2019-03-08 04:04:27 UTC
Created attachment 281593 [details]
The (compressed) crafted image which causes crash

Overview
After mounting crafted image, I got this kernel BUG message while running the attached program.

- Produces
mkdir test
mount -t btrfs 03.img test 
gcc 03.c
cp a.out test
cd test
./a.out

- Kernel messages
[ 88.415752] BTRFS critical (device sdb): corrupt leaf: root=7 block=29630464 slot=3, bad key order, prev (18446744073709551606 128 86507520) current (0 0 0)
[ 88.421736] kernel BUG at fs/btrfs/ctree.c:3894!
[ 88.422953] invalid opcode: 0000 [#1] SMP PTI
[ 88.424065] CPU: 0 PID: 1138 Comm: btrfs-transacti Not tainted 5.0.0-rc8+ #9
[ 88.425830] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014
[ 88.428080] RIP: 0010:__push_leaf_left+0x6b6/0x6e0
[ 88.429288] Code: 00 00 48 98 48 8d 04 80 48 8d 74 80 65 e8 42 5a 04 00 48 8b bd 78 ff ff ff 8b bf 90 d0 00 00 89 7d 98 83 ef 65 e9 06 ff ff ff <0f> 0b 0f 0b 48 8b 85 78 ff ff ff 8b 90 90 d0 00 00 e9 eb fe ff ff
[ 88.433944] RSP: 0018:ffffc0bd4128b990 EFLAGS: 00010246
[ 88.435264] RAX: 0000000000000000 RBX: ffffa0a4ab8f0e38 RCX: 0000000000000000
[ 88.437045] RDX: ffffa0a280000000 RSI: 0000000000000000 RDI: ffffa0a4b3814000
[ 88.438832] RBP: ffffc0bd4128ba38 R08: 0000000000001000 R09: ffffc0bd4128b948
[ 88.440620] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000240
[ 88.442415] R13: ffffa0a4b556fb60 R14: ffffa0a4ab8f0af0 R15: ffffa0a4ab8f0af0
[ 88.444198] FS: 0000000000000000(0000) GS:ffffa0a4b7a00000(0000) knlGS:0000000000000000
[ 88.446238] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 88.447675] CR2: 00007f2461c80020 CR3: 000000022b32a006 CR4: 00000000000206f0
[ 88.449455] Call Trace:
[ 88.450101] ? _cond_resched+0x1a/0x50
[ 88.451052] push_leaf_left+0x179/0x190
[ 88.452027] btrfs_del_items+0x316/0x470
[ 88.453025] btrfs_del_csums+0x215/0x3a0
[ 88.454030] __btrfs_free_extent.isra.72+0x5a7/0xbe0
[ 88.455286] __btrfs_run_delayed_refs+0x539/0x1120
[ 88.456499] btrfs_run_delayed_refs+0xdb/0x1b0
[ 88.457622] btrfs_commit_transaction+0x52/0x950
[ 88.458802] ? start_transaction+0x94/0x450
[ 88.459857] transaction_kthread+0x163/0x190
[ 88.460933] kthread+0x105/0x140
[ 88.461762] ? btrfs_cleanup_transaction+0x560/0x560
[ 88.463019] ? kthread_destroy_worker+0x50/0x50
[ 88.464166] ret_from_fork+0x35/0x40
[ 88.465075] Modules linked in:
[ 88.465883] ---[ end trace c2425e6e89b5558f ]---
[ 88.467081] RIP: 0010:__push_leaf_left+0x6b6/0x6e0
[ 88.468301] Code: 00 00 48 98 48 8d 04 80 48 8d 74 80 65 e8 42 5a 04 00 48 8b bd 78 ff ff ff 8b bf 90 d0 00 00 89 7d 98 83 ef 65 e9 06 ff ff ff <0f> 0b 0f 0b 48 8b 85 78 ff ff ff 8b 90 90 d0 00 00 e9 eb fe ff ff
[ 88.472992] RSP: 0018:ffffc0bd4128b990 EFLAGS: 00010246
[ 88.474330] RAX: 0000000000000000 RBX: ffffa0a4ab8f0e38 RCX: 0000000000000000
[ 88.476123] RDX: ffffa0a280000000 RSI: 0000000000000000 RDI: ffffa0a4b3814000
[ 88.477924] RBP: ffffc0bd4128ba38 R08: 0000000000001000 R09: ffffc0bd4128b948
[ 88.479734] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000240
[ 88.481546] R13: ffffa0a4b556fb60 R14: ffffa0a4ab8f0af0 R15: ffffa0a4ab8f0af0
[ 88.483359] FS: 0000000000000000(0000) GS:ffffa0a4b7a00000(0000) knlGS:0000000000000000
[ 88.485398] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 88.486865] CR2: 00007f2461c80020 CR3: 000000022b32a006 CR4: 00000000000206f0
Comment 1 Jungyeon 2019-03-08 05:15:33 UTC
Created attachment 281601 [details]
03.c

Need to wait few seconds after program finished to get the error.