syzbot


KASAN: use-after-free Read in selinux_ip_postroute

Status: auto-closed as invalid on 2020/03/21 01:54
Reported-by: syzbot+5a898b5acd195fb063c2@syzkaller.appspotmail.com
First crash: 1611d, last: 1611d

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in selinux_ip_postroute+0x8ce/0xad0 security/selinux/hooks.c:5205
Read of size 4 at addr ffff8800a90cc128 by task syz-executor.0/12273

CPU: 1 PID: 12273 Comm: syz-executor.0 Not tainted 4.9.141+ #1
 ffff8800b953f098 ffffffff81b42e79 ffffea0002a43300 ffff8800a90cc128
 0000000000000000 ffff8800a90cc128 ffff8800a90cc000 ffff8800b953f0d0
 ffffffff815009b8 ffff8800a90cc128 0000000000000004 0000000000000000
Call Trace:
 [<ffffffff81b42e79>] __dump_stack lib/dump_stack.c:15 [inline]
 [<ffffffff81b42e79>] dump_stack+0xc1/0x128 lib/dump_stack.c:51
 [<ffffffff815009b8>] print_address_description+0x6c/0x234 mm/kasan/report.c:256
 [<ffffffff81500dc2>] kasan_report_error mm/kasan/report.c:355 [inline]
 [<ffffffff81500dc2>] kasan_report.cold.6+0x242/0x2fe mm/kasan/report.c:412
 [<ffffffff814f3054>] __asan_report_load4_noabort+0x14/0x20 mm/kasan/report.c:432
 [<ffffffff81a0c67e>] selinux_ip_postroute+0x8ce/0xad0 security/selinux/hooks.c:5205
 [<ffffffff81a0c8be>] selinux_ipv6_postroute+0x3e/0x50 security/selinux/hooks.c:5348
 [<ffffffff823ddae6>] nf_iterate+0x126/0x310 net/netfilter/core.c:324
 [<ffffffff823ddde4>] nf_hook_slow+0x114/0x1e0 net/netfilter/core.c:355
 [<ffffffff826a2949>] nf_hook_thresh include/linux/netfilter.h:191 [inline]
 [<ffffffff826a2949>] NF_HOOK_COND include/linux/netfilter.h:245 [inline]
 [<ffffffff826a2949>] ip6_output+0x489/0x6d0 net/ipv6/ip6_output.c:162
 [<ffffffff827bce1b>] dst_output include/net/dst.h:507 [inline]
 [<ffffffff827bce1b>] ip6_local_out+0x9b/0x180 net/ipv6/output_core.c:176
 [<ffffffff826a4891>] ip6_send_skb+0xa1/0x340 net/ipv6/ip6_output.c:1751
 [<ffffffff82706689>] udp_v6_send_skb+0x429/0xe70 net/ipv6/udp.c:974
 [<ffffffff827072fd>] udp_v6_push_pending_frames+0x22d/0x340 net/ipv6/udp.c:1007
 [<ffffffff827092b1>] udpv6_sendmsg+0x1dc1/0x2430 net/ipv6/udp.c:1273
 [<ffffffff825952f3>] inet_sendmsg+0x203/0x4d0 net/ipv4/af_inet.c:770
 [<ffffffff822a063b>] sock_sendmsg_nosec net/socket.c:648 [inline]
 [<ffffffff822a063b>] sock_sendmsg+0xbb/0x110 net/socket.c:658
 [<ffffffff822a209a>] ___sys_sendmsg+0x47a/0x840 net/socket.c:1982
 [<ffffffff822a55a1>] __sys_sendmmsg+0x161/0x3d0 net/socket.c:2072
 [<ffffffff822a5845>] SYSC_sendmmsg net/socket.c:2103 [inline]
 [<ffffffff822a5845>] SyS_sendmmsg+0x35/0x60 net/socket.c:2098
 [<ffffffff810056ef>] do_syscall_64+0x19f/0x550 arch/x86/entry/common.c:285
 [<ffffffff82817893>] entry_SYSCALL_64_after_swapgs+0x5d/0xdb

Allocated by task 12247:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57
 save_stack mm/kasan/kasan.c:505 [inline]
 set_track mm/kasan/kasan.c:517 [inline]
 kasan_kmalloc.part.1+0x62/0xf0 mm/kasan/kasan.c:609
 kasan_kmalloc+0xaf/0xc0 mm/kasan/kasan.c:594
 kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:547
 slab_post_alloc_hook mm/slab.h:417 [inline]
 slab_alloc_node mm/slub.c:2715 [inline]
 slab_alloc mm/slub.c:2723 [inline]
 kmem_cache_alloc+0xd5/0x2b0 mm/slub.c:2728
 __build_skb+0x35/0x2d0 net/core/skbuff.c:310
 netlink_alloc_large_skb net/netlink/af_netlink.c:1166 [inline]
 netlink_sendmsg+0x492/0xc30 net/netlink/af_netlink.c:1834
 sock_sendmsg_nosec net/socket.c:648 [inline]
 sock_sendmsg+0xbb/0x110 net/socket.c:658
 kernel_sendmsg+0x43/0x50 net/socket.c:666
 sock_no_sendpage+0x112/0x150 net/core/sock.c:2334
 kernel_sendpage+0x93/0xf0 net/socket.c:3334
 sock_sendpage+0x8c/0xc0 net/socket.c:802
 pipe_to_sendpage+0x266/0x330 fs/splice.c:470
 splice_from_pipe_feed fs/splice.c:521 [inline]
 __splice_from_pipe+0x316/0x710 fs/splice.c:645
 splice_from_pipe+0xf9/0x170 fs/splice.c:680
 generic_splice_sendpage+0x3c/0x50 fs/splice.c:851
 do_splice_from fs/splice.c:870 [inline]
 do_splice fs/splice.c:1166 [inline]
 SYSC_splice fs/splice.c:1416 [inline]
 SyS_splice+0xe4d/0x14d0 fs/splice.c:1399
 do_syscall_64+0x19f/0x550 arch/x86/entry/common.c:285
 entry_SYSCALL_64_after_swapgs+0x5d/0xdb

Freed by task 12247:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57
 save_stack mm/kasan/kasan.c:505 [inline]
 set_track mm/kasan/kasan.c:517 [inline]
 kasan_slab_free+0xac/0x190 mm/kasan/kasan.c:582
 slab_free_hook mm/slub.c:1355 [inline]
 slab_free_freelist_hook mm/slub.c:1377 [inline]
 slab_free mm/slub.c:2958 [inline]
 kmem_cache_free+0xbe/0x310 mm/slub.c:2980
 kfree_skbmem+0x98/0x100 net/core/skbuff.c:623
 __kfree_skb net/core/skbuff.c:685 [inline]
 consume_skb+0xce/0x340 net/core/skbuff.c:757
 netlink_unicast_kernel net/netlink/af_netlink.c:1286 [inline]
 netlink_unicast+0x4e0/0x6d0 net/netlink/af_netlink.c:1311
 netlink_sendmsg+0x694/0xc30 net/netlink/af_netlink.c:1859
 sock_sendmsg_nosec net/socket.c:648 [inline]
 sock_sendmsg+0xbb/0x110 net/socket.c:658
 kernel_sendmsg+0x43/0x50 net/socket.c:666
 sock_no_sendpage+0x112/0x150 net/core/sock.c:2334
 kernel_sendpage+0x93/0xf0 net/socket.c:3334
 sock_sendpage+0x8c/0xc0 net/socket.c:802
 pipe_to_sendpage+0x266/0x330 fs/splice.c:470
 splice_from_pipe_feed fs/splice.c:521 [inline]
 __splice_from_pipe+0x316/0x710 fs/splice.c:645
 splice_from_pipe+0xf9/0x170 fs/splice.c:680
 generic_splice_sendpage+0x3c/0x50 fs/splice.c:851
 do_splice_from fs/splice.c:870 [inline]
 do_splice fs/splice.c:1166 [inline]
 SYSC_splice fs/splice.c:1416 [inline]
 SyS_splice+0xe4d/0x14d0 fs/splice.c:1399
 do_syscall_64+0x19f/0x550 arch/x86/entry/common.c:285
 entry_SYSCALL_64_after_swapgs+0x5d/0xdb

The buggy address belongs to the object at ffff8800a90cc000
 which belongs to the cache skbuff_head_cache of size 224
The buggy address is located 72 bytes to the right of
 224-byte region [ffff8800a90cc000, ffff8800a90cc0e0)
The buggy address belongs to the page:
page:ffffea0002a43300 count:1 mapcount:0 mapping:          (null) index:0x0
flags: 0x80(slab)
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8800a90cc000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8800a90cc080: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
>ffff8800a90cc100: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
                                  ^
 ffff8800a90cc180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8800a90cc200: fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/11/22 01:53 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 8098ea0f .config console log report ci-android-49-kasan-gce
* Struck through repros no longer work on HEAD.