syzbot


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

Status: closed as invalid on 2017/12/06 12:46
Subsystems: net
[Documentation on labels]
Reported-by: syzbot+0b92f4581f756b6f5efe2290efd6892551f22862@syzkaller.appspotmail.com
First crash: 2414d, last: 2399d
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-414 KASAN: slab-out-of-bounds Read in tun_net_xmit C 3 1942d 1850d 0/1 public: reported C repro on 2019/04/10 16:04
android-49 KASAN: slab-out-of-bounds Read in tun_net_xmit syz 3386 1613d 1847d 0/3 public: reported syz repro on 2019/04/14 09:28
upstream KASAN: slab-out-of-bounds Read in tun_net_xmit (2) net C 10 1951d 2119d 11/26 fixed on 2019/01/15 20:25

Sample crash report:
==================================================================
BUG: KASAN: slab-out-of-bounds in __ptr_ring_produce include/linux/ptr_ring.h:107 [inline]
BUG: KASAN: slab-out-of-bounds in ptr_ring_produce include/linux/ptr_ring.h:126 [inline]
BUG: KASAN: slab-out-of-bounds in skb_array_produce include/linux/skb_array.h:48 [inline]
BUG: KASAN: slab-out-of-bounds in tun_net_xmit+0x120a/0x1280 drivers/net/tun.c:994
Read of size 8 at addr ffff8801c29adba0 by task syz-executor5/4054

CPU: 0 PID: 4054 Comm: syz-executor5 Not tainted 4.14.0-rc3-mm1+ #14
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:16 [inline]
 dump_stack+0x194/0x257 lib/dump_stack.c:52
 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_load8_noabort+0x14/0x20 mm/kasan/report.c:430
 __ptr_ring_produce include/linux/ptr_ring.h:107 [inline]
 ptr_ring_produce include/linux/ptr_ring.h:126 [inline]
 skb_array_produce include/linux/skb_array.h:48 [inline]
 tun_net_xmit+0x120a/0x1280 drivers/net/tun.c:994
 __netdev_start_xmit include/linux/netdevice.h:4000 [inline]
 netdev_start_xmit include/linux/netdevice.h:4009 [inline]
 xmit_one net/core/dev.c:2979 [inline]
 dev_hard_start_xmit+0x248/0xac0 net/core/dev.c:2995
 sch_direct_xmit+0x31d/0x6d0 net/sched/sch_generic.c:186
 __dev_xmit_skb net/core/dev.c:3177 [inline]
 __dev_queue_xmit+0x16c6/0x2050 net/core/dev.c:3444
 dev_queue_xmit+0x17/0x20 net/core/dev.c:3509
 neigh_hh_output include/net/neighbour.h:471 [inline]
 neigh_output include/net/neighbour.h:479 [inline]
 ip6_finish_output2+0x13c4/0x22a0 net/ipv6/ip6_output.c:120
 ip6_finish_output+0x2f9/0x920 net/ipv6/ip6_output.c:146
 NF_HOOK_COND include/linux/netfilter.h:238 [inline]
 ip6_output+0x1f4/0x850 net/ipv6/ip6_output.c:163
 dst_output include/net/dst.h:458 [inline]
 NF_HOOK.constprop.35+0xff/0x630 include/linux/netfilter.h:249
 mld_sendpack+0x6a8/0xcc0 net/ipv6/mcast.c:1660
 mld_send_cr net/ipv6/mcast.c:1951 [inline]
 mld_ifc_timer_expire+0x3c5/0x750 net/ipv6/mcast.c:2448
 call_timer_fn+0x246/0x850 kernel/time/timer.c:1281
 expire_timers kernel/time/timer.c:1320 [inline]
 __run_timers+0x7fd/0xb90 kernel/time/timer.c:1620
 run_timer_softirq+0x4c/0xb0 kernel/time/timer.c:1646
 __do_softirq+0x29d/0xbb2 kernel/softirq.c:284
 invoke_softirq kernel/softirq.c:364 [inline]
 irq_exit+0x1d3/0x210 kernel/softirq.c:405
 exiting_irq arch/x86/include/asm/apic.h:540 [inline]
 smp_apic_timer_interrupt+0x16b/0x700 arch/x86/kernel/apic/apic.c:1041
 apic_timer_interrupt+0x9d/0xb0 arch/x86/entry/entry_64.S:770
 </IRQ>
RIP: 0010:___might_sleep+0x1/0x470 kernel/sched/core.c:6005
RSP: 0000:ffff8801c29476a8 EFLAGS: 00000286 ORIG_RAX: ffffffffffffff11
RAX: ffff8801c2502100 RBX: 000000000000016d RCX: 0000000000000000
RDX: 0000000000000000 RSI: 00000000000011ef RDI: ffffffff84f08500
RBP: ffff8801c29476f8 R08: 0000160000000000 R09: 0000000000000000
R10: ffffffffffffffe8 R11: 0000000000000000 R12: ffffea0006528000
R13: 00000000000001b4 R14: dffffc0000000000 R15: ffffffff84f08500
 __do_huge_pmd_anonymous_page mm/huge_memory.c:570 [inline]
 do_huge_pmd_anonymous_page+0x59c/0x1b00 mm/huge_memory.c:728
 create_huge_pmd mm/memory.c:3823 [inline]
 __handle_mm_fault+0x1827/0x39c0 mm/memory.c:4026
 handle_mm_fault+0x334/0x8d0 mm/memory.c:4092
 __do_page_fault+0x5bd/0xd60 arch/x86/mm/fault.c:1444
 do_page_fault+0xee/0x720 arch/x86/mm/fault.c:1520
 page_fault+0x22/0x30 arch/x86/entry/entry_64.S:1066
RIP: 0033:0x405424
RSP: 002b:0000000000a6f8e0 EFLAGS: 00010246
RAX: 0000000020b91000 RBX: 0000000000000000 RCX: 0000000000000000
RDX: eb7cab32f103e719 RSI: 0000000000000000 RDI: 0000000000ae8848
RBP: 0000000000000000 R08: 0000000000000000 R09: 000000000000005d
R10: 0000000000a6f980 R11: 0000000000000000 R12: fffffffffffffffe
R13: 00000000007180b0 R14: 0000000020b91000 R15: 0000000000000016

Allocated by task 4064:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
 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
 __do_kmalloc mm/slab.c:3726 [inline]
 __kmalloc+0x162/0x760 mm/slab.c:3735
 kmalloc_array include/linux/slab.h:627 [inline]
 kcalloc include/linux/slab.h:638 [inline]
 __ptr_ring_init_queue_alloc include/linux/ptr_ring.h:441 [inline]
 ptr_ring_resize_multiple include/linux/ptr_ring.h:599 [inline]
 skb_array_resize_multiple include/linux/skb_array.h:200 [inline]
 tun_queue_resize drivers/net/tun.c:2987 [inline]
 tun_device_event+0x3d3/0xcd0 drivers/net/tun.c:3005
 notifier_call_chain+0x136/0x2c0 kernel/notifier.c:93
 __raw_notifier_call_chain kernel/notifier.c:394 [inline]
 raw_notifier_call_chain+0x2d/0x40 kernel/notifier.c:401
 call_netdevice_notifiers_info+0x51/0x90 net/core/dev.c:1671
 call_netdevice_notifiers+0x6a/0x90 net/core/dev.c:1687
 do_setlink+0xbeb/0x38d0 net/core/rtnetlink.c:2135
 rtnl_setlink+0x270/0x3c0 net/core/rtnetlink.c:2346
 rtnetlink_rcv_msg+0x733/0x1090 net/core/rtnetlink.c:4292
 netlink_rcv_skb+0x216/0x440 net/netlink/af_netlink.c:2405
 rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:4304
 netlink_unicast_kernel net/netlink/af_netlink.c:1273 [inline]
 netlink_unicast+0x4e8/0x6f0 net/netlink/af_netlink.c:1299
 netlink_sendmsg+0xa4a/0xe70 net/netlink/af_netlink.c:1862
 sock_sendmsg_nosec net/socket.c:633 [inline]
 sock_sendmsg+0xca/0x110 net/socket.c:643
 sock_write_iter+0x320/0x5e0 net/socket.c:912
 call_write_iter include/linux/fs.h:1770 [inline]
 do_iter_readv_writev+0x531/0x7f0 fs/read_write.c:673
 do_iter_write+0x15a/0x540 fs/read_write.c:952
 vfs_writev+0x18a/0x340 fs/read_write.c:997
 do_writev+0xfc/0x2a0 fs/read_write.c:1032
 SYSC_writev fs/read_write.c:1105 [inline]
 SyS_writev+0x27/0x30 fs/read_write.c:1102
 entry_SYSCALL_64_fastpath+0x1f/0xbe

Freed by task 0:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
 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:3504 [inline]
 kfree+0xca/0x250 mm/slab.c:3821
 selinux_cred_free+0x48/0x70 security/selinux/hooks.c:3807
 security_cred_free+0x48/0x80 security/security.c:994
 put_cred_rcu+0x106/0x400 kernel/cred.c:117
 __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+0xd74/0x17d0 kernel/rcu/tree.c:2996
 __do_softirq+0x29d/0xbb2 kernel/softirq.c:284

The buggy address belongs to the object at ffff8801c29adb80
 which belongs to the cache kmalloc-32 of size 32
The buggy address is located 0 bytes to the right of
 32-byte region [ffff8801c29adb80, ffff8801c29adba0)
The buggy address belongs to the page:
page:ffffea00070a6b40 count:1 mapcount:0 mapping:ffff8801c29ad000 index:0xffff8801c29adfc1
flags: 0x200000000000100(slab)
raw: 0200000000000100 ffff8801c29ad000 ffff8801c29adfc1 000000010000003f
raw: ffffea00070a8960 ffffea00070914e0 ffff8801dac001c0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801c29ada80: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
 ffff8801c29adb00: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
>ffff8801c29adb80: 00 00 00 00 fc fc fc fc fb fb fb fb fc fc fc fc
                               ^
 ffff8801c29adc00: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
 ffff8801c29adc80: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
==================================================================

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2017/10/09 12:38 mmots fb686cb13e51 c26ea367 .config console log report ci-upstream-mmots-kasan-gce
2017/09/23 19:31 mmots 720bbe532b7c c26ea367 .config console log report ci-upstream-mmots-kasan-gce
* Struck through repros no longer work on HEAD.