syzbot


possible deadlock in do_page_mkwrite

Status: upstream: reported C repro on 2023/06/12 00:09
Bug presence: origin:upstream
[Documentation on labels]
Reported-by: syzbot+734fef9ab106cbaa9556@syzkaller.appspotmail.com
First crash: 481d, last: 41d
Bug presence (1)
Date Name Commit Repro Result
2023/06/12 upstream (ToT) 858fd168a95c C [report] possible deadlock in do_page_mkwrite
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.1 possible deadlock in do_page_mkwrite origin:upstream C 10 29d 525d 0/3 upstream: reported C repro on 2023/04/29 03:26
upstream possible deadlock in do_page_mkwrite reiserfs C error done 114 249d 663d 0/28 auto-obsoleted due to no activity on 2024/04/09 15:57
Fix bisection attempts (10)
Created Duration User Patch Repo Result
2024/08/03 18:46 1h09m bisect fix linux-5.15.y OK (0) job log log
2024/06/24 04:43 1h52m bisect fix linux-5.15.y OK (0) job log log
2024/04/16 14:14 1h27m bisect fix linux-5.15.y OK (0) job log log
2024/03/13 14:13 1h18m bisect fix linux-5.15.y OK (0) job log log
2024/02/08 19:55 1h18m bisect fix linux-5.15.y OK (0) job log log
2024/01/04 04:45 1h08m bisect fix linux-5.15.y OK (0) job log log
2023/12/04 07:50 1h17m bisect fix linux-5.15.y OK (0) job log log
2023/11/03 09:00 1h17m bisect fix linux-5.15.y OK (0) job log log
2023/10/03 11:01 1h24m bisect fix linux-5.15.y OK (0) job log log
2023/07/24 12:38 4h06m bisect fix linux-5.15.y OK (0) job log log

Sample crash report:
REISERFS (device loop0): Created .reiserfs_priv - reserved for xattr storage.
======================================================
WARNING: possible circular locking dependency detected
5.15.116-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor355/3626 is trying to acquire lock:
ffff88814717f090 (&sbi->lock){+.+.}-{3:3}, at: reiserfs_write_lock+0x76/0xd0 fs/reiserfs/lock.c:27

but task is already holding lock:
ffff88807b7fc558 (sb_pagefaults){.+.+}-{0:0}, at: do_page_mkwrite+0x1a9/0x440 mm/memory.c:2883

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (sb_pagefaults){.+.+}-{0:0}:
       lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5622
       percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
       __sb_start_write include/linux/fs.h:1742 [inline]
       sb_start_pagefault include/linux/fs.h:1841 [inline]
       filemap_page_mkwrite+0x11b/0x650 mm/filemap.c:3358
       do_page_mkwrite+0x1a9/0x440 mm/memory.c:2883
       do_shared_fault mm/memory.c:4285 [inline]
       do_fault mm/memory.c:4353 [inline]
       handle_pte_fault mm/memory.c:4608 [inline]
       __handle_mm_fault mm/memory.c:4743 [inline]
       handle_mm_fault+0x2803/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

-> #1 (&mm->mmap_lock#2){++++}-{3:3}:
       lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5622
       __might_fault+0xb4/0x110 mm/memory.c:5311
       reiserfs_ioctl+0x11d/0x340 fs/reiserfs/ioctl.c:96
       vfs_ioctl fs/ioctl.c:51 [inline]
       __do_sys_ioctl fs/ioctl.c:874 [inline]
       __se_sys_ioctl+0xf1/0x160 fs/ioctl.c:860
       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 (
&sbi->lock){+.+.}-{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
       __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
       reiserfs_write_lock+0x76/0xd0 fs/reiserfs/lock.c:27
       reiserfs_dirty_inode+0xee/0x240 fs/reiserfs/super.c:704
       __mark_inode_dirty+0x2fd/0xd60 fs/fs-writeback.c:2442
       generic_update_time+0x1cb/0x1e0 fs/inode.c:1775
       inode_update_time fs/inode.c:1788 [inline]
       file_update_time+0x3eb/0x460 fs/inode.c:1977
       filemap_page_mkwrite+0x222/0x650 mm/filemap.c:3359
       do_page_mkwrite+0x1a9/0x440 mm/memory.c:2883
       do_shared_fault mm/memory.c:4285 [inline]
       do_fault mm/memory.c:4353 [inline]
       handle_pte_fault mm/memory.c:4608 [inline]
       __handle_mm_fault mm/memory.c:4743 [inline]
       handle_mm_fault+0x2803/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

other info that might help us debug this:

Chain exists of:
  &sbi->lock --> &mm->mmap_lock#2 --> sb_pagefaults

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(sb_pagefaults);
                               lock(&mm->mmap_lock#2);
                               lock(sb_pagefaults);
  lock(&sbi->lock);

 *** DEADLOCK ***

2 locks held by syz-executor355/3626:
 #0: ffff8880208a2b28 (
&mm->mmap_lock#2){++++}-{3:3}, at: mmap_read_lock+0x1c/0x50 include/linux/mmap_lock.h:117
 #1: ffff88807b7fc558 (sb_pagefaults){.+.+}-{0:0}, at: do_page_mkwrite+0x1a9/0x440 mm/memory.c:2883

stack backtrace:
CPU: 0 PID: 3626 Comm: syz-executor355 Not tainted 5.15.116-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/25/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
 __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
 reiserfs_write_lock+0x76/0xd0 fs/reiserfs/lock.c:27
 reiserfs_dirty_inode+0xee/0x240 fs/reiserfs/super.c:704
 __mark_inode_dirty+0x2fd/0xd60 fs/fs-writeback.c:2442
 generic_update_time+0x1cb/0x1e0 fs/inode.c:1775
 inode_update_time fs/inode.c:1788 [inline]
 file_update_time+0x3eb/0x460 fs/inode.c:1977
 filemap_page_mkwrite+0x222/0x650 mm/filemap.c:3359
 do_page_mkwrite+0x1a9/0x440 mm/memory.c:2883
 do_shared_fault mm/memory.c:4285 [inline]
 do_fault mm/memory.c:4353 [inline]
 handle_pte_fault mm/memory.c:4608 [inline]
 __handle_mm_fault mm/memory.c:4743 [inline]
 handle_mm_fault+0x2803/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
RIP: 0033:0x7fef3805b506
Code: 00 e8 ee fe 04 00 48 83 f8 ff 0f 84 3c ff ff ff 48 89 05 85 bc 0c 00 e9 30 ff ff ff be 73 00 00 00 31 c9 31 c0 ba 42 da 14 00 <66> 89 34 25 c4 00 00 20 bf 02 00 00 00 be c0 00 00 20 c7 04 25 c0
RSP: 002b:00007fef3804f300 EFLAGS: 00010246
RAX: 0000000000000000 RBX: 00007fef381297c0 RCX: 0000000000000000
RDX: 000000000014da42 RSI: 0000000000000073 RDI: 00007fef381297cc
RBP: 00007fef380f6278 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fef380f5180
R13: 0030656c69662f2e R14: 7366726573696572 R15: 00007fef381297c8
 </TASK>

Crashes (7):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/06/12 00:08 linux-5.15.y 7349e40704a0 49519f06 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-5-15-kasan possible deadlock in do_page_mkwrite
2023/08/06 15:13 linux-5.15.y 38d4ca22a528 4ffcc9ef .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-5-15-kasan possible deadlock in do_page_mkwrite
2024/05/14 03:48 linux-5.15.y 284087d4f7d5 fdb4c10c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in do_page_mkwrite
2024/08/25 11:31 linux-5.15.y fa93fa65db6e d7d32352 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in do_page_mkwrite
2024/05/16 21:01 linux-5.15.y 284087d4f7d5 c2e07261 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in do_page_mkwrite
2024/05/14 11:18 linux-5.15.y 284087d4f7d5 fdb4c10c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in do_page_mkwrite
2024/05/02 19:17 linux-5.15.y 284087d4f7d5 3ba885bc .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in do_page_mkwrite
* Struck through repros no longer work on HEAD.