[syzbot] [bpf?] [net?] WARNING in sock_map_close (2)

33 views
Skip to first unread message

syzbot

unread,
Aug 22, 2024, 9:19:28 AM8/22/24
to and...@kernel.org, a...@kernel.org, b...@vger.kernel.org, dan...@iogearbox.net, da...@davemloft.net, edum...@google.com, ja...@cloudflare.com, jcha...@katalix.com, john.fa...@gmail.com, ku...@kernel.org, linux-...@vger.kernel.org, net...@vger.kernel.org, pab...@redhat.com, syzkall...@googlegroups.com, tpa...@katalix.com
Hello,

syzbot found the following issue on:

HEAD commit: d785ed945de6 net: wwan: t7xx: PCIe reset rescan
git tree: net-next
console+strace: https://syzkaller.appspot.com/x/log.txt?x=15d43b05980000
kernel config: https://syzkaller.appspot.com/x/.config?x=7229118d88b4a71b
dashboard link: https://syzkaller.appspot.com/bug?extid=8dbe3133b840c470da0e
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=13621239980000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=12378c33980000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/9b04b4f2471c/disk-d785ed94.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/2db64580639d/vmlinux-d785ed94.xz
kernel image: https://storage.googleapis.com/syzbot-assets/04e43f8b9f9b/bzImage-d785ed94.xz

The issue was bisected to:

commit 4a4cd70369f162f819b7855b0eabcb2db21f01f4
Author: James Chapman <jcha...@katalix.com>
Date: Mon Jul 29 15:38:04 2024 +0000

l2tp: don't set sk_user_data in tunnel socket

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=157a0791980000
final oops: https://syzkaller.appspot.com/x/report.txt?x=177a0791980000
console output: https://syzkaller.appspot.com/x/log.txt?x=137a0791980000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+8dbe31...@syzkaller.appspotmail.com
Fixes: 4a4cd70369f1 ("l2tp: don't set sk_user_data in tunnel socket")

------------[ cut here ]------------
WARNING: CPU: 0 PID: 5225 at net/core/sock_map.c:1699 sock_map_close+0x399/0x3d0 net/core/sock_map.c:1699
Modules linked in:
CPU: 0 UID: 0 PID: 5225 Comm: syz-executor110 Not tainted 6.11.0-rc3-syzkaller-00508-gd785ed945de6 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
RIP: 0010:sock_map_close+0x399/0x3d0 net/core/sock_map.c:1699
Code: 48 89 df e8 e9 a3 5a f8 4c 8b 23 eb 05 e8 8f 5e f3 f7 e8 ba ea ff ff 4c 89 ef e8 82 e1 da ff e9 47 ff ff ff e8 78 5e f3 f7 90 <0f> 0b 90 48 83 c4 08 5b 41 5c 41 5d 41 5e 41 5f 5d c3 cc cc cc cc
RSP: 0018:ffffc900035b7b10 EFLAGS: 00010293
RAX: ffffffff89a02af8 RBX: ffffffff95312d30 RCX: ffff88802424da00
RDX: 0000000000000000 RSI: ffffffff8c0ad560 RDI: ffffffff8c606900
RBP: 0000000000000000 R08: ffffffff937328e7 R09: 1ffffffff26e651c
R10: dffffc0000000000 R11: fffffbfff26e651d R12: ffffffff89a02760
R13: ffff88802fc0a800 R14: dffffc0000000000 R15: ffffffff89a02791
FS: 0000000000000000(0000) GS:ffff8880b9200000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ff975386110 CR3: 000000000e734000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
inet_release+0x17d/0x200 net/ipv4/af_inet.c:437
__sock_release net/socket.c:659 [inline]
sock_close+0xbc/0x240 net/socket.c:1421
__fput+0x24a/0x8a0 fs/file_table.c:422
task_work_run+0x24f/0x310 kernel/task_work.c:228
exit_task_work include/linux/task_work.h:40 [inline]
do_exit+0xa2f/0x27f0 kernel/exit.c:882
do_group_exit+0x207/0x2c0 kernel/exit.c:1031
__do_sys_exit_group kernel/exit.c:1042 [inline]
__se_sys_exit_group kernel/exit.c:1040 [inline]
__x64_sys_exit_group+0x3f/0x40 kernel/exit.c:1040
x64_sys_call+0x2634/0x2640 arch/x86/include/generated/asm/syscalls_64.h:232
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:0x7ff97530ad09
Code: Unable to access opcode bytes at 0x7ff97530acdf.
RSP: 002b:00007ffc8457e748 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007ff97530ad09
RDX: 000000000000003c RSI: 00000000000000e7 RDI: 0000000000000000
RBP: 00007ff9753852b0 R08: ffffffffffffffb8 R09: 0000000000000006
R10: 0000000000000006 R11: 0000000000000246 R12: 00007ff9753852b0
R13: 0000000000000000 R14: 00007ff975385d00 R15: 00007ff9752dbf60
</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 syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
For information about bisection process see: https://goo.gl/tpsmEJ#bisection

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

Hillf Danton

unread,
Aug 23, 2024, 6:47:42 AM8/23/24
to syzbot, linux-...@vger.kernel.org, syzkall...@googlegroups.com
On Thu, 22 Aug 2024 06:19:27 -0700
> syzbot found the following issue on:
>
> HEAD commit: d785ed945de6 net: wwan: t7xx: PCIe reset rescan
> git tree: net-next
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=12378c33980000

#syz test net-next d785ed945de6

--- x/net/core/skmsg.c
+++ y/net/core/skmsg.c
@@ -728,6 +728,7 @@ struct sk_psock *sk_psock_init(struct so
psock->saved_unhash = prot->unhash;
psock->saved_destroy = prot->destroy;
psock->saved_close = prot->close;
+ BUG_ON(psock->saved_close == sock_map_close);
psock->saved_write_space = sk->sk_write_space;

INIT_LIST_HEAD(&psock->link);
--

syzbot

unread,
Aug 23, 2024, 7:04:05 AM8/23/24
to hda...@sina.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

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

------------[ cut here ]------------
WARNING: CPU: 0 PID: 6140 at net/core/sock_map.c:1699 sock_map_close+0x399/0x3d0 net/core/sock_map.c:1699
Modules linked in:
CPU: 0 UID: 0 PID: 6140 Comm: syz.0.15 Not tainted 6.11.0-rc3-syzkaller-00508-gd785ed945de6-dirty #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
RIP: 0010:sock_map_close+0x399/0x3d0 net/core/sock_map.c:1699
Code: 48 89 df e8 29 a4 5a f8 4c 8b 23 eb 05 e8 cf 5e f3 f7 e8 ba ea ff ff 4c 89 ef e8 c2 e1 da ff e9 47 ff ff ff e8 b8 5e f3 f7 90 <0f> 0b 90 48 83 c4 08 5b 41 5c 41 5d 41 5e 41 5f 5d c3 cc cc cc cc
RSP: 0018:ffffc90003447cb0 EFLAGS: 00010293
RAX: ffffffff89a02ab8 RBX: ffffffff95312d30 RCX: ffff88802a959e00
RDX: 0000000000000000 RSI: ffffffff8c0ad560 RDI: ffffffff8c606900
RBP: 0000000000000000 R08: ffffffff937328e7 R09: 1ffffffff26e651c
R10: dffffc0000000000 R11: fffffbfff26e651d R12: ffffffff89a02720
R13: ffff88802026b000 R14: dffffc0000000000 R15: ffffffff89a02751
FS: 00005555867fa500(0000) GS:ffff8880b9200000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020000440 CR3: 000000004646a000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
inet_release+0x17d/0x200 net/ipv4/af_inet.c:437
__sock_release net/socket.c:659 [inline]
sock_close+0xbc/0x240 net/socket.c:1421
__fput+0x24a/0x8a0 fs/file_table.c:422
task_work_run+0x24f/0x310 kernel/task_work.c:228
resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
exit_to_user_mode_loop kernel/entry/common.c:114 [inline]
exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline]
__syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline]
syscall_exit_to_user_mode+0x168/0x370 kernel/entry/common.c:218
do_syscall_64+0x100/0x230 arch/x86/entry/common.c:89
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f75df579e79
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:00007fff8db960f8 EFLAGS: 00000246 ORIG_RAX: 00000000000001b4
RAX: 0000000000000000 RBX: 000000000001cc78 RCX: 00007f75df579e79
RDX: 0000000000000000 RSI: 000000000000001e RDI: 0000000000000003
RBP: 00007fff8db961c8 R08: 0000000000000001 R09: 00007fff8db963df
R10: 00007f75df400000 R11: 0000000000000246 R12: 0000000000000032
R13: 00007fff8db961f0 R14: 00007fff8db96210 R15: ffffffffffffffff
</TASK>


Tested on:

commit: d785ed94 net: wwan: t7xx: PCIe reset rescan
git tree: git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git
console output: https://syzkaller.appspot.com/x/log.txt?x=1046b239980000
kernel config: https://syzkaller.appspot.com/x/.config?x=7229118d88b4a71b
dashboard link: https://syzkaller.appspot.com/bug?extid=8dbe3133b840c470da0e
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=10236b91980000

Hillf Danton

unread,
Aug 24, 2024, 3:43:26 AM8/24/24
to syzbot, linux-...@vger.kernel.org, syzkall...@googlegroups.com
On Thu, 22 Aug 2024 06:19:27 -0700
> syzbot found the following issue on:
>
> HEAD commit: d785ed945de6 net: wwan: t7xx: PCIe reset rescan
> git tree: net-next
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=12378c33980000

#syz test net-next d785ed945de6

--- x/net/core/sock_map.c
+++ y/net/core/sock_map.c
@@ -209,7 +209,7 @@ static struct sk_psock *sock_map_psock_g
rcu_read_lock();
psock = sk_psock(sk);
if (psock) {
- if (sk->sk_prot->close != sock_map_close) {
+ if (sk->sk_prot->close == sock_map_close) {
psock = ERR_PTR(-EBUSY);
goto out;
}
--

syzbot

unread,
Aug 24, 2024, 4:01:04 AM8/24/24
to hda...@sina.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

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

------------[ cut here ]------------
WARNING: CPU: 1 PID: 6123 at net/core/sock_map.c:1699 sock_map_close+0x399/0x3d0 net/core/sock_map.c:1699
Modules linked in:
CPU: 1 UID: 0 PID: 6123 Comm: syz.0.15 Not tainted 6.11.0-rc3-syzkaller-00508-gd785ed945de6-dirty #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
RIP: 0010:sock_map_close+0x399/0x3d0 net/core/sock_map.c:1699
Code: 48 89 df e8 e9 a3 5a f8 4c 8b 23 eb 05 e8 8f 5e f3 f7 e8 ba ea ff ff 4c 89 ef e8 82 e1 da ff e9 47 ff ff ff e8 78 5e f3 f7 90 <0f> 0b 90 48 83 c4 08 5b 41 5c 41 5d 41 5e 41 5f 5d c3 cc cc cc cc
RSP: 0018:ffffc900022cfcb0 EFLAGS: 00010293
RAX: ffffffff89a02af8 RBX: ffffffff95312d30 RCX: ffff88802118bc00
RDX: 0000000000000000 RSI: ffffffff8c0ad560 RDI: ffffffff8c606900
RBP: 0000000000000000 R08: ffffffff937328e7 R09: 1ffffffff26e651c
R10: dffffc0000000000 R11: fffffbfff26e651d R12: ffffffff89a02760
R13: ffff88801fb47000 R14: dffffc0000000000 R15: ffffffff89a02791
FS: 0000555563a01500(0000) GS:ffff8880b9300000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020000440 CR3: 0000000071e98000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
inet_release+0x17d/0x200 net/ipv4/af_inet.c:437
__sock_release net/socket.c:659 [inline]
sock_close+0xbc/0x240 net/socket.c:1421
__fput+0x24a/0x8a0 fs/file_table.c:422
task_work_run+0x24f/0x310 kernel/task_work.c:228
resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
exit_to_user_mode_loop kernel/entry/common.c:114 [inline]
exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline]
__syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline]
syscall_exit_to_user_mode+0x168/0x370 kernel/entry/common.c:218
do_syscall_64+0x100/0x230 arch/x86/entry/common.c:89
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fa027579e79
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:00007ffee3912848 EFLAGS: 00000246 ORIG_RAX: 00000000000001b4
RAX: 0000000000000000 RBX: 000000000001ccb3 RCX: 00007fa027579e79
RDX: 0000000000000000 RSI: 000000000000001e RDI: 0000000000000003
RBP: 00007ffee3912918 R08: 0000000000000001 R09: 00007ffee3912b2f
R10: 00007fa027400000 R11: 0000000000000246 R12: 0000000000000032
R13: 00007ffee3912940 R14: 00007ffee3912960 R15: ffffffffffffffff
</TASK>


Tested on:

commit: d785ed94 net: wwan: t7xx: PCIe reset rescan
git tree: git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git
console output: https://syzkaller.appspot.com/x/log.txt?x=150ee38d980000
kernel config: https://syzkaller.appspot.com/x/.config?x=7229118d88b4a71b
dashboard link: https://syzkaller.appspot.com/bug?extid=8dbe3133b840c470da0e
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=17be300b980000

Hillf Danton

unread,
Aug 24, 2024, 6:38:52 AM8/24/24
to syzbot, linux-...@vger.kernel.org, syzkall...@googlegroups.com
On Thu, 22 Aug 2024 06:19:27 -0700
> syzbot found the following issue on:
>
> HEAD commit: d785ed945de6 net: wwan: t7xx: PCIe reset rescan
> git tree: net-next
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=12378c33980000

#syz test net-next d785ed945de6

--- x/net/core/sock_map.c
+++ y/net/core/sock_map.c
@@ -179,7 +179,7 @@ static void sock_map_del_link(struct soc
sk_psock_stop_verdict(sk, psock);

if (psock->psock_update_sk_prot)
- psock->psock_update_sk_prot(sk, psock, false);
+ psock->psock_update_sk_prot(sk, psock, true);
write_unlock_bh(&sk->sk_callback_lock);
}
}
--

syzbot

unread,
Aug 24, 2024, 6:58:04 AM8/24/24
to hda...@sina.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

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

------------[ cut here ]------------
WARNING: CPU: 0 PID: 6084 at net/core/sock_map.c:1699 sock_map_close+0x399/0x3d0 net/core/sock_map.c:1699
Modules linked in:
CPU: 0 UID: 0 PID: 6084 Comm: syz.0.15 Not tainted 6.11.0-rc3-syzkaller-00508-gd785ed945de6-dirty #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
RIP: 0010:sock_map_close+0x399/0x3d0 net/core/sock_map.c:1699
Code: 48 89 df e8 e9 a3 5a f8 4c 8b 23 eb 05 e8 8f 5e f3 f7 e8 ba ea ff ff 4c 89 ef e8 82 e1 da ff e9 47 ff ff ff e8 78 5e f3 f7 90 <0f> 0b 90 48 83 c4 08 5b 41 5c 41 5d 41 5e 41 5f 5d c3 cc cc cc cc
RSP: 0018:ffffc9000364fcb0 EFLAGS: 00010293
RAX: ffffffff89a02af8 RBX: ffffffff95312d30 RCX: ffff88801edd5a00
RDX: 0000000000000000 RSI: ffffffff8c0ad560 RDI: ffffffff8c606900
RBP: 0000000000000000 R08: ffffffff937328e7 R09: 1ffffffff26e651c
R10: dffffc0000000000 R11: fffffbfff26e651d R12: ffffffff89a02760
R13: ffff88807a20b800 R14: dffffc0000000000 R15: ffffffff89a02791
FS: 000055556abaa500(0000) GS:ffff8880b9200000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020000440 CR3: 0000000011878000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
inet_release+0x17d/0x200 net/ipv4/af_inet.c:437
__sock_release net/socket.c:659 [inline]
sock_close+0xbc/0x240 net/socket.c:1421
__fput+0x24a/0x8a0 fs/file_table.c:422
task_work_run+0x24f/0x310 kernel/task_work.c:228
resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
exit_to_user_mode_loop kernel/entry/common.c:114 [inline]
exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline]
__syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline]
syscall_exit_to_user_mode+0x168/0x370 kernel/entry/common.c:218
do_syscall_64+0x100/0x230 arch/x86/entry/common.c:89
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f4615779e79
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:00007ffddbe62388 EFLAGS: 00000246 ORIG_RAX: 00000000000001b4
RAX: 0000000000000000 RBX: 000000000001c61a RCX: 00007f4615779e79
RDX: 0000000000000000 RSI: 000000000000001e RDI: 0000000000000003
RBP: 00007ffddbe62458 R08: 0000000000000001 R09: 00007ffddbe6266f
R10: 00007f4615600000 R11: 0000000000000246 R12: 0000000000000032
R13: 00007ffddbe62480 R14: 00007ffddbe624a0 R15: ffffffffffffffff
</TASK>


Tested on:

commit: d785ed94 net: wwan: t7xx: PCIe reset rescan
git tree: git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git
console output: https://syzkaller.appspot.com/x/log.txt?x=12911239980000
kernel config: https://syzkaller.appspot.com/x/.config?x=7229118d88b4a71b
dashboard link: https://syzkaller.appspot.com/bug?extid=8dbe3133b840c470da0e
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=147c642b980000

Hillf Danton

unread,
Aug 24, 2024, 7:57:24 AM8/24/24
to syzbot, linux-...@vger.kernel.org, syzkall...@googlegroups.com
On Thu, 22 Aug 2024 06:19:27 -0700
> syzbot found the following issue on:
>
> HEAD commit: d785ed945de6 net: wwan: t7xx: PCIe reset rescan
> git tree: net-next
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=12378c33980000

#syz test net-next d785ed945de6

--- x/net/core/sock_map.c
+++ y/net/core/sock_map.c
@@ -178,8 +178,10 @@ static void sock_map_del_link(struct soc
if (verdict_stop)
sk_psock_stop_verdict(sk, psock);

- if (psock->psock_update_sk_prot)
+ if (psock->psock_update_sk_prot) {
psock->psock_update_sk_prot(sk, psock, false);
+ WARN_ON_ONCE(sk->sk_prot->close == sock_map_close);
+ }
write_unlock_bh(&sk->sk_callback_lock);
}
}
@@ -196,10 +198,13 @@ static void sock_map_unref(struct sock *

static int sock_map_init_proto(struct sock *sk, struct sk_psock *psock)
{
+ int rc;
if (!sk->sk_prot->psock_update_sk_prot)
return -EINVAL;
psock->psock_update_sk_prot = sk->sk_prot->psock_update_sk_prot;
- return sk->sk_prot->psock_update_sk_prot(sk, psock, false);
+ rc = sk->sk_prot->psock_update_sk_prot(sk, psock, false);
+ WARN_ON_ONCE(sk->sk_prot->close == sock_map_close);
+ return rc;
}

static struct sk_psock *sock_map_psock_get_checked(struct sock *sk)
--

syzbot

unread,
Aug 24, 2024, 8:16:03 AM8/24/24
to hda...@sina.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

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

------------[ cut here ]------------
WARNING: CPU: 0 PID: 6104 at net/core/sock_map.c:206 sock_map_init_proto net/core/sock_map.c:206 [inline]
WARNING: CPU: 0 PID: 6104 at net/core/sock_map.c:206 sock_map_link+0xd6e/0xe40 net/core/sock_map.c:311
Modules linked in:
CPU: 0 UID: 0 PID: 6104 Comm: syz.0.15 Not tainted 6.11.0-rc3-syzkaller-00508-gd785ed945de6-dirty #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
RIP: 0010:sock_map_init_proto net/core/sock_map.c:206 [inline]
RIP: 0010:sock_map_link+0xd6e/0xe40 net/core/sock_map.c:311
Code: ff ff e9 65 f9 ff ff 89 d9 80 e1 07 80 c1 03 38 c1 0f 8c 34 f3 ff ff 48 89 df e8 4d 90 5a f8 e9 27 f3 ff ff e8 23 4b f3 f7 90 <0f> 0b 90 e9 d9 fd ff ff 89 d9 80 e1 07 80 c1 03 38 c1 0f 8c a0 f6
RSP: 0018:ffffc90002d57a60 EFLAGS: 00010293
RAX: ffffffff89a03e4d RBX: ffffffff95312d30 RCX: ffff88802034da00
RDX: 0000000000000000 RSI: 0000000000000008 RDI: ffff88807dbfda08
RBP: ffffc90002d57b60 R08: ffff88807dbfda0f R09: 1ffff1100fb7fb41
R10: dffffc0000000000 R11: ffffed100fb7fb42 R12: ffff88802b274000
R13: 1ffff920005aaf58 R14: 0000000000000000 R15: dffffc0000000000
FS: 00007f4ea726e6c0(0000) GS:ffff8880b9200000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020000440 CR3: 00000000791a4000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
sock_hash_update_common+0xd1/0xa30 net/core/sock_map.c:1014
sock_map_update_elem_sys+0x5a4/0x910 net/core/sock_map.c:598
map_update_elem+0x53a/0x6f0 kernel/bpf/syscall.c:1654
__sys_bpf+0x76f/0x810 kernel/bpf/syscall.c:5698
__do_sys_bpf kernel/bpf/syscall.c:5817 [inline]
__se_sys_bpf kernel/bpf/syscall.c:5815 [inline]
__x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:5815
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:0x7f4ea6579e79
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:00007f4ea726e038 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 00007f4ea6715f80 RCX: 00007f4ea6579e79
RDX: 0000000000000020 RSI: 0000000020000180 RDI: 0000000000000002
RBP: 00007f4ea65e7916 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f4ea6715f80 R15: 00007ffcfb2f8928
</TASK>


Tested on:

commit: d785ed94 net: wwan: t7xx: PCIe reset rescan
git tree: git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git
console output: https://syzkaller.appspot.com/x/log.txt?x=148d382b980000
kernel config: https://syzkaller.appspot.com/x/.config?x=7229118d88b4a71b
dashboard link: https://syzkaller.appspot.com/bug?extid=8dbe3133b840c470da0e
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=11f06d5b980000

Hillf Danton

unread,
Aug 24, 2024, 7:35:04 PM8/24/24
to syzbot, linux-...@vger.kernel.org, syzkall...@googlegroups.com
On Thu, 22 Aug 2024 06:19:27 -0700
> syzbot found the following issue on:
>
> HEAD commit: d785ed945de6 net: wwan: t7xx: PCIe reset rescan
> git tree: net-next
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=12378c33980000

#syz test net-next d785ed945de6

--- x/net/core/sock_map.c
+++ y/net/core/sock_map.c
@@ -196,7 +196,7 @@ static void sock_map_unref(struct sock *

static int sock_map_init_proto(struct sock *sk, struct sk_psock *psock)
{
- if (!sk->sk_prot->psock_update_sk_prot)
+ if (!sk->sk_prot->psock_update_sk_prot || psock->saved_close == sock_map_close)
return -EINVAL;
psock->psock_update_sk_prot = sk->sk_prot->psock_update_sk_prot;
return sk->sk_prot->psock_update_sk_prot(sk, psock, false);
--

syzbot

unread,
Aug 24, 2024, 7:51:04 PM8/24/24
to hda...@sina.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

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

------------[ cut here ]------------
WARNING: CPU: 1 PID: 6067 at net/core/sock_map.c:1699 sock_map_close+0x399/0x3d0 net/core/sock_map.c:1699
Modules linked in:
CPU: 1 UID: 0 PID: 6067 Comm: syz.0.15 Not tainted 6.11.0-rc3-syzkaller-00508-gd785ed945de6-dirty #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
RIP: 0010:sock_map_close+0x399/0x3d0 net/core/sock_map.c:1699
Code: 48 89 df e8 e9 a3 5a f8 4c 8b 23 eb 05 e8 8f 5e f3 f7 e8 ba ea ff ff 4c 89 ef e8 82 e1 da ff e9 47 ff ff ff e8 78 5e f3 f7 90 <0f> 0b 90 48 83 c4 08 5b 41 5c 41 5d 41 5e 41 5f 5d c3 cc cc cc cc
RSP: 0018:ffffc90003727cb0 EFLAGS: 00010293
RAX: ffffffff89a02af8 RBX: ffffffff95312d30 RCX: ffff88802a251e00
RDX: 0000000000000000 RSI: ffffffff8c0ad560 RDI: ffffffff8c606900
RBP: 0000000000000000 R08: ffffffff937328e7 R09: 1ffffffff26e651c
R10: dffffc0000000000 R11: fffffbfff26e651d R12: ffffffff89a02760
R13: ffff88802f8c6000 R14: dffffc0000000000 R15: ffffffff89a02791
FS: 000055555a036500(0000) GS:ffff8880b9300000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020000440 CR3: 000000001d6a6000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
inet_release+0x17d/0x200 net/ipv4/af_inet.c:437
__sock_release net/socket.c:659 [inline]
sock_close+0xbc/0x240 net/socket.c:1421
__fput+0x24a/0x8a0 fs/file_table.c:422
task_work_run+0x24f/0x310 kernel/task_work.c:228
resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
exit_to_user_mode_loop kernel/entry/common.c:114 [inline]
exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline]
__syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline]
syscall_exit_to_user_mode+0x168/0x370 kernel/entry/common.c:218
do_syscall_64+0x100/0x230 arch/x86/entry/common.c:89
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f0768979e79
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:00007ffff26dcf28 EFLAGS: 00000246 ORIG_RAX: 00000000000001b4
RAX: 0000000000000000 RBX: 000000000001d163 RCX: 00007f0768979e79
RDX: 0000000000000000 RSI: 000000000000001e RDI: 0000000000000003
RBP: 00007ffff26dcff8 R08: 0000000000000001 R09: 00007ffff26dd20f
R10: 00007f0768800000 R11: 0000000000000246 R12: 0000000000000032
R13: 00007ffff26dd020 R14: 00007ffff26dd040 R15: ffffffffffffffff
</TASK>


Tested on:

commit: d785ed94 net: wwan: t7xx: PCIe reset rescan
git tree: git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git
console output: https://syzkaller.appspot.com/x/log.txt?x=14fdfbf5980000
kernel config: https://syzkaller.appspot.com/x/.config?x=7229118d88b4a71b
dashboard link: https://syzkaller.appspot.com/bug?extid=8dbe3133b840c470da0e
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=13102d8d980000

Reply all
Reply to author
Forward
0 new messages