syzbot


KASAN: use-after-free Read in tipc_sk_filter_rcv

Status: fixed on 2019/06/14 18:22
Subsystems: tipc
[Documentation on labels]
Reported-by: syzbot+e863893591cc7a622e40@syzkaller.appspotmail.com
Fix commit: 77d5ad4048fb tipc: fix use-after-free in tipc_sk_filter_rcv
First crash: 2052d, last: 2044d
Cause bisection: introduced by (bisect log) :
commit c55c8edafa91139419ed011f7d036274ce96be0b
Author: Hoang Le <hoang.h.le@dektech.com.au>
Date: Tue Mar 19 11:49:50 2019 +0000

  tipc: smooth change between replicast and broadcast

Crash: KASAN: use-after-free Read in tipc_sk_filter_rcv (log)
Repro: C syz .config
  
Discussions (2)
Title Replies (including bot) Last reply
[net-next v1 1/2] tipc: fix use-after-free in tipc_sk_filter_rcv 4 (4) 2019/03/21 16:57
KASAN: use-after-free Read in tipc_sk_filter_rcv 0 (1) 2019/03/20 21:22

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in tipc_sk_filter_rcv+0x2166/0x34f0 net/tipc/socket.c:2167
Read of size 4 at addr ffff8880900732b4 by task syz-executor226/7876

CPU: 1 PID: 7876 Comm: syz-executor226 Not tainted 5.0.0+ #101
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+0x172/0x1f0 lib/dump_stack.c:113
 print_address_description.cold+0x7c/0x20d mm/kasan/report.c:187
 kasan_report.cold+0x1b/0x40 mm/kasan/report.c:317
 __asan_report_load4_noabort+0x14/0x20 mm/kasan/generic_report.c:131
 tipc_sk_filter_rcv+0x2166/0x34f0 net/tipc/socket.c:2167
 tipc_sk_enqueue net/tipc/socket.c:2254 [inline]
 tipc_sk_rcv+0xc45/0x25a0 net/tipc/socket.c:2305
 tipc_node_xmit+0x296/0x640 net/tipc/node.c:1402
 tipc_node_xmit_skb+0x10f/0x190 net/tipc/node.c:1451
 tipc_sk_send_ack+0x40e/0x4e0 net/tipc/socket.c:1678
 tipc_recvstream+0x8e3/0xa10 net/tipc/socket.c:1924
 sock_recvmsg_nosec net/socket.c:881 [inline]
 sock_recvmsg net/socket.c:888 [inline]
 sock_recvmsg+0xd0/0x110 net/socket.c:884
 ___sys_recvmsg+0x273/0x5a0 net/socket.c:2422
 __sys_recvmsg+0x102/0x1d0 net/socket.c:2471
 __do_sys_recvmsg net/socket.c:2481 [inline]
 __se_sys_recvmsg net/socket.c:2478 [inline]
 __x64_sys_recvmsg+0x78/0xb0 net/socket.c:2478
 do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x445879
Code: e8 bc b7 02 00 48 83 c4 18 c3 0f 1f 80 00 00 00 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 0f 83 2b 12 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fbe925c8db8 EFLAGS: 00000246 ORIG_RAX: 000000000000002f
RAX: ffffffffffffffda RBX: 00000000006dac28 RCX: 0000000000445879
RDX: 0000000000003f00 RSI: 0000000020000200 RDI: 0000000000000003
RBP: 00000000006dac20 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000006dac2c
R13: 00007fff8c8d10ff R14: 00007fbe925c99c0 R15: 20c49ba5e353f7cf

Allocated by task 7876:
 save_stack+0x45/0xd0 mm/kasan/common.c:75
 set_track mm/kasan/common.c:87 [inline]
 __kasan_kmalloc mm/kasan/common.c:497 [inline]
 __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:470
 kasan_kmalloc+0x9/0x10 mm/kasan/common.c:511
 __do_kmalloc_node mm/slab.c:3686 [inline]
 __kmalloc_node_track_caller+0x4e/0x70 mm/slab.c:3700
 __kmalloc_reserve.isra.0+0x40/0xf0 net/core/skbuff.c:140
 __alloc_skb+0x10b/0x5e0 net/core/skbuff.c:208
 alloc_skb_fclone include/linux/skbuff.h:1107 [inline]
 tipc_buf_acquire+0x2f/0x100 net/tipc/msg.c:66
 tipc_msg_create+0x38/0x270 net/tipc/msg.c:98
 tipc_sk_send_ack+0x19b/0x4e0 net/tipc/socket.c:1664
 tipc_recvstream+0x8e3/0xa10 net/tipc/socket.c:1924
 sock_recvmsg_nosec net/socket.c:881 [inline]
 sock_recvmsg net/socket.c:888 [inline]
 sock_recvmsg+0xd0/0x110 net/socket.c:884
 ___sys_recvmsg+0x273/0x5a0 net/socket.c:2422
 __sys_recvmsg+0x102/0x1d0 net/socket.c:2471
 __do_sys_recvmsg net/socket.c:2481 [inline]
 __se_sys_recvmsg net/socket.c:2478 [inline]
 __x64_sys_recvmsg+0x78/0xb0 net/socket.c:2478
 do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 7876:
 save_stack+0x45/0xd0 mm/kasan/common.c:75
 set_track mm/kasan/common.c:87 [inline]
 __kasan_slab_free+0x102/0x150 mm/kasan/common.c:459
 kasan_slab_free+0xe/0x10 mm/kasan/common.c:467
 __cache_free mm/slab.c:3498 [inline]
 kfree+0xcf/0x230 mm/slab.c:3821
 skb_free_head+0x93/0xb0 net/core/skbuff.c:557
 skb_release_data+0x576/0x7a0 net/core/skbuff.c:577
 skb_release_all+0x4d/0x60 net/core/skbuff.c:631
 __kfree_skb net/core/skbuff.c:645 [inline]
 kfree_skb net/core/skbuff.c:663 [inline]
 kfree_skb+0xe8/0x390 net/core/skbuff.c:657
 tipc_sk_conn_proto_rcv net/tipc/socket.c:1268 [inline]
 tipc_sk_proto_rcv net/tipc/socket.c:1986 [inline]
 tipc_sk_filter_rcv+0x241b/0x34f0 net/tipc/socket.c:2162
 tipc_sk_enqueue net/tipc/socket.c:2254 [inline]
 tipc_sk_rcv+0xc45/0x25a0 net/tipc/socket.c:2305
 tipc_node_xmit+0x296/0x640 net/tipc/node.c:1402
 tipc_node_xmit_skb+0x10f/0x190 net/tipc/node.c:1451
 tipc_sk_send_ack+0x40e/0x4e0 net/tipc/socket.c:1678
 tipc_recvstream+0x8e3/0xa10 net/tipc/socket.c:1924
 sock_recvmsg_nosec net/socket.c:881 [inline]
 sock_recvmsg net/socket.c:888 [inline]
 sock_recvmsg+0xd0/0x110 net/socket.c:884
 ___sys_recvmsg+0x273/0x5a0 net/socket.c:2422
 __sys_recvmsg+0x102/0x1d0 net/socket.c:2471
 __do_sys_recvmsg net/socket.c:2481 [inline]
 __se_sys_recvmsg net/socket.c:2478 [inline]
 __x64_sys_recvmsg+0x78/0xb0 net/socket.c:2478
 do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff888090073200
 which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 180 bytes inside of
 1024-byte region [ffff888090073200, ffff888090073600)
The buggy address belongs to the page:
page:ffffea0002401c80 count:1 mapcount:0 mapping:ffff88812c3f0ac0 index:0x0 compound_mapcount: 0
flags: 0x1fffc0000010200(slab|head)
raw: 01fffc0000010200 ffffea00025a2c08 ffff88812c3f1848 ffff88812c3f0ac0
raw: 0000000000000000 ffff888090072000 0000000100000007 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff888090073180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888090073200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888090073280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                     ^
 ffff888090073300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888090073380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (3439):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/03/20 05:37 net-next-old 9bd5423fc75e 2458c1c6 .config console log report syz C ci-upstream-net-kasan-gce
2019/03/20 04:43 bpf-next a0cfa79f8470 2458c1c6 .config console log report syz C ci-upstream-bpf-next-kasan-gce
2019/03/20 04:31 net-next-old 9bd5423fc75e 2458c1c6 .config console log report syz C ci-upstream-net-kasan-gce
2019/03/20 04:02 bpf-next a0cfa79f8470 2458c1c6 .config console log report syz C ci-upstream-bpf-next-kasan-gce
2019/03/20 15:52 linux-next 835727301ed3 a664c187 .config console log report syz C ci-upstream-linux-next-kasan-gce-root
2019/03/20 14:23 linux-next 835727301ed3 a664c187 .config console log report syz C ci-upstream-linux-next-kasan-gce-root
2019/03/20 10:33 linux-next 835727301ed3 2458c1c6 .config console log report syz C ci-upstream-linux-next-kasan-gce-root
2019/03/20 05:16 net-next-old 9bd5423fc75e 2458c1c6 .config console log report syz ci-upstream-net-kasan-gce
2019/03/20 04:47 net-next-old 9bd5423fc75e 2458c1c6 .config console log report syz ci-upstream-net-kasan-gce
2019/03/20 03:38 bpf-next a0cfa79f8470 2458c1c6 .config console log report syz ci-upstream-bpf-next-kasan-gce
2019/03/20 12:43 linux-next 835727301ed3 142c38ee .config console log report syz ci-upstream-linux-next-kasan-gce-root
2019/03/20 10:56 linux-next 835727301ed3 2458c1c6 .config console log report syz ci-upstream-linux-next-kasan-gce-root
2019/03/27 14:33 bpf-next b4b6aa83433e 4e668495 .config console log report ci-upstream-bpf-next-kasan-gce
2019/03/27 12:27 bpf-next b4b6aa83433e 55684ce1 .config console log report ci-upstream-bpf-next-kasan-gce
2019/03/27 11:24 bpf-next b4b6aa83433e 55684ce1 .config console log report ci-upstream-bpf-next-kasan-gce
2019/03/27 10:15 bpf-next b4b6aa83433e 55684ce1 .config console log report ci-upstream-bpf-next-kasan-gce
2019/03/27 08:53 bpf-next b4b6aa83433e 55684ce1 .config console log report ci-upstream-bpf-next-kasan-gce
2019/03/27 08:47 bpf-next b4b6aa83433e 55684ce1 .config console log report ci-upstream-bpf-next-kasan-gce
2019/03/27 07:40 bpf-next b4b6aa83433e 55684ce1 .config console log report ci-upstream-bpf-next-kasan-gce
2019/03/27 06:35 bpf-next b4b6aa83433e 55684ce1 .config console log report ci-upstream-bpf-next-kasan-gce
2019/03/27 05:22 bpf-next b4b6aa83433e 55684ce1 .config console log report ci-upstream-bpf-next-kasan-gce
2019/03/27 05:16 bpf-next b4b6aa83433e 55684ce1 .config console log report ci-upstream-bpf-next-kasan-gce
2019/03/27 03:49 bpf-next b4b6aa83433e 55684ce1 .config console log report ci-upstream-bpf-next-kasan-gce
2019/03/27 00:52 bpf-next b4b6aa83433e 55684ce1 .config console log report ci-upstream-bpf-next-kasan-gce
2019/03/26 22:03 bpf-next 0c4ea7f87abb 55684ce1 .config console log report ci-upstream-bpf-next-kasan-gce
2019/03/26 20:56 bpf-next 0c4ea7f87abb 55684ce1 .config console log report ci-upstream-bpf-next-kasan-gce
2019/03/26 19:51 bpf-next 0c4ea7f87abb 55684ce1 .config console log report ci-upstream-bpf-next-kasan-gce
2019/03/26 18:48 bpf-next 0c4ea7f87abb 55684ce1 .config console log report ci-upstream-bpf-next-kasan-gce
2019/03/26 17:25 bpf-next 0c4ea7f87abb 55684ce1 .config console log report ci-upstream-bpf-next-kasan-gce
2019/03/26 16:58 bpf-next 0c4ea7f87abb 55684ce1 .config console log report ci-upstream-bpf-next-kasan-gce
2019/03/26 15:49 bpf-next 0c4ea7f87abb 55684ce1 .config console log report ci-upstream-bpf-next-kasan-gce
2019/03/26 14:26 bpf-next 0c4ea7f87abb 55684ce1 .config console log report ci-upstream-bpf-next-kasan-gce
2019/03/26 13:25 bpf-next 0c4ea7f87abb 55684ce1 .config console log report ci-upstream-bpf-next-kasan-gce
2019/03/26 12:34 bpf-next 0c4ea7f87abb 55684ce1 .config console log report ci-upstream-bpf-next-kasan-gce
2019/03/26 11:20 bpf-next 0c4ea7f87abb 55684ce1 .config console log report ci-upstream-bpf-next-kasan-gce
2019/03/26 10:14 bpf-next 0c4ea7f87abb 55684ce1 .config console log report ci-upstream-bpf-next-kasan-gce
2019/03/26 09:12 bpf-next 0c4ea7f87abb 55684ce1 .config console log report ci-upstream-bpf-next-kasan-gce
2019/03/26 07:56 bpf-next 0c4ea7f87abb 55684ce1 .config console log report ci-upstream-bpf-next-kasan-gce
2019/03/26 07:32 bpf-next 0c4ea7f87abb 55684ce1 .config console log report ci-upstream-bpf-next-kasan-gce
2019/03/26 06:04 bpf-next 0c4ea7f87abb 55684ce1 .config console log report ci-upstream-bpf-next-kasan-gce
2019/03/26 04:56 bpf-next 0c4ea7f87abb 55684ce1 .config console log report ci-upstream-bpf-next-kasan-gce
2019/03/26 03:52 bpf-next 0c4ea7f87abb 55684ce1 .config console log report ci-upstream-bpf-next-kasan-gce
2019/03/26 03:13 bpf-next 0c4ea7f87abb 55684ce1 .config console log report ci-upstream-bpf-next-kasan-gce
2019/03/26 01:56 bpf-next 0c4ea7f87abb 55684ce1 .config console log report ci-upstream-bpf-next-kasan-gce
2019/03/26 00:43 bpf-next 0c4ea7f87abb 55684ce1 .config console log report ci-upstream-bpf-next-kasan-gce
2019/03/25 23:20 bpf-next 0c4ea7f87abb 55684ce1 .config console log report ci-upstream-bpf-next-kasan-gce
2019/03/25 21:28 bpf-next 62b31b42cff9 2c86e0a5 .config console log report ci-upstream-bpf-next-kasan-gce
2019/03/25 20:26 bpf-next 62b31b42cff9 2c86e0a5 .config console log report ci-upstream-bpf-next-kasan-gce
2019/03/25 19:14 bpf-next 62b31b42cff9 2c86e0a5 .config console log report ci-upstream-bpf-next-kasan-gce
2019/03/25 17:54 bpf-next 62b31b42cff9 2c86e0a5 .config console log report ci-upstream-bpf-next-kasan-gce
2019/03/25 16:44 bpf-next 62b31b42cff9 2c86e0a5 .config console log report ci-upstream-bpf-next-kasan-gce
2019/03/25 15:33 bpf-next 62b31b42cff9 2c86e0a5 .config console log report ci-upstream-bpf-next-kasan-gce
2019/03/25 13:58 bpf-next 62b31b42cff9 2c86e0a5 .config console log report ci-upstream-bpf-next-kasan-gce
2019/03/25 10:58 bpf-next 62b31b42cff9 2c86e0a5 .config console log report ci-upstream-bpf-next-kasan-gce
2019/03/25 09:16 bpf-next 62b31b42cff9 2c86e0a5 .config console log report ci-upstream-bpf-next-kasan-gce
2019/03/25 08:11 bpf-next 62b31b42cff9 2c86e0a5 .config console log report ci-upstream-bpf-next-kasan-gce
2019/03/25 06:44 bpf-next 62b31b42cff9 2c86e0a5 .config console log report ci-upstream-bpf-next-kasan-gce
2019/03/22 16:55 net-next-old 0b03a5ca8b14 dce6e62f .config console log report ci-upstream-net-kasan-gce
2019/03/19 22:26 bpf-next a0cfa79f8470 e4549234 .config console log report ci-upstream-bpf-next-kasan-gce
2019/03/22 13:18 linux-next 32a217bae32c dce6e62f .config console log report ci-upstream-linux-next-kasan-gce-root
* Struck through repros no longer work on HEAD.