syzbot


KASAN: slab-out-of-bounds Read in br_mrp_parse

Status: fixed on 2020/07/17 17:58
Subsystems: bridge
[Documentation on labels]
Reported-by: syzbot+9c6f0f1f8e32223df9a4@syzkaller.appspotmail.com
Fix commit: 617504c67e01 bridge: mrp: Fix out-of-bounds read in br_mrp_parse
First crash: 1409d, last: 1407d
Cause bisection: introduced by (bisect log) :
commit 6536993371fab3de4e8379649b60e94d03e6ff37
Author: Horatiu Vultur <horatiu.vultur@microchip.com>
Date: Sun Apr 26 13:22:07 2020 +0000

  bridge: mrp: Integrate MRP into the bridge

Crash: KASAN: slab-out-of-bounds Read in br_mrp_parse (log)
Repro: C syz .config
  
Discussions (2)
Title Replies (including bot) Last reply
[PATCH] bridge: mrp: Fix out-of-bounds read in br_mrp_parse 3 (3) 2020/05/26 01:10
KASAN: slab-out-of-bounds Read in br_mrp_parse 4 (5) 2020/05/21 15:01

Sample crash report:
batman_adv: batadv0: Interface activated: batadv_slave_1
==================================================================
BUG: KASAN: slab-out-of-bounds in br_mrp_parse+0x362/0x450 net/bridge/br_mrp_netlink.c:30
Read of size 4 at addr ffff888094d96f24 by task syz-executor481/7028

CPU: 0 PID: 7028 Comm: syz-executor481 Not tainted 5.7.0-rc5-syzkaller #0
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+0x188/0x20d lib/dump_stack.c:118
 print_address_description.constprop.0.cold+0xd3/0x413 mm/kasan/report.c:382
 __kasan_report.cold+0x20/0x38 mm/kasan/report.c:511
 kasan_report+0x33/0x50 mm/kasan/common.c:625
 br_mrp_parse+0x362/0x450 net/bridge/br_mrp_netlink.c:30
 br_afspec+0x328/0x490 net/bridge/br_netlink.c:677
 br_setlink+0x363/0x610 net/bridge/br_netlink.c:934
 rtnl_bridge_setlink+0x279/0x6d0 net/core/rtnetlink.c:4803
 rtnetlink_rcv_msg+0x44e/0xad0 net/core/rtnetlink.c:5461
 netlink_rcv_skb+0x15a/0x410 net/netlink/af_netlink.c:2469
 netlink_unicast_kernel net/netlink/af_netlink.c:1303 [inline]
 netlink_unicast+0x537/0x740 net/netlink/af_netlink.c:1329
 netlink_sendmsg+0x882/0xe10 net/netlink/af_netlink.c:1918
 sock_sendmsg_nosec net/socket.c:652 [inline]
 sock_sendmsg+0xcf/0x120 net/socket.c:672
 ____sys_sendmsg+0x6e6/0x810 net/socket.c:2352
 ___sys_sendmsg+0x100/0x170 net/socket.c:2406
 __sys_sendmsg+0xe5/0x1b0 net/socket.c:2439
 do_syscall_64+0xf6/0x7d0 arch/x86/entry/common.c:295
 entry_SYSCALL_64_after_hwframe+0x49/0xb3
RIP: 0033:0x4438f9
Code: 18 89 d0 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 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 6b 0e fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ffc8cfd2528 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00000000004438f9
RDX: 0000000000000000 RSI: 0000000020000240 RDI: 0000000000000003
RBP: 00007ffc8cfd2540 R08: 00000000bb1414ac R09: 00000000bb1414ac
R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffc8cfd2570
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 7028:
 save_stack+0x1b/0x40 mm/kasan/common.c:49
 set_track mm/kasan/common.c:57 [inline]
 __kasan_kmalloc mm/kasan/common.c:495 [inline]
 __kasan_kmalloc.constprop.0+0xbf/0xd0 mm/kasan/common.c:468
 kmalloc_node include/linux/slab.h:578 [inline]
 kvmalloc_node+0x61/0xf0 mm/util.c:574
 kvmalloc include/linux/mm.h:757 [inline]
 kvzalloc include/linux/mm.h:765 [inline]
 alloc_netdev_mqs+0x97/0xdc0 net/core/dev.c:9899
 rtnl_create_link+0x219/0xac0 net/core/rtnetlink.c:3068
 __rtnl_newlink+0xe2e/0x1590 net/core/rtnetlink.c:3330
 rtnl_newlink+0x64/0xa0 net/core/rtnetlink.c:3398
 rtnetlink_rcv_msg+0x44e/0xad0 net/core/rtnetlink.c:5461
 netlink_rcv_skb+0x15a/0x410 net/netlink/af_netlink.c:2469
 netlink_unicast_kernel net/netlink/af_netlink.c:1303 [inline]
 netlink_unicast+0x537/0x740 net/netlink/af_netlink.c:1329
 netlink_sendmsg+0x882/0xe10 net/netlink/af_netlink.c:1918
 sock_sendmsg_nosec net/socket.c:652 [inline]
 sock_sendmsg+0xcf/0x120 net/socket.c:672
 __sys_sendto+0x219/0x330 net/socket.c:1995
 __do_sys_sendto net/socket.c:2007 [inline]
 __se_sys_sendto net/socket.c:2003 [inline]
 __x64_sys_sendto+0xdd/0x1b0 net/socket.c:2003
 do_syscall_64+0xf6/0x7d0 arch/x86/entry/common.c:295
 entry_SYSCALL_64_after_hwframe+0x49/0xb3

Freed by task 0:
(stack is not available)

The buggy address belongs to the object at ffff888094d96000
 which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 3876 bytes inside of
 4096-byte region [ffff888094d96000, ffff888094d97000)
The buggy address belongs to the page:
page:ffffea0002536580 refcount:1 mapcount:0 mapping:00000000c278d3e1 index:0x0 head:ffffea0002536580 order:1 compound_mapcount:0
flags: 0xfffe0000010200(slab|head)
raw: 00fffe0000010200 ffffea00024d5088 ffffea0002a47788 ffff8880aa002000
raw: 0000000000000000 ffff888094d96000 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff888094d96e00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888094d96e80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888094d96f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                               ^
 ffff888094d96f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888094d97000: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (5):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/05/20 00:57 bpf-next dda18a5c0b75 67fa1f59 .config console log report syz C ci-upstream-bpf-next-kasan-gce
2020/05/21 22:59 bpf-next dda18a5c0b75 1f30020f .config console log report ci-upstream-bpf-next-kasan-gce
2020/05/20 12:24 net-next-old 4f65e2f483b6 1255f02a .config console log report ci-upstream-net-kasan-gce
2020/05/20 00:36 bpf-next dda18a5c0b75 67fa1f59 .config console log report ci-upstream-bpf-next-kasan-gce
2020/05/20 00:26 bpf-next dda18a5c0b75 67fa1f59 .config console log report ci-upstream-bpf-next-kasan-gce
* Struck through repros no longer work on HEAD.