syzbot has found a reproducer for the following issue on:
HEAD commit: 8a7f2a5c5aa1 Linux 5.15.110
git tree: linux-5.15.y
console output:
https://syzkaller.appspot.com/x/log.txt?x=15954f90280000
kernel config:
https://syzkaller.appspot.com/x/.config?x=ba8d5c9d6c5289f
syz repro:
https://syzkaller.appspot.com/x/repro.syz?x=17d8c522280000
C reproducer:
https://syzkaller.appspot.com/x/repro.c?x=106fa990280000
Downloadable assets:
disk image:
https://storage.googleapis.com/syzbot-assets/fc04f54c047f/disk-8a7f2a5c.raw.xz
vmlinux:
https://storage.googleapis.com/syzbot-assets/6b4ba4cb1191/vmlinux-8a7f2a5c.xz
kernel image:
https://storage.googleapis.com/syzbot-assets/d927dc3f9670/bzImage-8a7f2a5c.xz
mounted in repro:
https://storage.googleapis.com/syzbot-assets/bc5a5e49aef1/mount_0.gz
======================================================
WARNING: possible circular locking dependency detected
5.15.110-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor315/4122 is trying to acquire lock:
ffff88807c355528 (&mm->mmap_lock#2){++++}-{3:3}, at: mmap_read_lock+0x1c/0x50 include/linux/mmap_lock.h:117
but task is already holding lock:
ffff88806fcd00e0 (&sbi->s_lock){+.+.}-{3:3}, at: exfat_iterate+0x197/0x3290 fs/exfat/dir.c:229
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #2 (&sbi->s_lock){+.+.}-{3:3}:
lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5622
__mutex_lock_common+0x1da/0x25a0 kernel/locking/mutex.c:596
__mutex_lock kernel/locking/mutex.c:729 [inline]
mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743
exfat_get_block+0x1ca/0x22c0 fs/exfat/inode.c:303
do_mpage_readpage+0x6c8/0x1f70 fs/mpage.c:231
mpage_readahead+0x427/0x9b0 fs/mpage.c:389
read_pages+0x159/0x8e0 mm/readahead.c:130
page_cache_ra_unbounded+0x7b0/0x930 mm/readahead.c:239
page_cache_sync_readahead include/linux/pagemap.h:833 [inline]
filemap_get_pages mm/filemap.c:2551 [inline]
filemap_read+0x71c/0x2980 mm/filemap.c:2634
__kernel_read+0x5ac/0xa60 fs/read_write.c:443
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+0xa5d/0x1c00 security/integrity/ima/ima_crypto.c:573
ima_collect_measurement+0x293/0x530 security/integrity/ima/ima_api.c:254
process_measurement+0x1038/0x1d60 security/integrity/ima/ima_main.c:337
ima_file_check+0xf3/0x180 security/integrity/ima/ima_main.c:519
do_open fs/namei.c:3540 [inline]
path_openat+0x2745/0x2f20 fs/namei.c:3672
do_filp_open+0x21c/0x460 fs/namei.c:3699
do_sys_openat2+0x13b/0x500 fs/open.c:1211
do_sys_open fs/open.c:1227 [inline]
__do_sys_openat fs/open.c:1243 [inline]
__se_sys_openat fs/open.c:1238 [inline]
__x64_sys_openat+0x243/0x290 fs/open.c:1238
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+0x61/0xcb
-> #1 (mapping.invalidate_lock#3){.+.+}-{3:3}:
lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5622
down_read+0x3b/0x50 kernel/locking/rwsem.c:1488
filemap_invalidate_lock_shared include/linux/fs.h:842 [inline]
filemap_fault+0x708/0x1470 mm/filemap.c:3072
__do_fault+0x139/0x340 mm/memory.c:3885
do_read_fault mm/memory.c:4221 [inline]
do_fault mm/memory.c:4349 [inline]
handle_pte_fault mm/memory.c:4608 [inline]
__handle_mm_fault mm/memory.c:4743 [inline]
handle_mm_fault+0x376f/0x5950 mm/memory.c:4841
do_user_addr_fault arch/x86/mm/fault.c:1397 [inline]
handle_page_fault arch/x86/mm/fault.c:1485 [inline]
exc_page_fault+0x271/0x740 arch/x86/mm/fault.c:1541
asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:568
strncpy_from_user+0x170/0x370 lib/strncpy_from_user.c:139
getname_flags+0xf5/0x4e0 fs/namei.c:149
do_sys_openat2+0xd2/0x500 fs/open.c:1205
do_sys_open fs/open.c:1227 [inline]
__do_sys_openat fs/open.c:1243 [inline]
__se_sys_openat fs/open.c:1238 [inline]
__x64_sys_openat+0x243/0x290 fs/open.c:1238
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+0x61/0xcb
-> #0 (&mm->mmap_lock#2){++++}-{3:3}:
check_prev_add kernel/locking/lockdep.c:3053 [inline]
check_prevs_add kernel/locking/lockdep.c:3172 [inline]
validate_chain+0x1646/0x58b0 kernel/locking/lockdep.c:3787
__lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5011
lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5622
down_read+0x3b/0x50 kernel/locking/rwsem.c:1488
mmap_read_lock+0x1c/0x50 include/linux/mmap_lock.h:117
do_user_addr_fault arch/x86/mm/fault.c:1348 [inline]
handle_page_fault arch/x86/mm/fault.c:1485 [inline]
exc_page_fault+0x5ce/0x740 arch/x86/mm/fault.c:1541
asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:568
user_access_begin arch/x86/include/asm/uaccess.h:574 [inline]
filldir64+0x32b/0x730 fs/readdir.c:331
dir_emit_dot include/linux/fs.h:3605 [inline]
dir_emit_dots include/linux/fs.h:3616 [inline]
exfat_iterate+0x2ef/0x3290 fs/exfat/dir.c:232
iterate_dir+0x224/0x570
__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+0x61/0xcb
other info that might help us debug this:
Chain exists of:
&mm->mmap_lock#2 --> mapping.invalidate_lock#3 --> &sbi->s_lock
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&sbi->s_lock);
lock(mapping.invalidate_lock#3);
lock(&sbi->s_lock);
lock(&mm->mmap_lock#2);
*** DEADLOCK ***
3 locks held by syz-executor315/4122:
#0: ffff888078ec8870 (&f->f_pos_lock){+.+.}-{3:3}, at: __fdget_pos+0x261/0x300 fs/file.c:1073
#1: ffff888070a21cb0 (&sb->s_type->i_mutex_key#15){++++}-{3:3}, at: iterate_dir+0x131/0x570 fs/readdir.c:57
#2: ffff88806fcd00e0 (&sbi->s_lock){+.+.}-{3:3}, at: exfat_iterate+0x197/0x3290 fs/exfat/dir.c:229
stack backtrace:
CPU: 1 PID: 4122 Comm: syz-executor315 Not tainted 5.15.110-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/14/2023
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
check_noncircular+0x2f8/0x3b0 kernel/locking/lockdep.c:2133
check_prev_add kernel/locking/lockdep.c:3053 [inline]
check_prevs_add kernel/locking/lockdep.c:3172 [inline]
validate_chain+0x1646/0x58b0 kernel/locking/lockdep.c:3787
__lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5011
lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5622
down_read+0x3b/0x50 kernel/locking/rwsem.c:1488
mmap_read_lock+0x1c/0x50 include/linux/mmap_lock.h:117
do_user_addr_fault arch/x86/mm/fault.c:1348 [inline]
handle_page_fault arch/x86/mm/fault.c:1485 [inline]
exc_page_fault+0x5ce/0x740 arch/x86/mm/fault.c:1541
asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:568
RIP: 0010:filldir64+0x32b/0x730 fs/readdir.c:335
Code: fd 0f 82 60 02 00 00 48 b8 00 f0 ff ff ff 7f 00 00 48 39 c5 0f 87 4d 02 00 00 0f 01 cb 0f ae e8 48 8b 44 24 60 48 8b 4c 24 18 <48> 89 41 08 48 8b 44 24 10 48 8b 4c 24 58 48 89 08 48 8b 4c 24 20
RSP: 0018:ffffc90003bdf740 EFLAGS: 00050287
RAX: 0000000000000000 RBX: 0000000000000018 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000018 RDI: 00007ffffffff000
RBP: 0000000000000018 R08: ffffffff81d9d8ef R09: 0000000000000004
R10: 0000000000000003 R11: ffff88807a533a00 R12: ffffffff8a9e8a20
R13: ffffc90003bdfe70 R14: 0000000000000001 R15: 0000000000000000
dir_emit_dot include/linux/fs.h:3605 [inline]
dir_emit_dots include/linux/fs.h:3616 [inline]
exfat_iterate+0x2ef/0x3290 fs/exfat/dir.c:232
iterate_dir+0x224/0x570
__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+0x61/0xcb
RIP: 0033:0x7fe4299f7739
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 61 18 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:00007fe42159a208 EFLAGS: 00000246 ORIG_RAX: 00000000000000d9
RAX: ffffffffffffffda RBX: 00007fe429a75798 RCX: 00007fe4299f7739
RDX: 0000000000008008 RSI: 0000000000000000 RDI: 0000000000000006
RBP: 00007fe429a75790 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fe429a7579c
R13: 00007ffd02fe1a0f R14: 00007fe42159a300 R15: 0000000000022000
</TASK>
----------------
Code disassembly (best guess):
0: fd std
1: 0f 82 60 02 00 00 jb 0x267
7: 48 b8 00 f0 ff ff ff movabs $0x7ffffffff000,%rax
e: 7f 00 00
11: 48 39 c5 cmp %rax,%rbp
14: 0f 87 4d 02 00 00 ja 0x267
1a: 0f 01 cb stac
1d: 0f ae e8 lfence
20: 48 8b 44 24 60 mov 0x60(%rsp),%rax
25: 48 8b 4c 24 18 mov 0x18(%rsp),%rcx
* 2a: 48 89 41 08 mov %rax,0x8(%rcx) <-- trapping instruction
2e: 48 8b 44 24 10 mov 0x10(%rsp),%rax
33: 48 8b 4c 24 58 mov 0x58(%rsp),%rcx
38: 48 89 08 mov %rcx,(%rax)
3b: 48 8b 4c 24 20 mov 0x20(%rsp),%rcx
---
If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.