Bug 202817 - Kernel panic - not syncing: Fatal exception in interrupt
Summary: Kernel panic - not syncing: Fatal exception in interrupt
Status: RESOLVED CODE_FIX
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 03:13 UTC by Jungyeon
Modified: 2022-10-06 21:44 UTC (History)
2 users (show)

See Also:
Kernel Version: 5.0-rc8
Subsystem:
Regression: No
Bisected commit-id:


Attachments
The (compressed) crafted image which causes crash (167.00 KB, application/zip)
2019-03-08 03:13 UTC, Jungyeon
Details
01.c (3.20 KB, text/x-csrc)
2019-03-08 05:14 UTC, Jungyeon
Details

Description Jungyeon 2019-03-08 03:13:55 UTC
Created attachment 281589 [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 01.img test 
gcc 01.c
cp a.out test
cd test
./a.out

- Kernel messages
[ 2772.133834] btrfs bad mapping eb start 29761536 len 4096, wanted 18236 18446744073705343172
[ 2772.140992] BUG: unable to handle kernel paging request at ffff98776bedb000
[ 2772.142729] #PF error: [PROT] [WRITE]
[ 2772.143654] PGD 103201067 P4D 103201067 PUD 2366b2063 PMD 22f84a063 PTE 800000022bedb061
[ 2772.145641] Oops: 0003 [#1] SMP PTI
[ 2772.146513] CPU: 0 PID: 1158 Comm: a.out Tainted: G        W         5.0.0-rc8+ #9
[ 2772.148360] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014
[ 2772.150534] RIP: 0010:__memset+0x24/0x30
[ 2772.151516] 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
[ 2772.156045] RSP: 0018:ffffa78a01263b98 EFLAGS: 00010206
[ 2772.157331] RAX: 0000000000000000 RBX: ffffffffffbfc8c4 RCX: 1fffffffffee2993
[ 2772.159074] RDX: 0000000000000004 RSI: 0000000000000000 RDI: ffff98776bedb000
[ 2772.160820] RBP: ffffa78a01263bb0 R08: 0000000000000001 R09: ffff98776b9f33d8
[ 2772.162557] R10: 0000000000000000 R11: ffffa78a012639ed R12: ffff98776b9f33d8
[ 2772.164302] R13: 0000000000000000 R14: 0000000004c00000 R15: 0000000000001000
[ 2772.166043] FS:  00007f703396b700(0000) GS:ffff987777a00000(0000) knlGS:0000000000000000
[ 2772.168028] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 2772.169445] CR2: ffff98776bedb000 CR3: 000000023639e004 CR4: 00000000000206f0
[ 2772.171201] Call Trace:
[ 2772.171823]  ? read_extent_buffer+0x137/0x140
[ 2772.172897]  __btrfs_lookup_bio_sums+0x449/0x690
[ 2772.174029]  btrfs_lookup_bio_sums+0x16/0x20
[ 2772.175079]  btrfs_submit_bio_hook+0xc3/0x180
[ 2772.176163]  submit_one_bio+0x5d/0x80
[ 2772.177078]  extent_read_full_page+0x56/0x70
[ 2772.178139]  btrfs_readpage+0x25/0x30
[ 2772.179053]  generic_file_read_iter+0x615/0xc70
[ 2772.180180]  ? __page_cache_alloc+0x20/0x20
[ 2772.181216]  __vfs_read+0x11f/0x1a0
[ 2772.182083]  vfs_read+0x95/0x140
[ 2772.182889]  ksys_read+0x55/0xc0
[ 2772.183765]  __x64_sys_read+0x1a/0x20
[ 2772.184679]  do_syscall_64+0x5a/0x110
[ 2772.185588]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[ 2772.186828] RIP: 0033:0x7f70334864d9
[ 2772.187746] 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
[ 2772.192361] RSP: 002b:00007ffe7f3caf88 EFLAGS: 00000203 ORIG_RAX: 0000000000000000
[ 2772.194243] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f70334864d9
[ 2772.196080] RDX: 00000000000009e4 RSI: 00007ffe7f3cb230 RDI: 0000000000000003
[ 2772.197844] RBP: 00007ffe7f3cf240 R08: 00007ffe7f3cf328 R09: 00007ffe7f3cf328
[ 2772.199616] R10: 00007f703375fab0 R11: 0000000000000203 R12: 00000000004004e0
[ 2772.201379] R13: 00007ffe7f3cf320 R14: 0000000000000000 R15: 0000000000000000
[ 2772.203149] Modules linked in:
[ 2772.203949] CR2: ffff98776bedb000
[ 2772.204802] ---[ end trace 0fc17a5cbcee5e06 ]---
[ 2772.205963] RIP: 0010:__memset+0x24/0x30
[ 2772.206947] 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
[ 2772.211562] RSP: 0018:ffffa78a01263b98 EFLAGS: 00010206
[ 2772.212863] RAX: 0000000000000000 RBX: ffffffffffbfc8c4 RCX: 1fffffffffee2993
[ 2772.214613] RDX: 0000000000000004 RSI: 0000000000000000 RDI: ffff98776bedb000
[ 2772.216386] RBP: ffffa78a01263bb0 R08: 0000000000000001 R09: ffff98776b9f33d8
[ 2772.218143] R10: 0000000000000000 R11: ffffa78a012639ed R12: ffff98776b9f33d8
[ 2772.219909] R13: 0000000000000000 R14: 0000000004c00000 R15: 0000000000001000
[ 2772.221674] FS:  00007f703396b700(0000) GS:ffff987777a00000(0000) knlGS:0000000000000000
[ 2772.223668] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 2772.225093] CR2: ffff98776bedb000 CR3: 000000023639e004 CR4: 00000000000206f0
[ 2772.226886] BUG: unable to handle kernel NULL pointer dereference at 0000000000000000
[ 2772.228847] #PF error: [INSTR]
[ 2772.229625] PGD 800000022b8ff067 P4D 800000022b8ff067 PUD 22ad00067 PMD 0 
[ 2772.231345] Oops: 0010 [#2] SMP PTI
[ 2772.232225] CPU: 0 PID: 643 Comm: in:imklog Tainted: G      D W         5.0.0-rc8+ #9
[ 2772.234156] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014
[ 2772.236373] RIP: 0010:          (null)
[ 2772.237329] Code: Bad RIP value.
[ 2772.238154] RSP: 0018:ffff987777a03d88 EFLAGS: 00010046
[ 2772.239472] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
[ 2772.241243] RDX: 0000000000000000 RSI: 0000000000000001 RDI: ffff98776bae4960
[ 2772.243007] RBP: ffff987777a03dd0 R08: 0000000000000000 R09: ffff987777a03de8
[ 2772.244787] R10: 0000000000000000 R11: 0000000000000000 R12: ffff987777a03de8
[ 2772.246555] R13: ffffffffffffffe8 R14: ffffffffa5c7e018 R15: 0000000000000000
[ 2772.248334] FS:  00007f66f6549700(0000) GS:ffff987777a00000(0000) knlGS:0000000000000000
[ 2772.250331] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 2772.251768] CR2: ffffffffffffffd6 CR3: 000000022b8e2001 CR4: 00000000000206f0
[ 2772.253535] Call Trace:
[ 2772.254173]  <IRQ>
[ 2772.254721]  ? __wake_up_common+0x8c/0x130
[ 2772.255771]  __wake_up_common_lock+0x80/0xc0
[ 2772.256844]  __wake_up+0x13/0x20
[ 2772.257673]  wake_up_klogd_work_func+0x40/0x60
[ 2772.258805]  irq_work_run_list+0x55/0x80
[ 2772.259823]  ? tick_sched_do_timer+0x60/0x60
[ 2772.260902]  irq_work_tick+0x40/0x50
[ 2772.261819]  update_process_times+0x42/0x60
[ 2772.262879]  tick_sched_handle+0x29/0x60
[ 2772.263879]  tick_sched_timer+0x3c/0x80
[ 2772.264849]  __hrtimer_run_queues+0x106/0x270
[ 2772.265946]  hrtimer_interrupt+0x116/0x240
[ 2772.266980]  smp_apic_timer_interrupt+0x6f/0x150
[ 2772.268150]  apic_timer_interrupt+0xf/0x20
[ 2772.269178]  </IRQ>
[ 2772.269728] RIP: 0010:finish_task_switch+0x75/0x270
[ 2772.270949] Code: 10 65 4c 8b 24 25 00 5c 01 00 66 66 66 66 90 66 66 66 66 90 41 c7 45 38 00 00 00 00 48 89 df c6 07 00 66 66 66 90 fb 66 66 90 <66> 66 90 65 48 8b 04 25 00 5c 01 00 66 66 66 66 90 4d 85 f6 74 1a
[ 2772.275567] RSP: 0018:ffffa78a0108fc90 EFLAGS: 00000246 ORIG_RAX: ffffffffffffff13
[ 2772.277484] RAX: 0000000080000000 RBX: ffff987777a22c40 RCX: 0000000000000000
[ 2772.279277] RDX: 0000000080000000 RSI: 00000000f6549700 RDI: ffff987777a22c40
[ 2772.281063] RBP: ffffa78a0108fcb8 R08: 0000000000000000 R09: 00000000000003c8
[ 2772.282851] R10: ffffa78a01263d40 R11: ffffa78a012636e5 R12: ffff987775573f00
[ 2772.284640] R13: ffff98777552e900 R14: 0000000000000000 R15: 0000000000000000
[ 2772.286415]  __schedule+0x3f9/0x8b0
[ 2772.287320]  ? ttwu_do_wakeup+0x1e/0x150
[ 2772.288316]  schedule+0x36/0x70
[ 2772.289120]  do_syslog+0x7e4/0x890
[ 2772.289989]  ? wait_woken+0x80/0x80
[ 2772.290894]  kmsg_read+0x44/0x60
[ 2772.291748]  proc_reg_read+0x45/0x70
[ 2772.292667]  __vfs_read+0x3a/0x1a0
[ 2772.293543]  ? security_file_permission+0xa0/0xf0
[ 2772.294731]  vfs_read+0x95/0x140
[ 2772.295562]  ksys_read+0x55/0xc0
[ 2772.296386]  __x64_sys_read+0x1a/0x20
[ 2772.297312]  do_syscall_64+0x5a/0x110
[ 2772.298241]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[ 2772.299514] RIP: 0033:0x7f66f899851d
[ 2772.300422] Code: be 20 00 00 75 10 b8 00 00 00 00 0f 05 48 3d 01 f0 ff ff 73 31 c3 48 83 ec 08 e8 4e fc ff ff 48 89 04 24 b8 00 00 00 00 0f 05 <48> 8b 3c 24 48 89 c2 e8 97 fc ff ff 48 89 d0 48 83 c4 08 48 3d 01
[ 2772.305087] RSP: 002b:00007f66f6528580 EFLAGS: 00000293 ORIG_RAX: 0000000000000000
[ 2772.306979] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f66f899851d
[ 2772.308778] RDX: 0000000000001fa0 RSI: 00007f66f6528da0 RDI: 0000000000000004
[ 2772.310568] RBP: 000000000244c2d0 R08: 0000000000000000 R09: 0000000000000000
[ 2772.312360] R10: 00007f66f65283d0 R11: 0000000000000293 R12: 00007f66f6528da0
[ 2772.314140] R13: 0000000000001fa0 R14: 0000000000001f9f R15: 00007f66f6528ee6
[ 2772.315930] Modules linked in:
[ 2772.316715] CR2: 0000000000000000
[ 2772.317573] ---[ end trace 0fc17a5cbcee5e07 ]---
[ 2772.318740] RIP: 0010:__memset+0x24/0x30
[ 2772.319734] 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
[ 2772.324330] RSP: 0018:ffffa78a01263b98 EFLAGS: 00010206
[ 2772.325625] RAX: 0000000000000000 RBX: ffffffffffbfc8c4 RCX: 1fffffffffee2993
[ 2772.327390] RDX: 0000000000000004 RSI: 0000000000000000 RDI: ffff98776bedb000
[ 2772.329146] RBP: ffffa78a01263bb0 R08: 0000000000000001 R09: ffff98776b9f33d8
[ 2772.330905] R10: 0000000000000000 R11: ffffa78a012639ed R12: ffff98776b9f33d8
[ 2772.332671] R13: 0000000000000000 R14: 0000000004c00000 R15: 0000000000001000
[ 2772.334430] FS:  00007f66f6549700(0000) GS:ffff987777a00000(0000) knlGS:0000000000000000
[ 2772.336418] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 2772.337825] CR2: ffffffffffffffd6 CR3: 000000022b8e2001 CR4: 00000000000206f0
[ 2772.339597] Kernel panic - not syncing: Fatal exception in interrupt
[ 2772.354129] Kernel Offset: 0x23400000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff)
[ 2772.356811] ---[ end Kernel panic - not syncing: Fatal exception in interrupt ]---
Comment 1 Jungyeon 2019-03-08 05:14:47 UTC
Created attachment 281597 [details]
01.c

Need to wait few seconds after program finished to get the error.
Comment 2 Qu Wenruo 2019-07-09 07:42:19 UTC
This bug has been fixed by upstream commit 448de471cd4c ("btrfs: Check the first key and level for cached extent buffer").

Tested on v5.2 kernel, it will not reach read_extent_buffer() thus no triggering.

Although it shows we can enhance read/write/memcmp_extent_buffer().
I'll enhance related functions anyway.

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