Skip to content

syzkaller: WARNING: refcount bug in __mptcp_close #375

Closed
@cpaasch

Description

@cpaasch

syzkaller-id: 58c2bd70b956b631acb9dbf7864dde62cc747a3d

HEAD: de5e8fd

Trace:

------------[ cut here ]------------
refcount_t: addition on 0; use-after-free.
WARNING: CPU: 1 PID: 14351 at lib/refcount.c:25 refcount_warn_saturate+0x105/0x1b0 lib/refcount.c:25
Modules linked in:
CPU: 1 PID: 14351 Comm: syz-executor.2 Not tainted 6.3.0-rc1-gde5e8fd0123c #11
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.11.0-2.el7 04/01/2014
RIP: 0010:refcount_warn_saturate+0x105/0x1b0 lib/refcount.c:25
Code: 02 31 ff 89 de e8 1b f0 a7 ff 84 db 0f 85 6e ff ff ff e8 3e f5 a7 ff 48 c7 c7 d8 c7 34 83 c6 05 6d 2d 0f 02 01 e8 cb 3d 90 ff <0f> 0b e9 4f ff ff ff e8 1f f5 a7 ff 0f b6 1d 54 2d 0f 02 31 ff 89
RSP: 0018:ffffc90000a47bf8 EFLAGS: 00010282
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
RDX: ffff88802eae98c0 RSI: ffffffff81097d4f RDI: 0000000000000001
RBP: ffff88802e712180 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000001 R11: ffff88802eaea148 R12: ffff88802e712100
R13: ffff88802e712a88 R14: ffff888005cb93a8 R15: ffff88802e712a88
FS:  0000000000000000(0000) GS:ffff88803ed00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f277fd89120 CR3: 0000000035486002 CR4: 0000000000370ee0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 __refcount_add include/linux/refcount.h:199 [inline]
 __refcount_inc include/linux/refcount.h:250 [inline]
 refcount_inc include/linux/refcount.h:267 [inline]
 sock_hold include/net/sock.h:775 [inline]
 __mptcp_close+0x4c6/0x4d0 net/mptcp/protocol.c:3051
 mptcp_close+0x24/0xe0 net/mptcp/protocol.c:3072
 inet_release+0x56/0xa0 net/ipv4/af_inet.c:429
 __sock_release+0x51/0xf0 net/socket.c:653
 sock_close+0x18/0x20 net/socket.c:1395
 __fput+0x113/0x430 fs/file_table.c:321
 task_work_run+0x96/0x100 kernel/task_work.c:179
 exit_task_work include/linux/task_work.h:38 [inline]
 do_exit+0x4fc/0x10c0 kernel/exit.c:869
 do_group_exit+0x51/0xf0 kernel/exit.c:1019
 get_signal+0x12b0/0x1390 kernel/signal.c:2859
 arch_do_signal_or_restart+0x25/0x260 arch/x86/kernel/signal.c:306
 exit_to_user_mode_loop kernel/entry/common.c:168 [inline]
 exit_to_user_mode_prepare+0x131/0x1a0 kernel/entry/common.c:203
 __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline]
 syscall_exit_to_user_mode+0x19/0x40 kernel/entry/common.c:296
 do_syscall_64+0x46/0x90 arch/x86/entry/common.c:86
 entry_SYSCALL_64_after_hwframe+0x72/0xdc
RIP: 0033:0x7fec4b4926a9
Code: Unable to access opcode bytes at 0x7fec4b49267f.
RSP: 002b:00007fec49f9dd78 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca
RAX: fffffffffffffe00 RBX: 00000000006bc058 RCX: 00007fec4b4926a9
RDX: 0000000000000000 RSI: 0000000000000080 RDI: 00000000006bc058
RBP: 00000000006bc050 R08: 00000000007df998 R09: 00000000007df998
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000006bc05c
R13: fffffffffffffea8 R14: 000000000000000b R15: 000000000001fe40
 </TASK>
irq event stamp: 2941
hardirqs last  enabled at (2953): [<ffffffff81138936>] __up_console_sem+0x76/0x80 kernel/printk/printk.c:345
hardirqs last disabled at (2964): [<ffffffff8113891b>] __up_console_sem+0x5b/0x80 kernel/printk/printk.c:343
softirqs last  enabled at (2844): [<ffffffff810a5bce>] invoke_softirq kernel/softirq.c:445 [inline]
softirqs last  enabled at (2844): [<ffffffff810a5bce>] __irq_exit_rcu kernel/softirq.c:650 [inline]
softirqs last  enabled at (2844): [<ffffffff810a5bce>] irq_exit_rcu+0xbe/0x130 kernel/softirq.c:662
softirqs last disabled at (2985): [<ffffffff810a5bce>] invoke_softirq kernel/softirq.c:445 [inline]
softirqs last disabled at (2985): [<ffffffff810a5bce>] __irq_exit_rcu kernel/softirq.c:650 [inline]
softirqs last disabled at (2985): [<ffffffff810a5bce>] irq_exit_rcu+0xbe/0x130 kernel/softirq.c:662
---[ end trace 0000000000000000 ]---
------------[ cut here ]------------
refcount_t: underflow; use-after-free.
WARNING: CPU: 1 PID: 14351 at lib/refcount.c:28 refcount_warn_saturate+0x141/0x1b0 lib/refcount.c:28
Modules linked in:
CPU: 1 PID: 14351 Comm: syz-executor.2 Tainted: G        W          6.3.0-rc1-gde5e8fd0123c #11
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.11.0-2.el7 04/01/2014
RIP: 0010:refcount_warn_saturate+0x141/0x1b0 lib/refcount.c:28
Code: 02 31 ff 89 de e8 df ef a7 ff 84 db 0f 85 32 ff ff ff e8 02 f5 a7 ff 48 c7 c7 08 c8 34 83 c6 05 30 2d 0f 02 01 e8 8f 3d 90 ff <0f> 0b e9 13 ff ff ff e8 e3 f4 a7 ff 0f b6 1d 16 2d 0f 02 31 ff 89
RSP: 0018:ffffc90000a47bd8 EFLAGS: 00010282
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
RDX: ffff88802eae98c0 RSI: ffffffff81097d4f RDI: 0000000000000001
RBP: ffff88802e712180 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000001 R11: ffff88802eaea148 R12: ffff88802e712180
R13: ffff88802e712a88 R14: ffff888005cb93a8 R15: ffff88802e712a88
FS:  0000000000000000(0000) GS:ffff88803ed00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f8af281ed0c CR3: 0000000008946006 CR4: 0000000000370ee0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 __refcount_sub_and_test include/linux/refcount.h:283 [inline]
 __refcount_dec_and_test include/linux/refcount.h:315 [inline]
 refcount_dec_and_test include/linux/refcount.h:333 [inline]
 sock_put include/net/sock.h:1967 [inline]
 __mptcp_destroy_sock+0x158/0x1c0 net/mptcp/protocol.c:2972
 __mptcp_close+0x3c8/0x4d0 net/mptcp/protocol.c:3057
 mptcp_close+0x24/0xe0 net/mptcp/protocol.c:3072
 inet_release+0x56/0xa0 net/ipv4/af_inet.c:429
 __sock_release+0x51/0xf0 net/socket.c:653
 sock_close+0x18/0x20 net/socket.c:1395
 __fput+0x113/0x430 fs/file_table.c:321
 task_work_run+0x96/0x100 kernel/task_work.c:179
 exit_task_work include/linux/task_work.h:38 [inline]
 do_exit+0x4fc/0x10c0 kernel/exit.c:869
 do_group_exit+0x51/0xf0 kernel/exit.c:1019
 get_signal+0x12b0/0x1390 kernel/signal.c:2859
 arch_do_signal_or_restart+0x25/0x260 arch/x86/kernel/signal.c:306
 exit_to_user_mode_loop kernel/entry/common.c:168 [inline]
 exit_to_user_mode_prepare+0x131/0x1a0 kernel/entry/common.c:203
 __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline]
 syscall_exit_to_user_mode+0x19/0x40 kernel/entry/common.c:296
 do_syscall_64+0x46/0x90 arch/x86/entry/common.c:86
 entry_SYSCALL_64_after_hwframe+0x72/0xdc
RIP: 0033:0x7fec4b4926a9
Code: Unable to access opcode bytes at 0x7fec4b49267f.
RSP: 002b:00007fec49f9dd78 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca
RAX: fffffffffffffe00 RBX: 00000000006bc058 RCX: 00007fec4b4926a9
RDX: 0000000000000000 RSI: 0000000000000080 RDI: 00000000006bc058
RBP: 00000000006bc050 R08: 00000000007df998 R09: 00000000007df998
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000006bc05c
R13: fffffffffffffea8 R14: 000000000000000b R15: 000000000001fe40
 </TASK>
irq event stamp: 3681
hardirqs last  enabled at (3693): [<ffffffff81138936>] __up_console_sem+0x76/0x80 kernel/printk/printk.c:345
hardirqs last disabled at (3704): [<ffffffff8113891b>] __up_console_sem+0x5b/0x80 kernel/printk/printk.c:343
softirqs last  enabled at (3718): [<ffffffff810a5bce>] invoke_softirq kernel/softirq.c:445 [inline]
softirqs last  enabled at (3718): [<ffffffff810a5bce>] __irq_exit_rcu kernel/softirq.c:650 [inline]
softirqs last  enabled at (3718): [<ffffffff810a5bce>] irq_exit_rcu+0xbe/0x130 kernel/softirq.c:662
softirqs last disabled at (3713): [<ffffffff810a5bce>] invoke_softirq kernel/softirq.c:445 [inline]
softirqs last disabled at (3713): [<ffffffff810a5bce>] __irq_exit_rcu kernel/softirq.c:650 [inline]
softirqs last disabled at (3713): [<ffffffff810a5bce>] irq_exit_rcu+0xbe/0x130 kernel/softirq.c:662
---[ end trace 0000000000000000 ]---

No reproducer

Kconfig:
Kconfig_k5_lockdep.txt

(maybe related to #371 ?)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions