Bug 202831 - BUG: unable to handle kernel paging request at ffff...
Summary: BUG: unable to handle kernel paging request at ffff...
Status: NEW
Alias: None
Product: File System
Classification: Unclassified
Component: btrfs (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: BTRFS virtual assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-03-08 08:30 UTC by Jungyeon
Modified: 2019-07-10 06:05 UTC (History)
1 user (show)

See Also:
Kernel Version: 5.0-rc8
Tree: Mainline
Regression: No


Attachments
The (compressed) crafted image which causes crash (166.70 KB, application/zip)
2019-03-08 08:30 UTC, Jungyeon
Details
min_25.c (581 bytes, text/x-csrc)
2019-03-08 08:30 UTC, Jungyeon
Details

Description Jungyeon 2019-03-08 08:30:09 UTC
Created attachment 281617 [details]
The (compressed) crafted image which causes crash

- Overview
After mounting crafted image, I got this kernel panic while running attached program.

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

- Kernel messages
[ 86.794624] btrfs bad mapping eb start 29761536 len 4096, wanted 1852 18446744072635812036
[ 86.797511] BUG: unable to handle kernel paging request at ffff8ef9ebef8000
[ 86.799257] #PF error: [PROT] [WRITE]
[ 86.800177] PGD 1cce01067 P4D 1cce01067 PUD 2366b2063 PMD 22a91b063 PTE 800000022bef8061
[ 86.802170] Oops: 0003 [#1] SMP PTI
[ 86.803046] CPU: 0 PID: 1103 Comm: a.out Tainted: G W 5.0.0-rc8+ #9
[ 86.804912] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014
[ 86.807117] RIP: 0010:__memset+0x24/0x30
[ 86.808098] Code: 90 90 90 90 90 90 66 66 90 66 90 49 89 f9 48 89 d1 83 e2 07 48 c1 e9 03 40 0f b6 f6 48 b8 01 01 01 01 01 01 01 01 48 0f af c6 <f3> 48 ab 89 d1 f3 aa 4c 89 c8 c3 90 49 89 f9 40 88 f0 48 89 d1 f3
[ 86.812667] RSP: 0018:ffffaa59c1107b98 EFLAGS: 00010206
[ 86.813975] RAX: 0000000000000000 RBX: ffffffffc00008c4 RCX: 1ffffffff7f5f7e3
[ 86.815728] RDX: 0000000000000004 RSI: 0000000000000000 RDI: ffff8ef9ebef8000
[ 86.817492] RBP: ffffaa59c1107bb0 R08: 0000000000000001 R09: ffff8ef9eb9f3658
[ 86.819244] R10: 0000000000000000 R11: ffffaa59c11079ed R12: ffff8ef9eb9f3658
[ 86.821019] R13: 0000000000000000 R14: 0000000004c00000 R15: 0000000000001000
[ 86.822786] FS: 00007f9f61f5c700(0000) GS:ffff8ef9f7a00000(0000) knlGS:0000000000000000
[ 86.824779] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 86.826221] CR2: ffff8ef9ebef8000 CR3: 000000022b880001 CR4: 00000000000206f0
[ 86.827993] Call Trace:
[ 86.828627] ? read_extent_buffer+0x137/0x140
[ 86.829732] __btrfs_lookup_bio_sums+0x449/0x690
[ 86.830890] btrfs_lookup_bio_sums+0x16/0x20
[ 86.831964] btrfs_submit_bio_hook+0xc3/0x180
[ 86.833069] submit_one_bio+0x5d/0x80
[ 86.833993] extent_read_full_page+0x56/0x70
[ 86.835064] btrfs_readpage+0x25/0x30
[ 86.835988] generic_file_read_iter+0x615/0xc70
[ 86.837131] ? __page_cache_alloc+0x20/0x20
[ 86.838185] __vfs_read+0x11f/0x1a0
[ 86.839064] vfs_read+0x95/0x140
[ 86.839878] ksys_read+0x55/0xc0
[ 86.840693] __x64_sys_read+0x1a/0x20
[ 86.841627] do_syscall_64+0x5a/0x110
[ 86.842546] entry_SYSCALL_64_after_hwframe+0x44/0xa9
[ 86.843801] RIP: 0033:0x7f9f61a774d9
[ 86.844699] Code: 00 f3 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 8f 29 2c 00 f7 d8 64 89 01 48
[ 86.849307] RSP: 002b:00007ffe520f5a28 EFLAGS: 00000203 ORIG_RAX: 0000000000000000
[ 86.851182] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f9f61a774d9
[ 86.853038] RDX: 00000000000009e4 RSI: 00007ffe520f5bd0 RDI: 0000000000000003
[ 86.855099] RBP: 00007ffe520f9be0 R08: 00007ffe520f9cc8 R09: 00007ffe520f9cc8
[ 86.857383] R10: 00007f9f61d50ab0 R11: 0000000000000203 R12: 00000000004004e0
[ 86.859626] R13: 00007ffe520f9cc0 R14: 0000000000000000 R15: 0000000000000000
[ 86.861986] Modules linked in:
[ 86.863012] CR2: ffff8ef9ebef8000
[ 86.863991] ---[ end trace 6e6fc3454d1c7ac8 ]---
[ 86.865406] RIP: 0010:__memset+0x24/0x30
[ 86.866714] Code: 90 90 90 90 90 90 66 66 90 66 90 49 89 f9 48 89 d1 83 e2 07 48 c1 e9 03 40 0f b6 f6 48 b8 01 01 01 01 01 01 01 01 48 0f af c6 <f3> 48 ab 89 d1 f3 aa 4c 89 c8 c3 90 49 89 f9 40 88 f0 48 89 d1 f3
[ 86.872457] RSP: 0018:ffffaa59c1107b98 EFLAGS: 00010206
[ 86.874091] RAX: 0000000000000000 RBX: ffffffffc00008c4 RCX: 1ffffffff7f5f7e3
[ 86.876432] RDX: 0000000000000004 RSI: 0000000000000000 RDI: ffff8ef9ebef8000
[ 86.878579] RBP: ffffaa59c1107bb0 R08: 0000000000000001 R09: ffff8ef9eb9f3658
[ 86.880607] R10: 0000000000000000 R11: ffffaa59c11079ed R12: ffff8ef9eb9f3658
[ 86.882833] R13: 0000000000000000 R14: 0000000004c00000 R15: 0000000000001000
[ 86.885196] FS: 00007f9f61f5c700(0000) GS:ffff8ef9f7a00000(0000) knlGS:0000000000000000
[ 86.887848] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 86.889760] CR2: ffff8ef9ebef8000 CR3: 000000022b880001 CR4: 00000000000206f0
[ 86.891966] BUG: unable to handle kernel NULL pointer dereference at 0000000000000000
[ 86.894528] #PF error: [INSTR]
[ 86.895553] PGD 800000022ec7f067 P4D 800000022ec7f067 PUD 22ec21067 PMD 0 
[ 86.897794] Oops: 0010 [#2] SMP PTI
[ 86.898964] CPU: 0 PID: 1103 Comm: a.out Tainted: G D W 5.0.0-rc8+ #9
[ 86.901403] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014
[ 86.903906] RIP: 0010: (null)
[ 86.904990] Code: Bad RIP value.
[ 86.905968] RSP: 0018:ffff8ef9f7a03d88 EFLAGS: 00010046
[ 86.907595] RAX: 0000000000000000 RBX: 0000000000000001 RCX: 0000000000000000
[ 86.909843] RDX: 0000000000000000 RSI: 0000000000000001 RDI: ffff8ef9ebb84768
[ 86.912023] RBP: ffff8ef9f7a03dd0 R08: 0000000000000000 R09: 0000000000000000
[ 86.914399] R10: 0000000000000400 R11: 0000000000000000 R12: ffff8ef9f7a03de8
[ 86.916723] R13: ffffffffffffffe8 R14: ffffffffbc67e018 R15: 0000000000000000
[ 86.918836] FS: 00007f9f61f5c700(0000) GS:ffff8ef9f7a00000(0000) knlGS:0000000000000000
[ 86.921181] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 86.922867] CR2: ffffffffffffffd6 CR3: 000000022b880001 CR4: 00000000000206f0
[ 86.925178] Call Trace:
[ 86.925952] <IRQ>
[ 86.926645] ? __wake_up_common+0x8c/0x130
[ 86.927827] __wake_up_common_lock+0x80/0xc0
[ 86.929070] __wake_up+0x13/0x20
[ 86.930034] wake_up_klogd_work_func+0x40/0x60
[ 86.931341] irq_work_run_list+0x55/0x80
[ 86.932416] ? tick_sched_do_timer+0x60/0x60
[ 86.933744] irq_work_tick+0x40/0x50
[ 86.934945] update_process_times+0x42/0x60
[ 86.936337] tick_sched_handle+0x29/0x60
[ 86.937661] tick_sched_timer+0x3c/0x80
[ 86.938920] __hrtimer_run_queues+0x106/0x270
[ 86.940198] hrtimer_interrupt+0x116/0x240
[ 86.941347] smp_apic_timer_interrupt+0x6f/0x150
[ 86.942655] apic_timer_interrupt+0xf/0x20
[ 86.943923] </IRQ>
[ 86.944593] RIP: 0010:__raw_spin_unlock_irq+0xf/0x20
[ 86.946153] Code: eb ae 4c 89 e7 e8 11 96 ff ff 5b 41 5c 41 5d 5d c3 66 2e 0f 1f 84 00 00 00 00 00 55 48 89 e5 c6 07 00 66 66 66 90 fb 66 66 90 <66> 66 90 5d c3 66 90 66 2e 0f 1f 84 00 00 00 00 00 66 66 66 66 90
[ 86.952021] RSP: 0018:ffffaa59c1107ed8 EFLAGS: 00000202 ORIG_RAX: ffffffffffffff13
[ 86.954390] RAX: 0000000000000000 RBX: ffff8ef9ed10d400 RCX: 0000000000000002
[ 86.956652] RDX: 0000000000000002 RSI: 0000000000000000 RDI: ffff8ef9ed10df34
[ 86.958851] RBP: ffffaa59c1107ed8 R08: 0000000000000001 R09: 0000000000000005
[ 86.961148] R10: ffff8ef9ed10d400 R11: ffffaa59c11076e5 R12: 0000000000000009
[ 86.963365] R13: ffff8ef9ed10df34 R14: ffff8ef9ed10d400 R15: 000000000000000b
[ 86.965587] do_exit+0xce/0xba0
[ 86.966647] rewind_stack_do_exit+0x17/0x20
[ 86.967831] RIP: 0033:0x7f9f61a774d9
[ 86.968999] Code: 00 f3 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 8f 29 2c 00 f7 d8 64 89 01 48
[ 86.974586] RSP: 002b:00007ffe520f5a28 EFLAGS: 00000203 ORIG_RAX: 0000000000000000
[ 86.976720] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f9f61a774d9
[ 86.979087] RDX: 00000000000009e4 RSI: 00007ffe520f5bd0 RDI: 0000000000000003
[ 86.981446] RBP: 00007ffe520f9be0 R08: 00007ffe520f9cc8 R09: 00007ffe520f9cc8
[ 86.983751] R10: 00007f9f61d50ab0 R11: 0000000000000203 R12: 00000000004004e0
[ 86.985802] R13: 00007ffe520f9cc0 R14: 0000000000000000 R15: 0000000000000000
[ 86.987818] Modules linked in:
[ 86.988699] CR2: 0000000000000000
[ 86.989649] ---[ end trace 6e6fc3454d1c7ac9 ]---
[ 86.991070] RIP: 0010:__memset+0x24/0x30
[ 86.992289] Code: 90 90 90 90 90 90 66 66 90 66 90 49 89 f9 48 89 d1 83 e2 07 48 c1 e9 03 40 0f b6 f6 48 b8 01 01 01 01 01 01 01 01 48 0f af c6 <f3> 48 ab 89 d1 f3 aa 4c 89 c8 c3 90 49 89 f9 40 88 f0 48 89 d1 f3
[ 86.997967] RSP: 0018:ffffaa59c1107b98 EFLAGS: 00010206
[ 86.999658] RAX: 0000000000000000 RBX: ffffffffc00008c4 RCX: 1ffffffff7f5f7e3
[ 87.001891] RDX: 0000000000000004 RSI: 0000000000000000 RDI: ffff8ef9ebef8000
[ 87.003920] RBP: ffffaa59c1107bb0 R08: 0000000000000001 R09: ffff8ef9eb9f3658
[ 87.005892] R10: 0000000000000000 R11: ffffaa59c11079ed R12: ffff8ef9eb9f3658
[ 87.008026] R13: 0000000000000000 R14: 0000000004c00000 R15: 0000000000001000
[ 87.010241] FS: 00007f9f61f5c700(0000) GS:ffff8ef9f7a00000(0000) knlGS:0000000000000000
[ 87.012609] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 87.014486] CR2: ffffffffffffffd6 CR3: 000000022b880001 CR4: 00000000000206f0
[ 87.016464] Kernel panic - not syncing: Fatal exception in interrupt
[ 87.029605] Kernel Offset: 0x39e00000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff)
[ 87.032672] ---[ end Kernel panic - not syncing: Fatal exception in interrupt ]---
Comment 1 Jungyeon 2019-03-08 08:30:29 UTC
Created attachment 281619 [details]
min_25.c
Comment 2 Qu Wenruo 2019-07-10 06:05:19 UTC
Already fixed by upstream commit 448de471cd4c ("btrfs: Check the first key and level for cached extent buffer").

Note You need to log in before you can comment on or make changes to this bug.