netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: syzbot <syzbot+e4c27043b9315839452d@syzkaller.appspotmail.com>
To: alibuda@linux.alibaba.com, davem@davemloft.net,
	dsahern@kernel.org,  dust.li@linux.alibaba.com,
	edumazet@google.com, kuba@kernel.org,
	 linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	pabeni@redhat.com,  schnelle@linux.ibm.com,
	srikarananta01@gmail.com,  syzkaller-bugs@googlegroups.com,
	wenjia@linux.ibm.com
Subject: Re: [syzbot] [net?] possible deadlock in do_ip_setsockopt (4)
Date: Tue, 17 Sep 2024 14:28:03 -0700	[thread overview]
Message-ID: <00000000000055b6570622575dba@google.com> (raw)
In-Reply-To: <fc79c53e-a5a7-4ae2-a579-83fefea772c4@gmail.com>

Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
possible deadlock in do_ip_setsockopt

======================================================
WARNING: possible circular locking dependency detected
6.11.0-syzkaller-04557-g2f27fce67173-dirty #0 Not tainted
------------------------------------------------------
syz.0.15/6023 is trying to acquire lock:
ffff888025c40918 (sk_lock-AF_INET){+.+.}-{0:0}, at: do_ip_setsockopt+0x1a2d/0x3cd0 net/ipv4/ip_sockglue.c:1078

but task is already holding lock:
ffffffff8faa9708 (rtnl_mutex){+.+.}-{3:3}, at: do_ip_setsockopt+0x127d/0x3cd0 net/ipv4/ip_sockglue.c:1077

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (rtnl_mutex){+.+.}-{3:3}:
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5822
       __mutex_lock_common kernel/locking/mutex.c:608 [inline]
       __mutex_lock+0x136/0xd70 kernel/locking/mutex.c:752
       smc_vlan_by_tcpsk+0x399/0x4e0 net/smc/smc_core.c:1898
       __smc_connect+0x292/0x1850 net/smc/af_smc.c:1518
       smc_connect+0x868/0xde0 net/smc/af_smc.c:1694
       __sys_connect_file net/socket.c:2067 [inline]
       __sys_connect+0x2d1/0x300 net/socket.c:2084
       __do_sys_connect net/socket.c:2094 [inline]
       __se_sys_connect net/socket.c:2091 [inline]
       __x64_sys_connect+0x7a/0x90 net/socket.c:2091
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #0 (sk_lock-AF_INET){+.+.}-{0:0}:
       check_prev_add kernel/locking/lockdep.c:3158 [inline]
       check_prevs_add kernel/locking/lockdep.c:3277 [inline]
       validate_chain+0x18ef/0x5920 kernel/locking/lockdep.c:3901
       __lock_acquire+0x1384/0x2050 kernel/locking/lockdep.c:5199
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5822
       lock_sock_nested+0x48/0x100 net/core/sock.c:3611
       do_ip_setsockopt+0x1a2d/0x3cd0 net/ipv4/ip_sockglue.c:1078
       ip_setsockopt+0x63/0x100 net/ipv4/ip_sockglue.c:1417
       do_sock_setsockopt+0x3af/0x720 net/socket.c:2330
       __sys_setsockopt+0x1a8/0x250 net/socket.c:2353
       __do_sys_setsockopt net/socket.c:2362 [inline]
       __se_sys_setsockopt net/socket.c:2359 [inline]
       __x64_sys_setsockopt+0xb5/0xd0 net/socket.c:2359
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(rtnl_mutex);
                               lock(sk_lock-AF_INET);
                               lock(rtnl_mutex);
  lock(sk_lock-AF_INET);

 *** DEADLOCK ***

1 lock held by syz.0.15/6023:
 #0: ffffffff8faa9708 (rtnl_mutex){+.+.}-{3:3}, at: do_ip_setsockopt+0x127d/0x3cd0 net/ipv4/ip_sockglue.c:1077

stack backtrace:
CPU: 0 UID: 0 PID: 6023 Comm: syz.0.15 Not tainted 6.11.0-syzkaller-04557-g2f27fce67173-dirty #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:93 [inline]
 dump_stack_lvl+0x241/0x360 lib/dump_stack.c:119
 print_circular_bug+0x13a/0x1b0 kernel/locking/lockdep.c:2074
 check_noncircular+0x36a/0x4a0 kernel/locking/lockdep.c:2203
 check_prev_add kernel/locking/lockdep.c:3158 [inline]
 check_prevs_add kernel/locking/lockdep.c:3277 [inline]
 validate_chain+0x18ef/0x5920 kernel/locking/lockdep.c:3901
 __lock_acquire+0x1384/0x2050 kernel/locking/lockdep.c:5199
 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5822
 lock_sock_nested+0x48/0x100 net/core/sock.c:3611
 do_ip_setsockopt+0x1a2d/0x3cd0 net/ipv4/ip_sockglue.c:1078
 ip_setsockopt+0x63/0x100 net/ipv4/ip_sockglue.c:1417
 do_sock_setsockopt+0x3af/0x720 net/socket.c:2330
 __sys_setsockopt+0x1a8/0x250 net/socket.c:2353
 __do_sys_setsockopt net/socket.c:2362 [inline]
 __se_sys_setsockopt net/socket.c:2359 [inline]
 __x64_sys_setsockopt+0xb5/0xd0 net/socket.c:2359
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f34b9b79e79
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f34b95ff038 EFLAGS: 00000246 ORIG_RAX: 0000000000000036
RAX: ffffffffffffffda RBX: 00007f34b9d15f80 RCX: 00007f34b9b79e79
RDX: 0000000000000023 RSI: 0000000000000000 RDI: 0000000000000004
RBP: 00007f34b9be793e R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f34b9d15f80 R15: 00007ffd22175db8
 </TASK>


Tested on:

commit:         2f27fce6 Merge tag 'sound-6.12-rc1' of git://git.kerne..
git tree:       git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=104cb500580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=c7e7e5a089fe8488
dashboard link: https://syzkaller.appspot.com/bug?extid=e4c27043b9315839452d
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40

Note: no patches were applied.

  reply	other threads:[~2024-09-17 21:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-26  9:50 [syzbot] [net?] possible deadlock in do_ip_setsockopt (4) syzbot
2024-08-24 16:48 ` syzbot
2024-08-25  3:37 ` syzbot
2024-09-17 21:11   ` Ananta Srikar Puranam
2024-09-17 21:28     ` syzbot [this message]
2024-09-17 21:47       ` Ananta Srikar Puranam
2024-09-17 21:58       ` Ananta Srikar Puranam
2024-09-17 22:31         ` syzbot
2024-09-17 23:50       ` [PATCH] net/ipv4: Fix circular deadlock in do_ip_setsockop AnantaSrikar
2024-09-22  9:26         ` kernel test robot
2024-09-22 16:11         ` Eric Dumazet
2024-09-22 21:04           ` Ananta Srikar Puranam
2025-05-29  0:01 ` [syzbot] [net?] possible deadlock in do_ip_setsockopt (4) syzbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=00000000000055b6570622575dba@google.com \
    --to=syzbot+e4c27043b9315839452d@syzkaller.appspotmail.com \
    --cc=alibuda@linux.alibaba.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=dust.li@linux.alibaba.com \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=schnelle@linux.ibm.com \
    --cc=srikarananta01@gmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=wenjia@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).