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

7 views
Skip to first unread message

syzbot

unread,
Mar 17, 2022, 10:04:27 AM3/17/22
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: ffcfa2b78144 ANDROID: ABI: Update symbols to unisoc whitel..
git tree: android12-5.4
console output: https://syzkaller.appspot.com/x/log.txt?x=10881915700000
kernel config: https://syzkaller.appspot.com/x/.config?x=fd73375ff21e4f01
dashboard link: https://syzkaller.appspot.com/bug?extid=e4c98459d95773ca4fd2
compiler: Debian clang version 11.0.1-2, GNU ld (GNU Binutils for Debian) 2.35.2

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

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

==================================================================
BUG: KASAN: use-after-free in usb_udc_uevent+0xac/0x120 drivers/usb/gadget/udc/core.c:1600
Read of size 8 at addr ffff8881ee4e4010 by task udevd/1950

CPU: 0 PID: 1950 Comm: udevd Not tainted 5.4.161-syzkaller-00029-gffcfa2b78144 #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+0x18e/0x1de lib/dump_stack.c:118
print_address_description+0x9b/0x650 mm/kasan/report.c:384
__kasan_report+0x182/0x260 mm/kasan/report.c:516
kasan_report+0x30/0x60 mm/kasan/common.c:653
usb_udc_uevent+0xac/0x120 drivers/usb/gadget/udc/core.c:1600
dev_uevent+0x41c/0x5b0 drivers/base/core.c:1887
uevent_show+0x1a2/0x2e0 drivers/base/core.c:1943
dev_attr_show+0x50/0xc0 drivers/base/core.c:1647
sysfs_kf_seq_show+0x265/0x3e0 fs/sysfs/file.c:61
seq_read+0x4ca/0xda0 fs/seq_file.c:232
__vfs_read+0xa7/0x690 fs/read_write.c:425
vfs_read+0x161/0x370 fs/read_write.c:461
ksys_read+0x13f/0x240 fs/read_write.c:587
do_syscall_64+0xcb/0x1e0 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x7f8b7c1f18fe
Code: c0 e9 e6 fe ff ff 50 48 8d 3d 0e c7 09 00 e8 c9 cf 01 00 66 0f 1f 84 00 00 00 00 00 64 8b 04 25 18 00 00 00 85 c0 75 14 0f 05 <48> 3d 00 f0 ff ff 77 5a c3 66 0f 1f 84 00 00 00 00 00 48 83 ec 28
RSP: 002b:00007ffef50a4ab8 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
RAX: ffffffffffffffda RBX: 000055cea7d9e920 RCX: 00007f8b7c1f18fe
RDX: 0000000000001000 RSI: 000055cea7daf9f0 RDI: 0000000000000008
RBP: 00007f8b7c2be380 R08: 0000000000000008 R09: 00007f8b7c2c1a60
R10: 0000000000000063 R11: 0000000000000246 R12: 000055cea7d9e920
R13: 0000000000000d68 R14: 00007f8b7c2bd780 R15: 0000000000000d68

Allocated by task 22519:
save_stack mm/kasan/common.c:70 [inline]
set_track mm/kasan/common.c:78 [inline]
__kasan_kmalloc+0x137/0x1e0 mm/kasan/common.c:529
kmem_cache_alloc_trace+0x139/0x2b0 mm/slub.c:2856
kmalloc include/linux/slab.h:556 [inline]
kzalloc include/linux/slab.h:690 [inline]
dev_new drivers/usb/gadget/legacy/raw_gadget.c:182 [inline]
raw_open+0x84/0x370 drivers/usb/gadget/legacy/raw_gadget.c:372
misc_open+0x346/0x3c0 drivers/char/misc.c:141
chrdev_open+0x4ec/0x5b0 fs/char_dev.c:414
do_dentry_open+0x7e6/0xef0 fs/open.c:796
do_last fs/namei.c:3495 [inline]
path_openat+0xfed/0x3a50 fs/namei.c:3612
do_filp_open+0x19a/0x3a0 fs/namei.c:3642
do_sys_open+0x2e2/0x6d0 fs/open.c:1113
do_syscall_64+0xcb/0x1e0 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x44/0xa9

Freed by task 22518:
save_stack mm/kasan/common.c:70 [inline]
set_track mm/kasan/common.c:78 [inline]
kasan_set_free_info mm/kasan/common.c:345 [inline]
__kasan_slab_free+0x18a/0x240 mm/kasan/common.c:487
slab_free_hook mm/slub.c:1455 [inline]
slab_free_freelist_hook+0x80/0x150 mm/slub.c:1494
slab_free mm/slub.c:3080 [inline]
kfree+0xed/0x690 mm/slub.c:4071
raw_release+0x130/0x1e0 drivers/usb/gadget/legacy/raw_gadget.c:411
__fput+0x27d/0x6c0 fs/file_table.c:281
task_work_run+0x186/0x1b0 kernel/task_work.c:113
tracehook_notify_resume include/linux/tracehook.h:188 [inline]
exit_to_usermode_loop arch/x86/entry/common.c:163 [inline]
prepare_exit_to_usermode+0x2b0/0x310 arch/x86/entry/common.c:194
entry_SYSCALL_64_after_hwframe+0x44/0xa9

The buggy address belongs to the object at ffff8881ee4e4000
which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 16 bytes inside of
4096-byte region [ffff8881ee4e4000, ffff8881ee4e5000)
The buggy address belongs to the page:
page:ffffea0007b93800 refcount:1 mapcount:0 mapping:ffff8881f5c0c280 index:0x0 compound_mapcount: 0
flags: 0x8000000000010200(slab|head)
raw: 8000000000010200 dead000000000100 dead000000000122 ffff8881f5c0c280
raw: 0000000000000000 0000000000040004 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC)
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook mm/page_alloc.c:2165 [inline]
prep_new_page+0x19a/0x380 mm/page_alloc.c:2171
get_page_from_freelist+0x550/0x8b0 mm/page_alloc.c:3794
__alloc_pages_nodemask+0x2d6/0x740 mm/page_alloc.c:4855
alloc_slab_page+0x39/0x3e0 mm/slub.c:343
allocate_slab mm/slub.c:1683 [inline]
new_slab+0x97/0x460 mm/slub.c:1749
new_slab_objects mm/slub.c:2506 [inline]
___slab_alloc+0x330/0x4c0 mm/slub.c:2667
__slab_alloc mm/slub.c:2707 [inline]
slab_alloc_node mm/slub.c:2792 [inline]
slab_alloc mm/slub.c:2837 [inline]
__kmalloc+0x1ee/0x2f0 mm/slub.c:3909
__kmalloc_node include/linux/slab.h:422 [inline]
kmalloc_node include/linux/slab.h:599 [inline]
kvmalloc_node+0x7e/0xf0 mm/util.c:564
kvmalloc include/linux/mm.h:758 [inline]
kvmalloc_array include/linux/mm.h:776 [inline]
nf_ct_alloc_hashtable+0x8e/0x1c0 net/netfilter/nf_conntrack_core.c:2303
nf_conntrack_expect_init+0xaa/0x110 net/netfilter/nf_conntrack_expect.c:712
nf_conntrack_init_start+0x2c9/0x470 net/netfilter/nf_conntrack_core.c:2472
nf_conntrack_standalone_init+0xc/0xf6 net/netfilter/nf_conntrack_standalone.c:1173
do_one_initcall+0x175/0x5d0 init/main.c:1205
do_initcall_level+0x101/0x256 init/main.c:1272
do_initcalls+0x4b/0x8c init/main.c:1288
kernel_init_freeable+0x21a/0x381 init/main.c:1469
page_owner free stack trace missing

Memory state around the buggy address:
ffff8881ee4e3f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff8881ee4e3f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8881ee4e4000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8881ee4e4080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8881ee4e4100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


---
This report 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 issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

syzbot

unread,
Jul 31, 2022, 3:22:18 AM7/31/22
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