syzbot


KASAN: use-after-free Read in bpf_clone_redirect

Status: public: reported C repro on 2019/04/12 00:00
Reported-by: syzbot+87eaea991b22e432536b@syzkaller.appspotmail.com
First crash: 2054d, last: 1614d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 KASAN: use-after-free Read in bpf_clone_redirect 6 1614d 1711d 0/1 auto-closed as invalid on 2020/03/20 16:38

Sample crash report:
audit: type=1400 audit(1574359472.378:8): avc:  denied  { prog_load } for  pid=1783 comm="syz-executor070" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=bpf permissive=1
==================================================================
audit: type=1400 audit(1574359472.418:9): avc:  denied  { prog_run } for  pid=1783 comm="syz-executor070" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=bpf permissive=1
BUG: KASAN: use-after-free in ____bpf_clone_redirect net/core/filter.c:1768 [inline]
BUG: KASAN: use-after-free in bpf_clone_redirect+0x2a7/0x2b0 net/core/filter.c:1759
Read of size 8 at addr ffff8881d013d1d0 by task syz-executor070/1783

CPU: 0 PID: 1783 Comm: syz-executor070 Not tainted 4.14.155-syzkaller #0
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0xe5/0x154 lib/dump_stack.c:58
 print_address_description+0x60/0x226 mm/kasan/report.c:187
 __kasan_report.cold+0x1a/0x41 mm/kasan/report.c:316
 ____bpf_clone_redirect net/core/filter.c:1768 [inline]
 bpf_clone_redirect+0x2a7/0x2b0 net/core/filter.c:1759
 ___bpf_prog_run+0x2478/0x5510 kernel/bpf/core.c:1095

Allocated by task 1781:
 save_stack mm/kasan/common.c:76 [inline]
 set_track mm/kasan/common.c:85 [inline]
 __kasan_kmalloc.part.0+0x53/0xc0 mm/kasan/common.c:501
 slab_post_alloc_hook mm/slab.h:439 [inline]
 slab_alloc_node mm/slub.c:2792 [inline]
 slab_alloc mm/slub.c:2800 [inline]
 kmem_cache_alloc+0xee/0x360 mm/slub.c:2805
 skb_clone+0x124/0x370 net/core/skbuff.c:1282
 dev_queue_xmit_nit+0x2f3/0x970 net/core/dev.c:1943
 xmit_one net/core/dev.c:3005 [inline]
 dev_hard_start_xmit+0xa3/0x8c0 net/core/dev.c:3025
 sch_direct_xmit+0x27a/0x520 net/sched/sch_generic.c:186
 __dev_xmit_skb net/core/dev.c:3218 [inline]
 __dev_queue_xmit+0x1594/0x1d00 net/core/dev.c:3493
 neigh_hh_output include/net/neighbour.h:490 [inline]
 neigh_output include/net/neighbour.h:498 [inline]
 ip_finish_output2+0x9fe/0x12f0 net/ipv4/ip_output.c:229
 ip_finish_output+0x3be/0xc80 net/ipv4/ip_output.c:317
 NF_HOOK_COND include/linux/netfilter.h:239 [inline]
 ip_output+0x1cf/0x520 net/ipv4/ip_output.c:405
 dst_output include/net/dst.h:462 [inline]
 ip_local_out+0x98/0x170 net/ipv4/ip_output.c:124
 ip_queue_xmit+0x7ca/0x1a70 net/ipv4/ip_output.c:504
 __tcp_transmit_skb+0x18bc/0x2e20 net/ipv4/tcp_output.c:1130
 tcp_transmit_skb net/ipv4/tcp_output.c:1146 [inline]
 tcp_write_xmit+0x510/0x4780 net/ipv4/tcp_output.c:2382
 __tcp_push_pending_frames+0xa0/0x230 net/ipv4/tcp_output.c:2563
 tcp_push+0x402/0x600 net/ipv4/tcp.c:715
 tcp_sendmsg_locked+0x21f6/0x2f60 net/ipv4/tcp.c:1426
 tcp_sendmsg+0x2b/0x40 net/ipv4/tcp.c:1457
 inet_sendmsg+0x15b/0x520 net/ipv4/af_inet.c:760
 sock_sendmsg_nosec net/socket.c:646 [inline]
 sock_sendmsg+0xb7/0x100 net/socket.c:656
 sock_write_iter+0x20f/0x360 net/socket.c:925
 call_write_iter include/linux/fs.h:1798 [inline]
 new_sync_write fs/read_write.c:471 [inline]
 __vfs_write+0x401/0x5a0 fs/read_write.c:484
 vfs_write+0x17f/0x4d0 fs/read_write.c:546
 SYSC_write fs/read_write.c:594 [inline]
 SyS_write+0x102/0x250 fs/read_write.c:586
 do_syscall_64+0x19b/0x520 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
 0xffffffffffffffff

Freed by task 1781:
 save_stack mm/kasan/common.c:76 [inline]
 set_track mm/kasan/common.c:85 [inline]
 __kasan_slab_free+0x164/0x210 mm/kasan/common.c:463
 slab_free_hook mm/slub.c:1407 [inline]
 slab_free_freelist_hook mm/slub.c:1458 [inline]
 slab_free mm/slub.c:3039 [inline]
 kmem_cache_free+0xd7/0x3b0 mm/slub.c:3055
 kfree_skbmem net/core/skbuff.c:586 [inline]
 kfree_skbmem+0xa0/0x110 net/core/skbuff.c:580
 __kfree_skb net/core/skbuff.c:646 [inline]
 kfree_skb+0xeb/0x370 net/core/skbuff.c:663
 packet_rcv_spkt+0xd5/0x4d0 net/packet/af_packet.c:1888
 dev_queue_xmit_nit+0x6e1/0x970 net/core/dev.c:1975
 xmit_one net/core/dev.c:3005 [inline]
 dev_hard_start_xmit+0xa3/0x8c0 net/core/dev.c:3025
 sch_direct_xmit+0x27a/0x520 net/sched/sch_generic.c:186
 __dev_xmit_skb net/core/dev.c:3218 [inline]
 __dev_queue_xmit+0x1594/0x1d00 net/core/dev.c:3493
 neigh_hh_output include/net/neighbour.h:490 [inline]
 neigh_output include/net/neighbour.h:498 [inline]
 ip_finish_output2+0x9fe/0x12f0 net/ipv4/ip_output.c:229
 ip_finish_output+0x3be/0xc80 net/ipv4/ip_output.c:317
 NF_HOOK_COND include/linux/netfilter.h:239 [inline]
 ip_output+0x1cf/0x520 net/ipv4/ip_output.c:405
 dst_output include/net/dst.h:462 [inline]
 ip_local_out+0x98/0x170 net/ipv4/ip_output.c:124
 ip_queue_xmit+0x7ca/0x1a70 net/ipv4/ip_output.c:504
 __tcp_transmit_skb+0x18bc/0x2e20 net/ipv4/tcp_output.c:1130
 tcp_transmit_skb net/ipv4/tcp_output.c:1146 [inline]
 tcp_write_xmit+0x510/0x4780 net/ipv4/tcp_output.c:2382
 __tcp_push_pending_frames+0xa0/0x230 net/ipv4/tcp_output.c:2563
 tcp_push+0x402/0x600 net/ipv4/tcp.c:715
 tcp_sendmsg_locked+0x21f6/0x2f60 net/ipv4/tcp.c:1426
 tcp_sendmsg+0x2b/0x40 net/ipv4/tcp.c:1457
 inet_sendmsg+0x15b/0x520 net/ipv4/af_inet.c:760
 sock_sendmsg_nosec net/socket.c:646 [inline]
 sock_sendmsg+0xb7/0x100 net/socket.c:656
 sock_write_iter+0x20f/0x360 net/socket.c:925
 call_write_iter include/linux/fs.h:1798 [inline]
 new_sync_write fs/read_write.c:471 [inline]
 __vfs_write+0x401/0x5a0 fs/read_write.c:484
 vfs_write+0x17f/0x4d0 fs/read_write.c:546
 SYSC_write fs/read_write.c:594 [inline]
 SyS_write+0x102/0x250 fs/read_write.c:586
 do_syscall_64+0x19b/0x520 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
 0xffffffffffffffff

The buggy address belongs to the object at ffff8881d013d140
 which belongs to the cache skbuff_head_cache of size 224
The buggy address is located 144 bytes inside of
 224-byte region [ffff8881d013d140, ffff8881d013d220)
The buggy address belongs to the page:
page:ffffea0007404f40 count:1 mapcount:0 mapping:          (null) index:0x0
flags: 0x4000000000000200(slab)
raw: 4000000000000200 0000000000000000 0000000000000000 00000001800c000c
raw: dead000000000100 dead000000000200 ffff8881d6770200 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8881d013d080: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
 ffff8881d013d100: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
>ffff8881d013d180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                 ^
 ffff8881d013d200: fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8881d013d280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (30):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/11/21 18:07 android-4.14 7bc77fd33905 8098ea0f .config console log report syz C ci-android-414-kasan-gce-root
2019/10/25 07:08 android-4.14 3e5dc4ed2d3f d01bb02a .config console log report syz C ci-android-414-kasan-gce-root
2019/08/28 17:40 android-4.14 987732fcbbe3 fd37b39e .config console log report syz C ci-android-414-kasan-gce-root
2019/08/17 04:36 android-4.14 6115e5154b7b 8fd428a1 .config console log report syz C ci-android-414-kasan-gce-root
2019/07/19 13:21 android-4.14 269f182fac0b 1656845f .config console log report syz C ci-android-414-kasan-gce-root
2018/10/13 08:27 android-4.14 b7e40c3d444a caf12900 .config console log report syz C ci-android-414-kasan-gce-root
2018/10/04 02:15 android-4.14 cf748a3e868e 8b311eaf .config console log report syz C ci-android-414-kasan-gce-root
2018/09/07 23:06 android-4.14 b859aa7d7a0c 69cfeb80 .config console log report syz C ci-android-414-kasan-gce-root
2019/11/07 12:11 android-4.14 6e5cc2351dea d797d201 .config console log report ci-android-414-kasan-gce-root
2019/10/19 15:07 android-4.14 234de92896af 8c88c9c1 .config console log report ci-android-414-kasan-gce-root
2019/10/19 05:39 android-4.14 234de92896af 8c88c9c1 .config console log report ci-android-414-kasan-gce-root
2019/10/15 05:56 android-4.14 693bea3acb3d 05ad7292 .config console log report ci-android-414-kasan-gce-root
2019/10/12 15:44 android-4.14 1d75f58e4e19 426631dd .config console log report ci-android-414-kasan-gce-root
2019/10/12 06:56 android-4.14 5faab626bf1f 426631dd .config console log report ci-android-414-kasan-gce-root
2019/10/11 15:54 android-4.14 5faab626bf1f 1a3bad90 .config console log report ci-android-414-kasan-gce-root
2019/09/10 06:50 android-4.14 4eccd8013349 a60cb4cd .config console log report ci-android-414-kasan-gce-root
2019/09/02 09:31 android-4.14 a9d0871a562e db7c31ca .config console log report ci-android-414-kasan-gce-root
2019/08/26 15:52 android-4.14 f5189d4af2b5 d21c5d9d .config console log report ci-android-414-kasan-gce-root
2019/08/21 14:56 android-4.14 e204fa49a029 4ea67ff8 .config console log report ci-android-414-kasan-gce-root
2019/08/12 04:06 android-4.14 57ac921eaff1 acb51638 .config console log report ci-android-414-kasan-gce-root
2018/11/19 03:24 android-4.14 4e76528bd48d adf636a8 .config console log report ci-android-414-kasan-gce-root
2018/11/11 20:41 android-4.14 494c2659e60e 7b5f8621 .config console log report ci-android-414-kasan-gce-root
2018/11/09 13:02 android-4.14 2de3f80d5ba2 8fd01d3a .config console log report ci-android-414-kasan-gce-root
2018/11/07 06:24 android-4.14 d4e5dea08bbf 8bd6bd63 .config console log report ci-android-414-kasan-gce-root
2018/11/02 01:17 android-4.14 4ed22187defd 1f38e9ae .config console log report ci-android-414-kasan-gce-root
2018/10/20 23:08 android-4.14 c556d1ffe528 ecb386fe .config console log report ci-android-414-kasan-gce-root
2018/10/03 22:53 android-4.14 cf748a3e868e 8b311eaf .config console log report ci-android-414-kasan-gce-root
2018/09/30 01:35 android-4.14 84ae3e35e1ce 41e4b329 .config console log report ci-android-414-kasan-gce-root
2018/09/28 19:11 android-4.14 56aae8ee7423 137d7c66 .config console log report ci-android-414-kasan-gce-root
2018/09/07 22:47 android-4.14 b859aa7d7a0c 69cfeb80 .config console log report ci-android-414-kasan-gce-root
* Struck through repros no longer work on HEAD.