Web lists-archives.com

WARNING: refcount bug in xfrm_policy_bysel_ctx




Hello,

syzbot found the following crash on:

HEAD commit:    b19bce0335e2 net: ethernet: mediatek: fix warning in phy_s..
git tree:       net
console output: https://syzkaller.appspot.com/x/log.txt?x=168e0b9f400000
kernel config:  https://syzkaller.appspot.com/x/.config?x=7308e68273924137
dashboard link: https://syzkaller.appspot.com/bug?extid=8a6a21b4254f25f2ee66
compiler:       gcc (GCC) 9.0.0 20181231 (experimental)

Unfortunately, I don't have any reproducer for this crash yet.

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+8a6a21b4254f25f2ee66@xxxxxxxxxxxxxxxxxxxxxxxxx

netlink: 104 bytes leftover after parsing attributes in process `syz-executor4'. netlink: 104 bytes leftover after parsing attributes in process `syz-executor4'.
------------[ cut here ]------------
refcount_t: increment on 0; use-after-free.
WARNING: CPU: 0 PID: 25457 at lib/refcount.c:153 refcount_inc_checked lib/refcount.c:153 [inline] WARNING: CPU: 0 PID: 25457 at lib/refcount.c:153 refcount_inc_checked+0x61/0x70 lib/refcount.c:151
Kernel panic - not syncing: panic_on_warn set ...
CPU: 0 PID: 25457 Comm: syz-executor4 Not tainted 4.20.0+ #16
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1db/0x2d0 lib/dump_stack.c:113
 panic+0x2cb/0x589 kernel/panic.c:189
 __warn.cold+0x20/0x4b kernel/panic.c:544
 report_bug+0x263/0x2b0 lib/bug.c:186
 fixup_bug arch/x86/kernel/traps.c:178 [inline]
 fixup_bug arch/x86/kernel/traps.c:173 [inline]
 do_error_trap+0x11b/0x200 arch/x86/kernel/traps.c:271
 do_invalid_op+0x37/0x50 arch/x86/kernel/traps.c:290
 invalid_op+0x14/0x20 arch/x86/entry/entry_64.S:973
RIP: 0010:refcount_inc_checked lib/refcount.c:153 [inline]
RIP: 0010:refcount_inc_checked+0x61/0x70 lib/refcount.c:151
Code: 1d 8a 37 c8 06 31 ff 89 de e8 1b 27 f2 fd 84 db 75 dd e8 d2 25 f2 fd 48 c7 c7 e0 97 81 88 c6 05 6a 37 c8 06 01 e8 0f 7d bb fd <0f> 0b eb c1 90 66 2e 0f 1f 84 00 00 00 00 00 55 48 89 e5 41 54 49
RSP: 0018:ffff88806d877138 EFLAGS: 00010286
RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffc9000bf9d000
RDX: 000000000001d827 RSI: ffffffff816849b6 RDI: 0000000000000005
RBP: ffff88806d877148 R08: ffff8880608260c0 R09: ffff888060826988
R10: ffff8880608260c0 R11: 0000000000000000 R12: ffff88806a024520
R13: ffff888087287c00 R14: ffff88806d8772d0 R15: 0000000000000004
 xfrm_pol_hold include/net/xfrm.h:838 [inline]
 xfrm_policy_bysel_ctx+0x1c9/0x1020 net/xfrm/xfrm_policy.c:1679
 xfrm_get_policy+0x67b/0x1160 net/xfrm/xfrm_user.c:1887
 xfrm_user_rcv_msg+0x458/0x8d0 net/xfrm/xfrm_user.c:2663
 netlink_rcv_skb+0x17d/0x410 net/netlink/af_netlink.c:2477
 xfrm_netlink_rcv+0x70/0x90 net/xfrm/xfrm_user.c:2671
 netlink_unicast_kernel net/netlink/af_netlink.c:1310 [inline]
 netlink_unicast+0x574/0x770 net/netlink/af_netlink.c:1336
 netlink_sendmsg+0xa05/0xf90 net/netlink/af_netlink.c:1917
 sock_sendmsg_nosec net/socket.c:621 [inline]
 sock_sendmsg+0xdd/0x130 net/socket.c:631
 ___sys_sendmsg+0x7ec/0x910 net/socket.c:2116
 __sys_sendmsg+0x112/0x270 net/socket.c:2154
 __do_sys_sendmsg net/socket.c:2163 [inline]
 __se_sys_sendmsg net/socket.c:2161 [inline]
 __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2161
 do_syscall_64+0x1a3/0x800 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x457ec9
Code: 6d b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 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 0f 83 3b b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f6d47b19c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000457ec9
RDX: 0000000000000000 RSI: 000000002014f000 RDI: 0000000000000006
RBP: 000000000073bfa0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f6d47b1a6d4
R13: 00000000004c5394 R14: 00000000004d8e30 R15: 00000000ffffffff
Kernel Offset: disabled
Rebooting in 86400 seconds..


---
This bug 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 syzkaller@xxxxxxxxxxxxxxxx.

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