KASAN: use-after-free Read in bpf_skb_change_tail (2)

6 views
Skip to first unread message

syzbot

unread,
Aug 10, 2019, 6:38:07 AM8/10/19
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 57ac921e Merge 4.14.138 into android-4.14
git tree: android-4.14
console output: https://syzkaller.appspot.com/x/log.txt?x=11afd59a600000
kernel config: https://syzkaller.appspot.com/x/.config?x=2ac71e39ec484d3c
dashboard link: https://syzkaller.appspot.com/bug?extid=f271ab2c54fbb0602575
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=135bf2ee600000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1248e59a600000

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

audit: type=1400 audit(1565431325.817:8): avc: denied { prog_load } for
pid=1786 comm="syz-executor289"
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(1565431325.867:9): avc: denied { prog_run } for
pid=1786 comm="syz-executor289"
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_skb_change_tail
net/core/filter.c:2371 [inline]
BUG: KASAN: use-after-free in bpf_skb_change_tail+0xa62/0xb80
net/core/filter.c:2368
Read of size 8 at addr ffff8881d10f6950 by task syz-executor289/1786

CPU: 1 PID: 1786 Comm: syz-executor289 Not tainted 4.14.138+ #30
Call Trace:
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0xca/0x134 lib/dump_stack.c:53
print_address_description+0x60/0x226 mm/kasan/report.c:187
__kasan_report.cold+0x1a/0x41 mm/kasan/report.c:316
____bpf_skb_change_tail net/core/filter.c:2371 [inline]
bpf_skb_change_tail+0xa62/0xb80 net/core/filter.c:2368
___bpf_prog_run+0x2478/0x5510 kernel/bpf/core.c:1033

Allocated by task 227:
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:495
slab_post_alloc_hook mm/slab.h:439 [inline]
slab_alloc_node mm/slub.c:2758 [inline]
slab_alloc mm/slub.c:2766 [inline]
kmem_cache_alloc+0xd2/0x2e0 mm/slub.c:2771
kmem_cache_alloc_node include/linux/slab.h:361 [inline]
__alloc_skb+0xea/0x5c0 net/core/skbuff.c:193
alloc_skb include/linux/skbuff.h:980 [inline]
netlink_alloc_large_skb net/netlink/af_netlink.c:1158 [inline]
netlink_sendmsg+0x958/0xbe0 net/netlink/af_netlink.c:1852
sock_sendmsg_nosec net/socket.c:646 [inline]
sock_sendmsg+0xb7/0x100 net/socket.c:656
___sys_sendmsg+0x752/0x890 net/socket.c:2062
__sys_sendmsg+0xb6/0x150 net/socket.c:2096
SYSC_sendmsg net/socket.c:2107 [inline]
SyS_sendmsg+0x27/0x40 net/socket.c:2103
do_syscall_64+0x19b/0x520 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7
0xffffffffffffffff

Freed by task 227:
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:457
slab_free_hook mm/slub.c:1403 [inline]
slab_free_freelist_hook mm/slub.c:1430 [inline]
slab_free mm/slub.c:3005 [inline]
kmem_cache_free+0xcb/0x340 mm/slub.c:3021
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
netlink_unicast_kernel net/netlink/af_netlink.c:1289 [inline]
netlink_unicast+0x595/0x650 net/netlink/af_netlink.c:1312
netlink_sendmsg+0x66a/0xbe0 net/netlink/af_netlink.c:1877
sock_sendmsg_nosec net/socket.c:646 [inline]
sock_sendmsg+0xb7/0x100 net/socket.c:656
___sys_sendmsg+0x752/0x890 net/socket.c:2062
__sys_sendmsg+0xb6/0x150 net/socket.c:2096
SYSC_sendmsg net/socket.c:2107 [inline]
SyS_sendmsg+0x27/0x40 net/socket.c:2103
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 ffff8881d10f68c0
which belongs to the cache skbuff_head_cache of size 224
The buggy address is located 144 bytes inside of
224-byte region [ffff8881d10f68c0, ffff8881d10f69a0)
The buggy address belongs to the page:
page:ffffea0007443d80 count:1 mapcount:0 mapping: (null)
index:0xffff8881d10f6c80
flags: 0x4000000000000200(slab)
raw: 4000000000000200 0000000000000000 ffff8881d10f6c80 00000001800c000a
raw: 0000000000000000 0000000100000001 ffff8881dab70200 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8881d10f6800: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
ffff8881d10f6880: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
> ffff8881d10f6900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8881d10f6980: fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
ffff8881d10f6a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


---
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 can test patches for this bug, for details see:
https://goo.gl/tpsmEJ#testing-patches
Reply all
Reply to author
Forward
0 new messages