KASAN: use-after-free Read in dev_get_by_index_rcu

7 views
Skip to first unread message

syzbot

unread,
Mar 20, 2020, 11:31:17 PM3/20/20
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 7e72faf2 ANDROID: Update abi_gki_aarch64_unisoc_whitelist
git tree: android-5.4
console output: https://syzkaller.appspot.com/x/log.txt?x=1257a91de00000
kernel config: https://syzkaller.appspot.com/x/.config?x=12541171095551c4
dashboard link: https://syzkaller.appspot.com/bug?extid=664a236a483da77dff36
compiler: Android (6032204 based on r370808) clang version 10.0.1 (https://android.googlesource.com/toolchain/llvm-project 6e765c10313d15c02ab29977a82938f66742c3a9)

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+664a23...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: use-after-free in __read_once_size include/linux/compiler.h:199 [inline]
BUG: KASAN: use-after-free in dev_get_by_index_rcu+0x60/0x140 net/core/dev.c:756
Read of size 8 at addr ffff8881a367f008 by task syz-executor.5/6471

CPU: 0 PID: 6471 Comm: syz-executor.5 Tainted: G W 5.4.26-syzkaller-00566-g7e72faf22da4 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x1b0/0x228 lib/dump_stack.c:118
print_address_description+0x96/0x5d0 mm/kasan/report.c:374
__kasan_report+0x14b/0x1c0 mm/kasan/report.c:506
kasan_report+0x26/0x50 mm/kasan/common.c:634
__asan_report_load8_noabort+0x14/0x20 mm/kasan/generic_report.c:132
__read_once_size include/linux/compiler.h:199 [inline]
dev_get_by_index_rcu+0x60/0x140 net/core/dev.c:756
packet_do_bind+0x12d/0xb10 net/packet/af_packet.c:3102
packet_bind+0x114/0x190 net/packet/af_packet.c:3207
__sys_bind+0x305/0x400 net/socket.c:1648
__do_sys_bind net/socket.c:1659 [inline]
__se_sys_bind net/socket.c:1657 [inline]
__x64_sys_bind+0x7a/0x90 net/socket.c:1657
do_syscall_64+0xc0/0x100 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x45c849
Code: ad b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 7b b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f1175c28c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000031
RAX: ffffffffffffffda RBX: 00007f1175c296d4 RCX: 000000000045c849
RDX: 0000000000000080 RSI: 0000000020000080 RDI: 0000000000000004
RBP: 000000000076bf00 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff
R13: 0000000000000029 R14: 00000000004c9ed8 R15: 000000000076bf0c

Allocated by task 9192:
save_stack mm/kasan/common.c:69 [inline]
set_track mm/kasan/common.c:77 [inline]
__kasan_kmalloc+0x117/0x1b0 mm/kasan/common.c:510
kasan_kmalloc+0x9/0x10 mm/kasan/common.c:524
kmem_cache_alloc_trace+0xe2/0x2f0 mm/slub.c:2785
kmalloc include/linux/slab.h:556 [inline]
kmalloc_array include/linux/slab.h:617 [inline]
netdev_create_hash net/core/dev.c:9908 [inline]
netdev_init+0x12f/0x220 net/core/dev.c:9929
ops_init+0x2ae/0x3a0 net/core/net_namespace.c:137
setup_net+0x21b/0xab0 net/core/net_namespace.c:335
copy_net_ns+0x2eb/0x4a0 net/core/net_namespace.c:476
create_new_namespaces+0x4fb/0x630 kernel/nsproxy.c:103
unshare_nsproxy_namespaces+0x125/0x190 kernel/nsproxy.c:202
ksys_unshare+0x52f/0xa40 kernel/fork.c:2873
__do_sys_unshare kernel/fork.c:2941 [inline]
__se_sys_unshare kernel/fork.c:2939 [inline]
__x64_sys_unshare+0x38/0x40 kernel/fork.c:2939
do_syscall_64+0xc0/0x100 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x44/0xa9

Freed by task 1960:
save_stack mm/kasan/common.c:69 [inline]
set_track mm/kasan/common.c:77 [inline]
kasan_set_free_info mm/kasan/common.c:332 [inline]
__kasan_slab_free+0x168/0x220 mm/kasan/common.c:471
kasan_slab_free+0xe/0x10 mm/kasan/common.c:480
slab_free_hook mm/slub.c:1424 [inline]
slab_free_freelist_hook mm/slub.c:1457 [inline]
slab_free mm/slub.c:3004 [inline]
kfree+0x170/0x6d0 mm/slub.c:3956
netdev_exit+0x65/0xb0 net/core/dev.c:10027
ops_exit_list net/core/net_namespace.c:172 [inline]
cleanup_net+0x704/0xd60 net/core/net_namespace.c:597
process_one_work+0x9d8/0x1030 kernel/workqueue.c:2274
worker_thread+0xbbc/0x1610 kernel/workqueue.c:2420
kthread+0x31a/0x340 kernel/kthread.c:255
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:352

The buggy address belongs to the object at ffff8881a367f000
which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 8 bytes inside of
2048-byte region [ffff8881a367f000, ffff8881a367f800)
The buggy address belongs to the page:
page:ffffea00068d9e00 refcount:1 mapcount:0 mapping:ffff8881da802800 index:0x0 compound_mapcount: 0
flags: 0x8000000000010200(slab|head)
raw: 8000000000010200 0000000000000000 0000000100000001 ffff8881da802800
raw: 0000000000000000 0000000000080008 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8881a367ef00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff8881a367ef80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8881a367f000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8881a367f080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8881a367f100: 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

unread,
Jul 18, 2020, 11:31:13 PM7/18/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