Re: [syzbot] [mptcp?] KASAN: slab-use-after-free Read in __timer_delete_sync

From: syzbot
Date: Tue Sep 10 2024 - 03:43:28 EST


Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
general protection fault in mptcp_pm_del_add_timer

Oops: general protection fault, probably for non-canonical address 0xdffffc0000000001: 0000 [#1] PREEMPT SMP KASAN PTI
KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f]
CPU: 0 UID: 0 PID: 6054 Comm: syz.1.16 Not tainted 6.11.0-rc7-syzkaller-gbc83b4d1f086-dirty #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
RIP: 0010:__list_del_entry_valid_or_report+0x23/0x140 lib/list_debug.c:49
Code: 90 90 90 90 90 90 90 f3 0f 1e fa 41 57 41 56 41 54 53 49 89 ff 49 bc 00 00 00 00 00 fc ff df 48 83 c7 08 48 89 f8 48 c1 e8 03 <42> 80 3c 20 00 74 05 e8 f1 a5 40 fd 49 8b 5f 08 4c 89 f8 48 c1 e8
RSP: 0018:ffffc900032172a0 EFLAGS: 00010202
RAX: 0000000000000001 RBX: ffff88801295ac90 RCX: 0000000000000001
RDX: dffffc0000000000 RSI: 0000000000000004 RDI: 0000000000000008
RBP: 0000000000000000 R08: 0000000000000003 R09: fffff52000642e48
R10: dffffc0000000000 R11: fffff52000642e48 R12: dffffc0000000000
R13: ffff888028988a48 R14: 0000000000000000 R15: 0000000000000000
FS: 00007fe27a4d56c0(0000) GS:ffff8880b8800000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ffdededd998 CR3: 000000006406c000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
__list_del_entry_valid include/linux/list.h:124 [inline]
__list_del_entry include/linux/list.h:215 [inline]
list_del include/linux/list.h:229 [inline]
mptcp_pm_del_add_timer+0x173/0x2c0 net/mptcp/pm_netlink.c:353
remove_anno_list_by_saddr net/mptcp/pm_netlink.c:1472 [inline]
mptcp_pm_remove_addrs_and_subflows net/mptcp/pm_netlink.c:1689 [inline]
mptcp_nl_remove_addrs_list net/mptcp/pm_netlink.c:1720 [inline]
mptcp_pm_nl_flush_addrs_doit+0x670/0xdd0 net/mptcp/pm_netlink.c:1761
genl_family_rcv_msg_doit net/netlink/genetlink.c:1115 [inline]
genl_family_rcv_msg net/netlink/genetlink.c:1195 [inline]
genl_rcv_msg+0xb14/0xec0 net/netlink/genetlink.c:1210
netlink_rcv_skb+0x1e3/0x430 net/netlink/af_netlink.c:2550
genl_rcv+0x28/0x40 net/netlink/genetlink.c:1219
netlink_unicast_kernel net/netlink/af_netlink.c:1331 [inline]
netlink_unicast+0x7f6/0x990 net/netlink/af_netlink.c:1357
netlink_sendmsg+0x8e4/0xcb0 net/netlink/af_netlink.c:1901
sock_sendmsg_nosec net/socket.c:730 [inline]
__sock_sendmsg+0x221/0x270 net/socket.c:745
____sys_sendmsg+0x525/0x7d0 net/socket.c:2597
___sys_sendmsg net/socket.c:2651 [inline]
__sys_sendmsg+0x2b0/0x3a0 net/socket.c:2680
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:0x7fe279779eb9
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:00007fe27a4d5038 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007fe279915f80 RCX: 00007fe279779eb9
RDX: 0000000001000000 RSI: 0000000020000300 RDI: 0000000000000003
RBP: 00007fe2797e793e R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007fe279915f80 R15: 00007fe279a3fa28
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:__list_del_entry_valid_or_report+0x23/0x140 lib/list_debug.c:49
Code: 90 90 90 90 90 90 90 f3 0f 1e fa 41 57 41 56 41 54 53 49 89 ff 49 bc 00 00 00 00 00 fc ff df 48 83 c7 08 48 89 f8 48 c1 e8 03 <42> 80 3c 20 00 74 05 e8 f1 a5 40 fd 49 8b 5f 08 4c 89 f8 48 c1 e8
RSP: 0018:ffffc900032172a0 EFLAGS: 00010202
RAX: 0000000000000001 RBX: ffff88801295ac90 RCX: 0000000000000001
RDX: dffffc0000000000 RSI: 0000000000000004 RDI: 0000000000000008
RBP: 0000000000000000 R08: 0000000000000003 R09: fffff52000642e48
R10: dffffc0000000000 R11: fffff52000642e48 R12: dffffc0000000000
R13: ffff888028988a48 R14: 0000000000000000 R15: 0000000000000000
FS: 00007fe27a4d56c0(0000) GS:ffff8880b8800000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ffdededd998 CR3: 000000006406c000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
0: 90 nop
1: 90 nop
2: 90 nop
3: 90 nop
4: 90 nop
5: 90 nop
6: 90 nop
7: f3 0f 1e fa endbr64
b: 41 57 push %r15
d: 41 56 push %r14
f: 41 54 push %r12
11: 53 push %rbx
12: 49 89 ff mov %rdi,%r15
15: 49 bc 00 00 00 00 00 movabs $0xdffffc0000000000,%r12
1c: fc ff df
1f: 48 83 c7 08 add $0x8,%rdi
23: 48 89 f8 mov %rdi,%rax
26: 48 c1 e8 03 shr $0x3,%rax
* 2a: 42 80 3c 20 00 cmpb $0x0,(%rax,%r12,1) <-- trapping instruction
2f: 74 05 je 0x36
31: e8 f1 a5 40 fd call 0xfd40a627
36: 49 8b 5f 08 mov 0x8(%r15),%rbx
3a: 4c 89 f8 mov %r15,%rax
3d: 48 rex.W
3e: c1 .byte 0xc1
3f: e8 .byte 0xe8


Tested on:

commit: bc83b4d1 Merge tag 'bcachefs-2024-09-09' of git://evil..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1555a807980000
kernel config: https://syzkaller.appspot.com/x/.config?x=61d235cb8d15001c
dashboard link: https://syzkaller.appspot.com/bug?extid=f3a31fb909db9b2a5c4d
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=16746797980000