syzbot


possible deadlock in exfat_get_block

Status: upstream: reported syz repro on 2023/03/29 01:00
Bug presence: origin:lts-only
[Documentation on labels]
Reported-by: syzbot+52857f945a44ca96bdd2@syzkaller.appspotmail.com
First crash: 622d, last: 489d
Bug presence (2)
Date Name Commit Repro Result
2023/05/20 linux-6.1.y (ToT) fa74641fb6b9 C [report] INFO: rcu detected stall in corrupted
2023/05/20 upstream (ToT) d635f6cc934b C Didn't crash
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 possible deadlock in exfat_get_block origin:upstream C error 111 487d 640d 0/3 auto-obsoleted due to no activity on 2023/10/19 14:45
upstream possible deadlock in exfat_get_block exfat C error done 317 487d 790d 0/28 auto-obsoleted due to no activity on 2023/10/21 18:47
Fix bisection attempts (1)
Created Duration User Patch Repo Result
2023/10/13 08:00 6h54m fix candidate upstream OK (1) job log

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
6.1.28-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.2/3707 is trying to acquire lock:
ffff88801fbc40e0 (
&sbi->s_lock){+.+.}-{3:3}, at: exfat_get_block+0x1e1/0x2040 fs/exfat/inode.c:281

but task is already holding lock:
ffff88806989df50 (mapping.invalidate_lock#3){.+.+}-{3:3}, at: filemap_invalidate_lock_shared include/linux/fs.h:811 [inline]
ffff88806989df50 (mapping.invalidate_lock#3){.+.+}-{3:3}, at: page_cache_ra_unbounded+0xed/0x7b0 mm/readahead.c:226

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (mapping.invalidate_lock#3){.+.+}-{3:3}:
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5669
       down_read+0x39/0x50 kernel/locking/rwsem.c:1520
       filemap_invalidate_lock_shared include/linux/fs.h:811 [inline]
       filemap_fault+0x640/0x17e0 mm/filemap.c:3128
       __do_fault+0x136/0x4f0 mm/memory.c:4212
       do_read_fault mm/memory.c:4563 [inline]
       do_fault mm/memory.c:4692 [inline]
       handle_pte_fault mm/memory.c:4964 [inline]
       __handle_mm_fault mm/memory.c:5106 [inline]
       handle_mm_fault+0x3407/0x5330 mm/memory.c:5227
       do_user_addr_fault arch/x86/mm/fault.c:1428 [inline]
       handle_page_fault arch/x86/mm/fault.c:1519 [inline]
       exc_page_fault+0x58d/0x790 arch/x86/mm/fault.c:1575
       asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:570
       strncpy_from_user+0x159/0x360 lib/strncpy_from_user.c:139
       getname_flags+0xf5/0x4e0 fs/namei.c:150
       do_sys_openat2+0xd2/0x500 fs/open.c:1304
       do_sys_open fs/open.c:1326 [inline]
       __do_sys_openat fs/open.c:1342 [inline]
       __se_sys_openat fs/open.c:1337 [inline]
       __x64_sys_openat+0x243/0x290 fs/open.c:1337
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd

-> #1 (&mm->mmap_lock#2){++++}-{3:3}:
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5669
       down_read+0x39/0x50 kernel/locking/rwsem.c:1520
       mmap_read_lock include/linux/mmap_lock.h:117 [inline]
       do_user_addr_fault arch/x86/mm/fault.c:1379 [inline]
       handle_page_fault arch/x86/mm/fault.c:1519 [inline]
       exc_page_fault+0x46a/0x790 arch/x86/mm/fault.c:1575
       asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:570
       filldir64+0x307/0x6f0 fs/readdir.c:331
       dir_emit_dot include/linux/fs.h:3583 [inline]
       dir_emit_dots include/linux/fs.h:3594 [inline]
       exfat_iterate+0x28a/0x3290 fs/exfat/dir.c:231
       iterate_dir+0x224/0x560
       __do_sys_getdents64 fs/readdir.c:369 [inline]
       __se_sys_getdents64+0x209/0x4f0 fs/readdir.c:354
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd

-> #0 (&sbi->s_lock){+.+.}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3098 [inline]
       check_prevs_add kernel/locking/lockdep.c:3217 [inline]
       validate_chain+0x1667/0x58e0 kernel/locking/lockdep.c:3832
       __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5056
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5669
       __mutex_lock_common+0x1d4/0x2520 kernel/locking/mutex.c:603
       __mutex_lock kernel/locking/mutex.c:747 [inline]
       mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:799
       exfat_get_block+0x1e1/0x2040 fs/exfat/inode.c:281
       do_mpage_readpage+0x8d2/0x2040 fs/mpage.c:208
       mpage_readahead+0x450/0x920 fs/mpage.c:361
       read_pages+0x17f/0x830 mm/readahead.c:161
       page_cache_ra_unbounded+0x68b/0x7b0 mm/readahead.c:270
       page_cache_sync_readahead include/linux/pagemap.h:1213 [inline]
       filemap_get_pages mm/filemap.c:2582 [inline]
       filemap_read+0x7fa/0x31d0 mm/filemap.c:2676
       __kernel_read+0x41e/0x8a0 fs/read_write.c:428
       integrity_kernel_read+0xac/0xf0 security/integrity/iint.c:199
       ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:485 [inline]
       ima_calc_file_shash security/integrity/ima/ima_crypto.c:516 [inline]
       ima_calc_file_hash+0xa57/0x1c00 security/integrity/ima/ima_crypto.c:573
       ima_collect_measurement+0x4d4/0x970 security/integrity/ima/ima_api.c:292
       process_measurement+0x1018/0x1cf0 security/integrity/ima/ima_main.c:337
       ima_file_check+0xed/0x170 security/integrity/ima/ima_main.c:520
       do_open fs/namei.c:3559 [inline]
       path_openat+0x2687/0x2e60 fs/namei.c:3714
       do_filp_open+0x230/0x480 fs/namei.c:3741
       do_sys_openat2+0x13b/0x500 fs/open.c:1310
       do_sys_open fs/open.c:1326 [inline]
       __do_sys_openat fs/open.c:1342 [inline]
       __se_sys_openat fs/open.c:1337 [inline]
       __x64_sys_openat+0x243/0x290 fs/open.c:1337
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd

other info that might help us debug this:

Chain exists of:
  &sbi->s_lock --> &mm->mmap_lock#2 --> mapping.invalidate_lock#3

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(mapping.invalidate_lock#3);
                               lock(&mm->mmap_lock#2);
                               lock(mapping.invalidate_lock#3);
  lock(&sbi->s_lock);

 *** DEADLOCK ***

3 locks held by syz-executor.2/3707:
 #0: ffff888014246460 (sb_writers#13){.+.+}-{0:0}, at: mnt_want_write+0x3b/0x80 fs/namespace.c:393
 #1: ffff888025aa9ce0 (&iint->mutex){+.+.}-{3:3}, at: process_measurement+0x7fe/0x1cf0 security/integrity/ima/ima_main.c:260
 #2: ffff88806989df50 (mapping.invalidate_lock#3){.+.+}-{3:3}, at: filemap_invalidate_lock_shared include/linux/fs.h:811 [inline]
 #2: ffff88806989df50 (mapping.invalidate_lock#3){.+.+}-{3:3}, at: page_cache_ra_unbounded+0xed/0x7b0 mm/readahead.c:226

stack backtrace:
CPU: 1 PID: 3707 Comm: syz-executor.2 Not tainted 6.1.28-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/28/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 check_noncircular+0x2fa/0x3b0 kernel/locking/lockdep.c:2178
 check_prev_add kernel/locking/lockdep.c:3098 [inline]
 check_prevs_add kernel/locking/lockdep.c:3217 [inline]
 validate_chain+0x1667/0x58e0 kernel/locking/lockdep.c:3832
 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5056
 lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5669
 __mutex_lock_common+0x1d4/0x2520 kernel/locking/mutex.c:603
 __mutex_lock kernel/locking/mutex.c:747 [inline]
 mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:799
 exfat_get_block+0x1e1/0x2040 fs/exfat/inode.c:281
 do_mpage_readpage+0x8d2/0x2040 fs/mpage.c:208
 mpage_readahead+0x450/0x920 fs/mpage.c:361
 read_pages+0x17f/0x830 mm/readahead.c:161
 page_cache_ra_unbounded+0x68b/0x7b0 mm/readahead.c:270
 page_cache_sync_readahead include/linux/pagemap.h:1213 [inline]
 filemap_get_pages mm/filemap.c:2582 [inline]
 filemap_read+0x7fa/0x31d0 mm/filemap.c:2676
 __kernel_read+0x41e/0x8a0 fs/read_write.c:428
 integrity_kernel_read+0xac/0xf0 security/integrity/iint.c:199
 ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:485 [inline]
 ima_calc_file_shash security/integrity/ima/ima_crypto.c:516 [inline]
 ima_calc_file_hash+0xa57/0x1c00 security/integrity/ima/ima_crypto.c:573
 ima_collect_measurement+0x4d4/0x970 security/integrity/ima/ima_api.c:292
 process_measurement+0x1018/0x1cf0 security/integrity/ima/ima_main.c:337
 ima_file_check+0xed/0x170 security/integrity/ima/ima_main.c:520
 do_open fs/namei.c:3559 [inline]
 path_openat+0x2687/0x2e60 fs/namei.c:3714
 do_filp_open+0x230/0x480 fs/namei.c:3741
 do_sys_openat2+0x13b/0x500 fs/open.c:1310
 do_sys_open fs/open.c:1326 [inline]
 __do_sys_openat fs/open.c:1342 [inline]
 __se_sys_openat fs/open.c:1337 [inline]
 __x64_sys_openat+0x243/0x290 fs/open.c:1337
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f5320c8c169
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 90 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 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f5321970168 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007f5320dabf80 RCX: 00007f5320c8c169
RDX: 000000000000275a RSI: 0000000020006ac0 RDI: ffffffffffffff9c
RBP: 00007f5320ce7ca1 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffd7b66416f R14: 00007f5321970300 R15: 0000000000022000
 </TASK>
syz-executor.2 (3707) used greatest stack depth: 18648 bytes left

Crashes (225):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/05/14 12:36 linux-6.1.y bf4ad6fa4e53 2b9ba477 .config console log report syz [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-6-1-kasan possible deadlock in exfat_get_block
2023/03/29 01:00 linux-6.1.y e3a87a10f259 fc067f05 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in exfat_get_block
2023/08/09 00:32 linux-6.1.y 0a4a7855302d 9552ae77 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in exfat_get_block
2023/08/08 21:46 linux-6.1.y 0a4a7855302d 9552ae77 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in exfat_get_block
2023/08/07 16:00 linux-6.1.y 52a953d0934b b1b6ae3d .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in exfat_get_block
2023/08/04 20:43 linux-6.1.y 52a953d0934b cdae481e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in exfat_get_block
2023/08/03 20:31 linux-6.1.y 52a953d0934b 74621247 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in exfat_get_block
2023/08/03 11:18 linux-6.1.y 52a953d0934b 39a91c18 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in exfat_get_block
2023/08/01 20:54 linux-6.1.y d2a6dc4eaf6d df07ffe8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in exfat_get_block
2023/07/30 21:05 linux-6.1.y d2a6dc4eaf6d 2a0d0f29 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in exfat_get_block
2023/07/27 17:31 linux-6.1.y d2a6dc4eaf6d 92476829 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in exfat_get_block
2023/07/27 15:36 linux-6.1.y d2a6dc4eaf6d 92476829 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in exfat_get_block
2023/07/27 11:16 linux-6.1.y d2a6dc4eaf6d 41fe1bae .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in exfat_get_block
2023/07/26 19:33 linux-6.1.y 5302e81aa209 41fe1bae .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in exfat_get_block
2023/07/26 13:39 linux-6.1.y 5302e81aa209 2a509c27 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in exfat_get_block
2023/07/25 18:35 linux-6.1.y 5302e81aa209 6756545c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in exfat_get_block
2023/07/25 17:34 linux-6.1.y 5302e81aa209 6756545c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in exfat_get_block
2023/07/25 13:55 linux-6.1.y 5302e81aa209 3b91ad04 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in exfat_get_block
2023/07/24 23:28 linux-6.1.y 5302e81aa209 b03242d7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in exfat_get_block
2023/07/24 20:19 linux-6.1.y 5302e81aa209 b03242d7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in exfat_get_block
2023/07/24 11:28 linux-6.1.y 75389113731b b03242d7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in exfat_get_block
2023/07/23 20:22 linux-6.1.y 75389113731b 27cbe77f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in exfat_get_block
2023/07/22 08:17 linux-6.1.y a456e1743881 27cbe77f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in exfat_get_block
2023/07/21 18:44 linux-6.1.y a456e1743881 abdf9bae .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in exfat_get_block
2023/07/20 15:26 linux-6.1.y a456e1743881 f49af159 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in exfat_get_block
2023/07/19 22:45 linux-6.1.y a456e1743881 4547cdf9 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in exfat_get_block
2023/07/19 21:23 linux-6.1.y a456e1743881 4547cdf9 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in exfat_get_block
2023/07/19 17:45 linux-6.1.y a456e1743881 022df2bb .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in exfat_get_block
2023/07/18 18:48 linux-6.1.y 61fd484b2cf6 022df2bb .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in exfat_get_block
2023/07/17 19:02 linux-6.1.y 61fd484b2cf6 20f8b3c2 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in exfat_get_block
2023/07/17 17:27 linux-6.1.y 61fd484b2cf6 20f8b3c2 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in exfat_get_block
2023/07/17 16:06 linux-6.1.y 61fd484b2cf6 20f8b3c2 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in exfat_get_block
2023/07/15 01:21 linux-6.1.y 61fd484b2cf6 35d9ecc5 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in exfat_get_block
2023/07/14 09:17 linux-6.1.y 61fd484b2cf6 d624500f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in exfat_get_block
2023/07/14 05:49 linux-6.1.y 61fd484b2cf6 d624500f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in exfat_get_block
2023/07/14 02:10 linux-6.1.y 61fd484b2cf6 55eda22f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in exfat_get_block
2023/07/14 01:12 linux-6.1.y 61fd484b2cf6 55eda22f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in exfat_get_block
2023/07/13 22:12 linux-6.1.y 61fd484b2cf6 55eda22f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in exfat_get_block
2023/07/12 15:39 linux-6.1.y 61fd484b2cf6 979d5fe2 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in exfat_get_block
2023/07/11 20:23 linux-6.1.y 61fd484b2cf6 2f19aa4f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in exfat_get_block
2023/07/11 17:49 linux-6.1.y 61fd484b2cf6 2f19aa4f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in exfat_get_block
2023/07/11 04:34 linux-6.1.y 61fd484b2cf6 52ae002a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in exfat_get_block
2023/07/10 14:28 linux-6.1.y 61fd484b2cf6 d47e94ee .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in exfat_get_block
2023/07/07 17:16 linux-6.1.y 61fd484b2cf6 668cb1fa .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in exfat_get_block
2023/07/07 06:26 linux-6.1.y 61fd484b2cf6 22ae5830 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in exfat_get_block
2023/07/06 18:30 linux-6.1.y 61fd484b2cf6 1a2f6297 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in exfat_get_block
2023/07/06 17:08 linux-6.1.y 61fd484b2cf6 1a2f6297 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in exfat_get_block
* Struck through repros no longer work on HEAD.