[syzbot] [kernel?] possible deadlock in exit_itimers

From: syzbot
Date: Fri Jun 16 2023 - 14:52:24 EST


Hello,

syzbot found the following issue on:

HEAD commit: f7efed9f38f8 Add linux-next specific files for 20230616
git tree: linux-next
console+strace: https://syzkaller.appspot.com/x/log.txt?x=124a65f7280000
kernel config: https://syzkaller.appspot.com/x/.config?x=60b1a32485a77c16
dashboard link: https://syzkaller.appspot.com/bug?extid=5fd924f4cd9dc1c7828c
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1401d8ef280000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=176b45cf280000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/95bcbee03439/disk-f7efed9f.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/6fd295caa4de/vmlinux-f7efed9f.xz
kernel image: https://storage.googleapis.com/syzbot-assets/69c038a34b5f/bzImage-f7efed9f.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+5fd924f4cd9dc1c7828c@xxxxxxxxxxxxxxxxxxxxxxxxx

============================================
WARNING: possible recursive locking detected
6.4.0-rc6-next-20230616-syzkaller #0 Not tainted
--------------------------------------------
syz-executor196/6178 is trying to acquire lock:
ffff88801eccb640 (&new_timer->it_lock){-.-.}-{2:2}, at: itimer_delete kernel/time/posix-timers.c:1049 [inline]
ffff88801eccb640 (&new_timer->it_lock){-.-.}-{2:2}, at: exit_itimers+0x2ac/0x540 kernel/time/posix-timers.c:1109

but task is already holding lock:
ffff88801eccb640 (&new_timer->it_lock){-.-.}-{2:2}, at: __lock_timer+0x1cc/0x4d0 kernel/time/posix-timers.c:595

other info that might help us debug this:
Possible unsafe locking scenario:

CPU0
----
lock(&new_timer->it_lock);
lock(&new_timer->it_lock);

*** DEADLOCK ***

May be due to missing lock nesting notation

1 lock held by syz-executor196/6178:
#0: ffff88801eccb640 (&new_timer->it_lock){-.-.}-{2:2}, at: __lock_timer+0x1cc/0x4d0 kernel/time/posix-timers.c:595

stack backtrace:
CPU: 1 PID: 6178 Comm: syz-executor196 Not tainted 6.4.0-rc6-next-20230616-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/27/2023
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0xd9/0x150 lib/dump_stack.c:106
check_deadlock kernel/locking/lockdep.c:3070 [inline]
validate_chain kernel/locking/lockdep.c:3863 [inline]
__lock_acquire+0x2a33/0x5e20 kernel/locking/lockdep.c:5144
lock_acquire.part.0+0x11c/0x370 kernel/locking/lockdep.c:5761
__raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
_raw_spin_lock_irqsave+0x3d/0x60 kernel/locking/spinlock.c:162
itimer_delete kernel/time/posix-timers.c:1049 [inline]
exit_itimers+0x2ac/0x540 kernel/time/posix-timers.c:1109
do_exit+0x630/0x2a30 kernel/exit.c:848
do_group_exit+0xd4/0x2a0 kernel/exit.c:1024
__do_sys_exit_group kernel/exit.c:1035 [inline]
__se_sys_exit_group kernel/exit.c:1033 [inline]
__x64_sys_exit_group+0x3e/0x50 kernel/exit.c:1033
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f5dc8cc4dd9
Code: 00 49 c7 c0 b8 ff ff ff be e7 00 00 00 ba 3c 00 00 00 eb 12 0f 1f 44 00 00 89 d0 0f 05 48 3d 00 f0 ff ff 77 1c f4 89 f0 0f 05 <48> 3d 00 f0 ff ff 76 e7 f7 d8 64 41 89 00 eb df 0f 1f 80 00 00 00
RSP: 002b:00007ffe0c959208 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 00007f5dc8d4f210 RCX: 00007f5dc8cc4dd9
RDX: 000000000000003c RSI: 00000000000000e7 RDI: 0000000000000000
RBP: 0000000000000000 R08: ffffffffffffffb8 R09: 00007f5dc8d151cf
R10: 00007ffe0c959290 R11: 0000000000000246 R12: 00007f5dc8d4f210
R13: 0000000000000001 R14: 0000000000000000 R15: 0000000000000001
</TASK>


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@xxxxxxxxxxxxxxxx.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the bug is already fixed, let syzbot know by replying with:
#syz fix: exact-commit-title

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.

If you want to change bug's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the bug is a duplicate of another bug, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup