2024-05-06 08:37:56

by syzbot

[permalink] [raw]
Subject: [syzbot] [net?] WARNING in inet_csk_get_port (3)

Hello,

syzbot found the following issue on:

HEAD commit: 977b1ef51866 Merge tag 'block-6.9-20240420' of git://git.k..
git tree: upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=1694d080980000
kernel config: https://syzkaller.appspot.com/x/.config?x=85dbe39cf8e4f599
dashboard link: https://syzkaller.appspot.com/bug?extid=2459c1b9fcd39be822b1
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=126c6080980000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=11135520980000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/de8551177300/disk-977b1ef5.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/df9f007c8e65/vmlinux-977b1ef5.xz
kernel image: https://storage.googleapis.com/syzbot-assets/d48b59cf19ca/bzImage-977b1ef5.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: [email protected]

------------[ cut here ]------------
WARNING: CPU: 0 PID: 5149 at net/ipv4/inet_connection_sock.c:595 inet_csk_get_port+0xf82/0x2530 net/ipv4/inet_connection_sock.c:595
Modules linked in:
CPU: 0 PID: 5149 Comm: syz-executor413 Not tainted 6.9.0-rc4-syzkaller-00266-g977b1ef51866 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
RIP: 0010:inet_csk_get_port+0xf82/0x2530 net/ipv4/inet_connection_sock.c:595
Code: 00 00 48 89 fa 48 c1 ea 03 80 3c 02 00 0f 85 11 15 00 00 48 8b 83 40 06 00 00 48 89 44 24 20 e9 c1 f2 ff ff e8 bf 13 4b f8 90 <0f> 0b 90 e9 10 f9 ff ff e8 b1 13 4b f8 49 8d 7f 48 e8 98 c5 5d 00
RSP: 0018:ffffc9000320fd38 EFLAGS: 00010293
RAX: 0000000000000000 RBX: ffff888029c16e80 RCX: ffffffff89429509
RDX: ffff88807f641e00 RSI: ffffffff8942ae91 RDI: ffff88802a9dc720
RBP: ffff88802a9dc718 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000003 R12: 0000000000004e20
R13: ffff888029c16e80 R14: ffff88802a9dc080 R15: ffff88814a520168
FS: 000055555730c380(0000) GS:ffff8880b9400000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f0bd1307150 CR3: 00000000208f6000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
inet_csk_listen_start+0x15e/0x390 net/ipv4/inet_connection_sock.c:1281
inet_dccp_listen+0x1c5/0x220 net/dccp/proto.c:951
__sys_listen+0x19b/0x280 net/socket.c:1881
__do_sys_listen net/socket.c:1890 [inline]
__se_sys_listen net/socket.c:1888 [inline]
__x64_sys_listen+0x53/0x80 net/socket.c:1888
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xcf/0x260 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f0bd128cd29
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 c1 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:00007ffdfa5275e8 EFLAGS: 00000246 ORIG_RAX: 0000000000000032
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f0bd128cd29
RDX: ffffffffffffffb8 RSI: 0000000020000005 RDI: 0000000000000003
RBP: 0000000000000000 R08: 00000000000000a0 R09: 00000000000000a0
R10: 00000000000000a0 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
</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 [email protected].

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

If the report is already addressed, 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 overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

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

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


2024-05-26 12:20:17

by syzbot

[permalink] [raw]
Subject: Re: [syzbot] [net?] WARNING in inet_csk_get_port (3)

syzbot has bisected this issue to:

commit 3505cb9fa26cfec9512744466e754a8cbc2365b0
Author: Jiri Olsa <[email protected]>
Date: Wed Aug 9 08:34:14 2023 +0000

bpf: Add attach_type checks under bpf_prog_attach_check_attach_type

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=15dbe672980000
start commit: 977b1ef51866 Merge tag 'block-6.9-20240420' of git://git.k..
git tree: upstream
final oops: https://syzkaller.appspot.com/x/report.txt?x=17dbe672980000
console output: https://syzkaller.appspot.com/x/log.txt?x=13dbe672980000
kernel config: https://syzkaller.appspot.com/x/.config?x=85dbe39cf8e4f599
dashboard link: https://syzkaller.appspot.com/bug?extid=2459c1b9fcd39be822b1
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=126c6080980000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=11135520980000

Reported-by: [email protected]
Fixes: 3505cb9fa26c ("bpf: Add attach_type checks under bpf_prog_attach_check_attach_type")

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

2024-05-26 23:28:58

by Hillf Danton

[permalink] [raw]
Subject: Re: [syzbot] [net?] WARNING in inet_csk_get_port (3)

On Mon, 06 May 2024 01:37:21 -0700
> syzbot found the following issue on:
>
> HEAD commit: 977b1ef51866 Merge tag 'block-6.9-20240420' of git://git.k..
> git tree: upstream
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=11135520980000

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 977b1ef51866

--- x/net/ipv4/inet_connection_sock.c
+++ y/net/ipv4/inet_connection_sock.c
@@ -589,7 +589,7 @@ int inet_csk_get_port(struct sock *sk, u
success:
inet_csk_update_fastreuse(tb, sk);

- if (!inet_csk(sk)->icsk_bind_hash)
+ if (tb != inet_csk(sk)->icsk_bind_hash)
inet_bind_hash(sk, tb, tb2, port);
WARN_ON(inet_csk(sk)->icsk_bind_hash != tb);
WARN_ON(inet_csk(sk)->icsk_bind2_hash != tb2);
--

2024-05-27 00:19:12

by syzbot

[permalink] [raw]
Subject: Re: [syzbot] [net?] WARNING in inet_csk_get_port (3)

Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
WARNING in inet_csk_get_port

------------[ cut here ]------------
WARNING: CPU: 1 PID: 5606 at net/ipv4/inet_connection_sock.c:595 inet_csk_get_port+0xfae/0x2520 net/ipv4/inet_connection_sock.c:595
Modules linked in:
CPU: 1 PID: 5606 Comm: syz-executor.4 Not tainted 6.9.0-rc4-syzkaller-00266-g977b1ef51866-dirty #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024
RIP: 0010:inet_csk_get_port+0xfae/0x2520 net/ipv4/inet_connection_sock.c:595
Code: 00 00 48 89 fa 48 c1 ea 03 80 3c 02 00 0f 85 63 13 00 00 48 8b 83 40 06 00 00 48 89 44 24 20 e9 95 f2 ff ff e8 93 13 4b f8 90 <0f> 0b 90 e9 10 f9 ff ff e8 85 13 4b f8 49 8d 7f 48 e8 5c c5 5d 00
RSP: 0018:ffffc9000388fd38 EFLAGS: 00010293
RAX: 0000000000000000 RBX: ffff88805c420698 RCX: ffffffff89429509
RDX: ffff88802b24bc00 RSI: ffffffff8942aebd RDI: ffff88805c4206a0
RBP: 0000000000000001 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000003 R12: 0000000000004e20
R13: ffff888025057000 R14: ffff88805c420000 R15: ffff88802b92d800
FS: 00007f9e62e756c0(0000) GS:ffff8880b9500000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f86bdade048 CR3: 000000002c8ba000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
inet_csk_listen_start+0x15e/0x390 net/ipv4/inet_connection_sock.c:1281
inet_dccp_listen+0x1c5/0x220 net/dccp/proto.c:951
__sys_listen+0x19b/0x280 net/socket.c:1881
__do_sys_listen net/socket.c:1890 [inline]
__se_sys_listen net/socket.c:1888 [inline]
__x64_sys_listen+0x53/0x80 net/socket.c:1888
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xcf/0x260 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f9e6207dea9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f9e62e750c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000032
RAX: ffffffffffffffda RBX: 00007f9e621abf80 RCX: 00007f9e6207dea9
RDX: 0000000000000000 RSI: 0000000020000005 RDI: 0000000000000003
RBP: 00007f9e620ca4a4 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007f9e621abf80 R15: 00007ffc65e51748
</TASK>


Tested on:

commit: 977b1ef5 Merge tag 'block-6.9-20240420' of git://git.k..
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=106b1344980000
kernel config: https://syzkaller.appspot.com/x/.config?x=85dbe39cf8e4f599
dashboard link: https://syzkaller.appspot.com/bug?extid=2459c1b9fcd39be822b1
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=15314d92980000


2024-05-27 08:12:26

by Jiri Olsa

[permalink] [raw]
Subject: Re: [syzbot] [net?] WARNING in inet_csk_get_port (3)

On Sun, May 26, 2024 at 05:20:06AM -0700, syzbot wrote:
> syzbot has bisected this issue to:
>
> commit 3505cb9fa26cfec9512744466e754a8cbc2365b0
> Author: Jiri Olsa <[email protected]>
> Date: Wed Aug 9 08:34:14 2023 +0000
>
> bpf: Add attach_type checks under bpf_prog_attach_check_attach_type

hum, scratching my head how this change could cause network warning
will try the reproducer

jirka

>
> bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=15dbe672980000
> start commit: 977b1ef51866 Merge tag 'block-6.9-20240420' of git://git.k..
> git tree: upstream
> final oops: https://syzkaller.appspot.com/x/report.txt?x=17dbe672980000
> console output: https://syzkaller.appspot.com/x/log.txt?x=13dbe672980000
> kernel config: https://syzkaller.appspot.com/x/.config?x=85dbe39cf8e4f599
> dashboard link: https://syzkaller.appspot.com/bug?extid=2459c1b9fcd39be822b1
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=126c6080980000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=11135520980000
>
> Reported-by: [email protected]
> Fixes: 3505cb9fa26c ("bpf: Add attach_type checks under bpf_prog_attach_check_attach_type")
>
> For information about bisection process see: https://goo.gl/tpsmEJ#bisection

2024-05-27 10:52:16

by Hillf Danton

[permalink] [raw]
Subject: Re: [syzbot] [net?] WARNING in inet_csk_get_port (3)

On Mon, 06 May 2024 01:37:21 -0700
> syzbot found the following issue on:
>
> HEAD commit: 977b1ef51866 Merge tag 'block-6.9-20240420' of git://git.k..
> git tree: upstream
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=11135520980000

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 977b1ef51866

--- x/net/ipv4/inet_connection_sock.c
+++ y/net/ipv4/inet_connection_sock.c
@@ -589,7 +589,7 @@ int inet_csk_get_port(struct sock *sk, u
success:
inet_csk_update_fastreuse(tb, sk);

- if (!inet_csk(sk)->icsk_bind_hash)
+ if (tb != inet_csk(sk)->icsk_bind_hash || inet_csk(sk)->icsk_bind2_hash != tb2)
inet_bind_hash(sk, tb, tb2, port);
WARN_ON(inet_csk(sk)->icsk_bind_hash != tb);
WARN_ON(inet_csk(sk)->icsk_bind2_hash != tb2);
--

2024-05-27 21:06:15

by syzbot

[permalink] [raw]
Subject: Re: [syzbot] [net?] WARNING in inet_csk_get_port (3)

Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
INFO: rcu detected stall in corrupted

rcu: INFO: rcu_preempt detected expedited stalls on CPUs/tasks: { 1-.... } 2676 jiffies s: 3265 root: 0x2/.
rcu: blocking rcu_node structures (internal RCU debug):
Sending NMI from CPU 0 to CPUs 1:
NMI backtrace for cpu 1
CPU: 1 PID: 6099 Comm: syz-executor.1 Not tainted 6.9.0-rc4-syzkaller-00266-g977b1ef51866-dirty #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024
RIP: 0010:write_comp_data+0x34/0x90 kernel/kcov.c:236
Code: 48 8b 15 ff 1b 76 7e 65 8b 05 00 1c 76 7e a9 00 01 ff 00 74 0f f6 c4 01 74 59 8b 82 14 16 00 00 85 c0 74 4f 8b 82 f0 15 00 00 <83> f8 03 75 44 48 8b 82 f8 15 00 00 8b 92 f4 15 00 00 48 8b 38 48
RSP: 0018:ffffc90002e5fc88 EFLAGS: 00000246
RAX: 0000000000000000 RBX: ffff888068e7cb40 RCX: ffffffff894209a1
RDX: ffff88801bfa8000 RSI: 0000000000000000 RDI: 0000000000000001
RBP: ffff888068e7cb40 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000020 R11: 0000000000000003 R12: dffffc0000000000
R13: 0000000000000020 R14: 0000000000000000 R15: ffffed100d1cf96a
FS: 00007fe3784b36c0(0000) GS:ffff8880b9500000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f7b05dac000 CR3: 0000000011a78000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<NMI>
</NMI>
<TASK>
__inet_bhash2_conflict net/ipv4/inet_connection_sock.c:206 [inline]
inet_bhash2_conflict.isra.0+0xb1/0x210 net/ipv4/inet_connection_sock.c:229
inet_csk_bind_conflict+0x40c/0x630 net/ipv4/inet_connection_sock.c:264
inet_csk_get_port+0x1639/0x25b0 net/ipv4/inet_connection_sock.c:585
inet_csk_listen_start+0x15e/0x390 net/ipv4/inet_connection_sock.c:1281
inet_dccp_listen+0x1c5/0x220 net/dccp/proto.c:951
__sys_listen+0x19b/0x280 net/socket.c:1881
__do_sys_listen net/socket.c:1890 [inline]
__se_sys_listen net/socket.c:1888 [inline]
__x64_sys_listen+0x53/0x80 net/socket.c:1888
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xcf/0x260 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fe37767dea9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fe3784b30c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000032
RAX: ffffffffffffffda RBX: 00007fe3777abf80 RCX: 00007fe37767dea9
RDX: 0000000000000000 RSI: 0000000020000005 RDI: 0000000000000003
RBP: 00007fe3776ca4a4 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007fe3777abf80 R15: 00007fff4057e238
</TASK>


Tested on:

commit: 977b1ef5 Merge tag 'block-6.9-20240420' of git://git.k..
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=1530f71a980000
kernel config: https://syzkaller.appspot.com/x/.config?x=85dbe39cf8e4f599
dashboard link: https://syzkaller.appspot.com/bug?extid=2459c1b9fcd39be822b1
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=13e5e7f0980000