KASAN: use-after-free Read in selinux_ip_postroute

5 views
Skip to first unread message

syzbot

unread,
Nov 21, 2019, 9:54:07 PM11/21/19
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 8fe42840 Merge 4.9.141 into android-4.9
git tree: https://android.googlesource.com/kernel/common android-4.9
console output: https://syzkaller.appspot.com/x/log.txt?x=102e807ae00000
kernel config: https://syzkaller.appspot.com/x/.config?x=22a5ba9f73b6da1d
dashboard link: https://syzkaller.appspot.com/bug?extid=5a898b5acd195fb063c2
compiler: gcc (GCC) 8.0.1 20180413 (experimental)

Unfortunately, I don't have any reproducer for this crash yet.

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+5a898b...@syzkaller.appspotmail.com

==================================================================
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
==================================================================


---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

syzbot

unread,
Mar 20, 2020, 9:54:08 PM3/20/20
to syzkaller-a...@googlegroups.com
Auto-closing this bug as obsolete.
Crashes did not happen for a while, no reproducer and no activity.
Reply all
Reply to author
Forward
0 new messages