KASAN: use-after-free Read in rt6_dump_route

From: syzbot <hidden>
Date: 2018-01-19 08:17:03

Hello,

syzbot hit the following crash on net-next commit
564737f981fb4b4b3266901508bb9b90d9d43de8

Unfortunately, I don't have any reproducer for this crash yet.
Raw console output is attached.
compiler: gcc (GCC) 7.1.1 20170620
.config is attached.

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+f87d3d3b24e8c0150dd6@syzkaller.appspotmail.com
It will help syzbot understand when the bug is fixed. See footer for  
details.
If you forward the report, please keep this part and the footer.

==================================================================
BUG: KASAN: use-after-free in rt6_dump_route+0x287/0x2f0  
net/ipv6/route.c:4436
Read of size 4 at addr ffff8801ca95dc14 by task syz-executor2/9561

CPU: 1 PID: 9561 Comm: syz-executor2 Not tainted 4.15.0-rc7+ #189
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011
Call Trace:
  __dump_stack lib/dump_stack.c:17 [inline]
  dump_stack+0x194/0x257 lib/dump_stack.c:53
  print_address_description+0x73/0x250 mm/kasan/report.c:252
  kasan_report_error mm/kasan/report.c:351 [inline]
  kasan_report+0x25b/0x340 mm/kasan/report.c:409
  __asan_report_load4_noabort+0x14/0x20 mm/kasan/report.c:429
  rt6_dump_route+0x287/0x2f0 net/ipv6/route.c:4436
  fib6_dump_node+0x100/0x1a0 net/ipv6/ip6_fib.c:431
  fib6_walk_continue+0x46c/0x8a0 net/ipv6/ip6_fib.c:1838
  fib6_walk+0x91/0xf0 net/ipv6/ip6_fib.c:1886
  fib6_dump_table net/ipv6/ip6_fib.c:490 [inline]
  inet6_dump_fib+0x83d/0xe10 net/ipv6/ip6_fib.c:563
  rtnl_dump_all+0x162/0x460 net/core/rtnetlink.c:3114
  netlink_dump+0x492/0xcf0 net/netlink/af_netlink.c:2222
  __netlink_dump_start+0x4f0/0x6d0 net/netlink/af_netlink.c:2319
  netlink_dump_start include/linux/netlink.h:214 [inline]
  rtnetlink_rcv_msg+0x7f0/0xb10 net/core/rtnetlink.c:4493
  netlink_rcv_skb+0x224/0x470 net/netlink/af_netlink.c:2441
  rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:4548
  netlink_unicast_kernel net/netlink/af_netlink.c:1308 [inline]
  netlink_unicast+0x4c4/0x6b0 net/netlink/af_netlink.c:1334
  netlink_sendmsg+0xa4a/0xe60 net/netlink/af_netlink.c:1897
  sock_sendmsg_nosec net/socket.c:630 [inline]
  sock_sendmsg+0xca/0x110 net/socket.c:640
  sock_write_iter+0x31a/0x5d0 net/socket.c:909
  call_write_iter include/linux/fs.h:1772 [inline]
  new_sync_write fs/read_write.c:469 [inline]
  __vfs_write+0x684/0x970 fs/read_write.c:482
  vfs_write+0x189/0x510 fs/read_write.c:544
  SYSC_write fs/read_write.c:589 [inline]
  SyS_write+0xef/0x220 fs/read_write.c:581
  entry_SYSCALL_64_fastpath+0x23/0x9a
RIP: 0033:0x452cf9
RSP: 002b:00007f4663f06c58 EFLAGS: 00000212 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 000000000071bf58 RCX: 0000000000452cf9
RDX: 0000000000000024 RSI: 000000002068cfdc RDI: 0000000000000013
RBP: 0000000000000579 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000212 R12: 00000000006f63f8
R13: 00000000ffffffff R14: 00007f4663f076d4 R15: 0000000000000001

Allocated by task 5943:
  save_stack+0x43/0xd0 mm/kasan/kasan.c:447
  set_track mm/kasan/kasan.c:459 [inline]
  kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:551
  kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:489
  kmem_cache_alloc+0x12e/0x760 mm/slab.c:3544
  dst_alloc+0x11f/0x1a0 net/core/dst.c:104
  __ip6_dst_alloc+0x35/0x90 net/ipv6/route.c:361
  ip6_dst_alloc+0x29/0xb0 net/ipv6/route.c:376
  ip6_route_info_create+0x4ff/0x2e20 net/ipv6/route.c:2538
  ip6_route_add+0xa2/0x190 net/ipv6/route.c:2779
  ipv6_route_ioctl+0x4db/0x6b0 net/ipv6/route.c:3299
  inet6_ioctl+0xef/0x1e0 net/ipv6/af_inet6.c:520
  sock_do_ioctl+0x65/0xb0 net/socket.c:958
  sock_ioctl+0x2c2/0x440 net/socket.c:1055
  vfs_ioctl fs/ioctl.c:46 [inline]
  do_vfs_ioctl+0x1b1/0x1520 fs/ioctl.c:686
  SYSC_ioctl fs/ioctl.c:701 [inline]
  SyS_ioctl+0x8f/0xc0 fs/ioctl.c:692
  entry_SYSCALL_64_fastpath+0x23/0x9a

Freed by task 8598:
  save_stack+0x43/0xd0 mm/kasan/kasan.c:447
  set_track mm/kasan/kasan.c:459 [inline]
  kasan_slab_free+0x71/0xc0 mm/kasan/kasan.c:524
  __cache_free mm/slab.c:3488 [inline]
  kmem_cache_free+0x83/0x2a0 mm/slab.c:3746
  dst_destroy+0x257/0x370 net/core/dst.c:140
  dst_destroy_rcu+0x16/0x20 net/core/dst.c:153
  __rcu_reclaim kernel/rcu/rcu.h:195 [inline]
  rcu_do_batch kernel/rcu/tree.c:2758 [inline]
  invoke_rcu_callbacks kernel/rcu/tree.c:3012 [inline]
  __rcu_process_callbacks kernel/rcu/tree.c:2979 [inline]
  rcu_process_callbacks+0xd6c/0x17f0 kernel/rcu/tree.c:2996
  __do_softirq+0x2d7/0xb85 kernel/softirq.c:285

The buggy address belongs to the object at ffff8801ca95db40
  which belongs to the cache ip6_dst_cache of size 320
The buggy address is located 212 bytes inside of
  320-byte region [ffff8801ca95db40, ffff8801ca95dc80)
The buggy address belongs to the page:
page:ffffea00072a5740 count:1 mapcount:0 mapping:ffff8801ca95d0c0  
index:0xffff8801ca95d3c0
flags: 0x2fffc0000000100(slab)
raw: 02fffc0000000100 ffff8801ca95d0c0 ffff8801ca95d3c0 0000000100000008
raw: ffffea00074c1ce0 ffffea0007663b60 ffff8801d326a900 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
  ffff8801ca95db00: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
  ffff8801ca95db80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8801ca95dc00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                          ^
  ffff8801ca95dc80: fc fc fc fc fc fc fc fc 00 00 00 00 00 00 00 00
  ffff8801ca95dd00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================


---
This bug is generated by a dumb bot. It may contain errors.
See https://goo.gl/tpsmEJ for details.
Direct all questions to syzkaller@googlegroups.com.

syzbot will keep track of this bug report.
If you forgot to add the Reported-by tag, once the fix for this bug is  
merged
into any tree, please reply to this email with:
#syz fix: exact-commit-title
To mark this as a duplicate of another syzbot report, please reply with:
#syz dup: exact-subject-of-another-report
If it's a one-off invalid bug report, please reply with:
#syz invalid
Note: if the crash happens again, it will cause creation of a new bug  
report.
Note: all commands must start from beginning of the line in the email body.

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help