[syzbot] possible deadlock in j1939_session_activate

Started by syzbot on Oct 22, 2021 · 5 messages from 2 authors · Last reply Mar 15, 2024

open the first message on its own page

Message details and related content
Hello,

syzbot found the following issue on:

HEAD commit:    fac3cb82a54a net: bridge: mcast: use multicast_membership_..
git tree:       net
console output: https://syzkaller.appspot.com/x/log.txt?x=11554c0cb00000
kernel config:  https://syzkaller.appspot.com/x/.config?x=bab9d35f204746a7
dashboard link: https://syzkaller.appspot.com/bug?extid=f32cbede7fd867ce0d56
compiler:       gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2

Unfortunately, I don't have any reproducer for this issue yet.

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: <redacted>

vxcan0: j1939_tp_rxtimer: 0xffff888075703400: abort rx timeout. Force session deactivation
======================================================
WARNING: possible circular locking dependency detected
5.15.0-rc5-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.1/10231 is trying to acquire lock:
ffff888035e15088 (&priv->active_session_list_lock){+.-.}-{2:2}, at: spin_lock_bh include/linux/spinlock.h:368 [inline]
ffff888035e15088 (&priv->active_session_list_lock){+.-.}-{2:2}, at: j1939_session_list_lock net/can/j1939/transport.c:238 [inline]
ffff888035e15088 (&priv->active_session_list_lock){+.-.}-{2:2}, at: j1939_session_activate+0x43/0x4b0 net/can/j1939/transport.c:1554

but task is already holding lock:
ffff88808959e5c0 (&jsk->sk_session_queue_lock){+.-.}-{2:2}, at: spin_lock_bh include/linux/spinlock.h:368 [inline]
ffff88808959e5c0 (&jsk->sk_session_queue_lock){+.-.}-{2:2}, at: j1939_sk_queue_activate_next+0x56/0x460 net/can/j1939/socket.c:204

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&jsk->sk_session_queue_lock){+.-.}-{2:2}:
       __raw_spin_lock_bh include/linux/spinlock_api_smp.h:135 [inline]
       _raw_spin_lock_bh+0x2f/0x40 kernel/locking/spinlock.c:178
       spin_lock_bh include/linux/spinlock.h:368 [inline]
       j1939_sk_queue_drop_all+0x40/0x2f0 net/can/j1939/socket.c:139

203 more lines

Re: [syzbot] [can?] possible deadlock in j1939_session_activate

Message details and related content
syzbot has found a reproducer for the following issue on:

HEAD commit:    8fc3b8f082cc Merge tag 'hardening-v6.5-rc1-fixes' of git:/..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=16f232bca80000
kernel config:  https://syzkaller.appspot.com/x/.config?x=9831e2c2660aae77
dashboard link: https://syzkaller.appspot.com/bug?extid=f32cbede7fd867ce0d56
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=14d77778a80000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=103080b0a80000

Downloadable assets:
disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/7bc7510fe41f/non_bootable_disk-8fc3b8f0.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/d0b4504d8c3f/vmlinux-8fc3b8f0.xz
kernel image: https://storage.googleapis.com/syzbot-assets/9dab524b6b38/bzImage-8fc3b8f0.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: <redacted>

======================================================
WARNING: possible circular locking dependency detected
6.4.0-syzkaller-12415-g8fc3b8f082cc #0 Not tainted
------------------------------------------------------
ksoftirqd/0/16 is trying to acquire lock:
ffff88802c7cd088 (&priv->active_session_list_lock){+.-.}-{2:2}, at: spin_lock_bh include/linux/spinlock.h:356 [inline]
ffff88802c7cd088 (&priv->active_session_list_lock){+.-.}-{2:2}, at: j1939_session_list_lock net/can/j1939/transport.c:238 [inline]
ffff88802c7cd088 (&priv->active_session_list_lock){+.-.}-{2:2}, at: j1939_session_activate+0x47/0x4b0 net/can/j1939/transport.c:1564

but task is already holding lock:
ffff8880238935c8 (&jsk->sk_session_queue_lock){+.-.}-{2:2}, at: spin_lock_bh include/linux/spinlock.h:356 [inline]
ffff8880238935c8 (&jsk->sk_session_queue_lock){+.-.}-{2:2}, at: j1939_sk_queue_activate_next+0x5f/0x4d0 net/can/j1939/socket.c:207

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&jsk->sk_session_queue_lock){+.-.}-{2:2}:
       __raw_spin_lock_bh include/linux/spinlock_api_smp.h:126 [inline]
       _raw_spin_lock_bh+0x33/0x40 kernel/locking/spinlock.c:178

178 more lines

Re: [syzbot] [can?] possible deadlock in j1939_session_activate

Message details and related content
syzbot has bisected this issue to:

commit 259bdba27e32368b4404f69d613b1c1014c07cbf
Author: Oliver Hartkopp [off-list ref]
Date:   Wed Mar 9 12:04:16 2022 +0000

    vxcan: enable local echo for sent CAN frames

bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=14a2e55d680000
start commit:   84186fcb834e Merge tag 'urgent/nolibc.2023.10.16a' of git:..
git tree:       upstream
final oops:     https://syzkaller.appspot.com/x/report.txt?x=16a2e55d680000
console output: https://syzkaller.appspot.com/x/log.txt?x=12a2e55d680000
kernel config:  https://syzkaller.appspot.com/x/.config?x=7d1f30869bb78ec6
dashboard link: https://syzkaller.appspot.com/bug?extid=f32cbede7fd867ce0d56
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=15c6300d680000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=17e6935d680000

Reported-by: <redacted>
Fixes: 259bdba27e32 ("vxcan: enable local echo for sent CAN frames")

For information about bisection process see: https://goo.gl/tpsmEJ#bisection

Re: [syzbot] [can?] possible deadlock in j1939_session_activate

Message details and related content
syzbot suspects this issue was fixed by commit:

commit 6cdedc18ba7b9dacc36466e27e3267d201948c8d
Author: Ziqi Zhao [off-list ref]
Date:   Fri Jul 21 16:22:26 2023 +0000

    can: j1939: prevent deadlock by changing j1939_socks_lock to rwlock

bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=10c1afc1180000
start commit:   296455ade1fd Merge tag 'char-misc-6.8-rc1' of git://git.ke..
git tree:       upstream
kernel config:  https://syzkaller.appspot.com/x/.config?x=8e8eb82c088a8ac6
dashboard link: https://syzkaller.appspot.com/bug?extid=f32cbede7fd867ce0d56
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=11d7b3afe80000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=16ba0a4fe80000

If the result looks correct, please mark the issue as fixed by replying with:

#syz fix: can: j1939: prevent deadlock by changing j1939_socks_lock to rwlock

For information about bisection process see: https://goo.gl/tpsmEJ#bisection
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help