syzbot


WARNING: bad unlock balance in ext4_ioctl

Status: upstream: reported C repro on 2023/12/11 13:43
Bug presence: origin:upstream
[Documentation on labels]
Reported-by: syzbot+77a0245eb4ed995150a6@syzkaller.appspotmail.com
First crash: 375d, last: 35d
Bug presence (1)
Date Name Commit Repro Result
2024/02/28 upstream (ToT) 5cf7ebef02e4 C [report] WARNING in lock_two_nondirectories
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.1 WARNING: bad unlock balance in ext4_ioctl origin:upstream C 2 13d 375d 0/3 upstream: reported C repro on 2023/12/11 20:10
Fix bisection attempts (7)
Created Duration User Patch Repo Result
2024/11/15 16:04 1h36m bisect fix linux-5.15.y OK (0) job log log
2024/10/08 22:19 1h51m bisect fix linux-5.15.y OK (0) job log log
2024/08/25 21:49 1h00m bisect fix linux-5.15.y OK (0) job log log
2024/07/14 04:50 1h32m bisect fix linux-5.15.y OK (0) job log log
2024/06/02 09:56 42m bisect fix linux-5.15.y OK (0) job log log
2024/04/30 11:18 1h26m bisect fix linux-5.15.y OK (0) job log log
2024/03/30 07:48 1h39m bisect fix linux-5.15.y OK (0) job log log

Sample crash report:
EXT4-fs (loop0): 1 truncate cleaned up
EXT4-fs (loop0): mounted filesystem without journal. Opts: jqfmt=vfsold,resgid=0x000000000000ee00,bh,noload,data_err=ignore,usrjquota=,,errors=continue. Quota mode: none.
=====================================
WARNING: bad unlock balance detected!
5.15.149-syzkaller #0 Not tainted
-------------------------------------
syz-executor233/3507 is trying to release lock (&type->i_mutex_dir_key) at:
[<ffffffff821e2eca>] swap_inode_boot_loader fs/ext4/ioctl.c:262 [inline]
[<ffffffff821e2eca>] __ext4_ioctl fs/ext4/ioctl.c:1056 [inline]
[<ffffffff821e2eca>] ext4_ioctl+0x285a/0x5b80 fs/ext4/ioctl.c:1276
but there are no more locks to release!

other info that might help us debug this:
1 lock held by syz-executor233/3507:
 #0: ffff888077c4e460 (sb_writers#9){.+.+}-{0:0}, at: mnt_want_write_file+0x5a/0x1f0 fs/namespace.c:421

stack backtrace:
CPU: 1 PID: 3507 Comm: syz-executor233 Not tainted 5.15.149-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/25/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 print_unlock_imbalance_bug+0x248/0x2b0 kernel/locking/lockdep.c:5065
 __lock_release kernel/locking/lockdep.c:5302 [inline]
 lock_release+0x596/0x9a0 kernel/locking/lockdep.c:5643
 up_write+0x75/0x4d0 kernel/locking/rwsem.c:1593
 swap_inode_boot_loader fs/ext4/ioctl.c:262 [inline]
 __ext4_ioctl fs/ext4/ioctl.c:1056 [inline]
 ext4_ioctl+0x285a/0x5b80 fs/ext4/ioctl.c:1276
 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
RIP: 0033:0x7f63b44dfb39
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 61 17 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:00007ffc49d660c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007ffc49d662a8 RCX: 00007f63b44dfb39
RDX: 0000000000000000 RSI: 0000000000006611 RDI: 0000000000000004
RBP: 00007f63b4553610 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001
R13: 00007ffc49d66298 R14: 0000000000000001 R15: 0000000000000001
 </TASK>
------------[ cut here ]------------
DEBUG_RWSEMS_WARN_ON((rwsem_owner(sem) != current) && !rwsem_test_oflags(sem, RWSEM_NONSPINNABLE)): count = 0x0, magic = 0xffff8880742ca168, owner = 0x0, curr 0xffff88807da93b80, list empty
WARNING: CPU: 1 PID: 3507 at kernel/locking/rwsem.c:1342 __up_write kernel/locking/rwsem.c:1341 [inline]
WARNING: CPU: 1 PID: 3507 at kernel/locking/rwsem.c:1342 up_write+0x473/0x4d0 kernel/locking/rwsem.c:1594
Modules linked in:
CPU: 1 PID: 3507 Comm: syz-executor233 Not tainted 5.15.149-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/25/2024
RIP: 0010:__up_write kernel/locking/rwsem.c:1341 [inline]
RIP: 0010:up_write+0x473/0x4d0 kernel/locking/rwsem.c:1594
Code: 48 c7 c7 80 08 8b 8a 48 c7 c6 40 0b 8b 8a 48 8b 54 24 28 48 8b 4c 24 18 4d 89 e0 4c 8b 4c 24 30 53 e8 41 11 ea ff 48 83 c4 08 <0f> 0b e9 86 fd ff ff 48 c7 c1 c8 ed e3 8d 80 e1 07 80 c1 03 38 c1
RSP: 0018:ffffc90002ea7940 EFLAGS: 00010292
RAX: 3bf1e3736039c800 RBX: ffffffff8a8b0960 RCX: ffff88807da93b80
RDX: 0000000000000000 RSI: 0000000080000000 RDI: 0000000000000000
RBP: ffffc90002ea7a10 R08: ffffffff8166625c R09: fffff520005d4e69
R10: 0000000000000000 R11: dffffc0000000001 R12: 0000000000000000
R13: ffff8880742ca168 R14: 1ffff920005d4f30 R15: dffffc0000000000
FS:  0000555556d48380(0000) GS:ffff8880b9b00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000000 CR3: 0000000078f65000 CR4: 00000000003506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 swap_inode_boot_loader fs/ext4/ioctl.c:262 [inline]
 __ext4_ioctl fs/ext4/ioctl.c:1056 [inline]
 ext4_ioctl+0x285a/0x5b80 fs/ext4/ioctl.c:1276
 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
RIP: 0033:0x7f63b44dfb39
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 61 17 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:00007ffc49d660c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007ffc49d662a8 RCX: 00007f63b44dfb39
RDX: 0000000000000000 RSI: 0000000000006611 RDI: 0000000000000004
RBP: 00007f63b4553610 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001
R13: 00007ffc49d66298 R14: 0000000000000001 R15: 0000000000000001
 </TASK>

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/02/28 20:11 linux-5.15.y 458ce51d0356 55d6f11d .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-5-15-kasan WARNING: bad unlock balance in ext4_ioctl
2023/12/11 13:42 linux-5.15.y 8a1d809b0545 28b24332 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan WARNING: bad unlock balance in ext4_ioctl
* Struck through repros no longer work on HEAD.