KASAN: use-after-free Write in smsc95xx_mdio_read

14 views
Skip to first unread message

syzbot

unread,
Jun 12, 2020, 3:15:13 AM6/12/20
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: a191332e ANDROID: GKI: ABI update after re-enabling CONFIG..
git tree: android-5.4
console output: https://syzkaller.appspot.com/x/log.txt?x=162c2eda100000
kernel config: https://syzkaller.appspot.com/x/.config?x=4ae8d7ed763ae940
dashboard link: https://syzkaller.appspot.com/bug?extid=29dc7d4ae19b703ff947
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+29dc7d...@syzkaller.appspotmail.com

smsc95xx 5-1:1.0 eth1 (unregistering): MII is busy in smsc95xx_mdio_read
==================================================================
BUG: KASAN: use-after-free in atomic64_cmpxchg include/asm-generic/atomic-instrumented.h:1463 [inline]
BUG: KASAN: use-after-free in atomic_long_cmpxchg_release include/asm-generic/atomic-long.h:424 [inline]
BUG: KASAN: use-after-free in __mutex_unlock_fast kernel/locking/mutex.c:181 [inline]
BUG: KASAN: use-after-free in mutex_unlock+0x19/0x40 kernel/locking/mutex.c:737
Write of size 8 at addr ffff88819bd26940 by task kworker/0:3/210

CPU: 0 PID: 210 Comm: kworker/0:3 Not tainted 5.4.46-syzkaller-00106-ga191332e9e93 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: events check_carrier
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x14a/0x1ce lib/dump_stack.c:118
print_address_description+0x93/0x620 mm/kasan/report.c:374
__kasan_report+0x16d/0x1e0 mm/kasan/report.c:506
kasan_report+0x34/0x60 mm/kasan/common.c:634
check_memory_region_inline mm/kasan/generic.c:181 [inline]
check_memory_region+0x2b5/0x2f0 mm/kasan/generic.c:191
atomic64_cmpxchg include/asm-generic/atomic-instrumented.h:1463 [inline]
atomic_long_cmpxchg_release include/asm-generic/atomic-long.h:424 [inline]
__mutex_unlock_fast kernel/locking/mutex.c:181 [inline]
mutex_unlock+0x19/0x40 kernel/locking/mutex.c:737
__smsc95xx_mdio_read drivers/net/usb/smsc95xx.c:217 [inline]
smsc95xx_mdio_read+0x583/0x870 drivers/net/usb/smsc95xx.c:278
check_carrier+0xd1/0x2e0 drivers/net/usb/smsc95xx.c:644
process_one_work+0x777/0xf90 kernel/workqueue.c:2274
worker_thread+0xa8f/0x1430 kernel/workqueue.c:2420
kthread+0x2df/0x300 kernel/kthread.c:255
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:352

Allocated by task 12:
save_stack mm/kasan/common.c:69 [inline]
set_track mm/kasan/common.c:77 [inline]
__kasan_kmalloc+0x12c/0x1c0 mm/kasan/common.c:510
__kmalloc+0xf7/0x2d0 mm/slub.c:3821
__kmalloc_node include/linux/slab.h:422 [inline]
kmalloc_node include/linux/slab.h:599 [inline]
kvmalloc_node+0xc2/0x120 mm/util.c:564
kvmalloc include/linux/mm.h:678 [inline]
kvzalloc include/linux/mm.h:686 [inline]
alloc_netdev_mqs+0x85/0xc60 net/core/dev.c:9498
usbnet_probe+0x1ae/0x2770 drivers/net/usb/usbnet.c:1686
usb_probe_interface+0x631/0xad0 drivers/usb/core/driver.c:361
really_probe+0x764/0xf70 drivers/base/dd.c:560
driver_probe_device+0xe6/0x230 drivers/base/dd.c:729
bus_for_each_drv+0x17a/0x200 drivers/base/bus.c:430
__device_attach+0x27b/0x420 drivers/base/dd.c:902
bus_probe_device+0xbb/0x200 drivers/base/bus.c:490
device_add+0x13db/0x17c0 drivers/base/core.c:2644
usb_set_configuration+0x197f/0x1f00 drivers/usb/core/message.c:2030
generic_probe+0x82/0x140 drivers/usb/core/generic.c:210
really_probe+0x764/0xf70 drivers/base/dd.c:560
driver_probe_device+0xe6/0x230 drivers/base/dd.c:729
bus_for_each_drv+0x17a/0x200 drivers/base/bus.c:430
__device_attach+0x27b/0x420 drivers/base/dd.c:902
bus_probe_device+0xbb/0x200 drivers/base/bus.c:490
device_add+0x13db/0x17c0 drivers/base/core.c:2644
usb_new_device+0xda7/0x1710 drivers/usb/core/hub.c:2554
hub_port_connect drivers/usb/core/hub.c:5123 [inline]
hub_port_connect_change drivers/usb/core/hub.c:5238 [inline]
port_event drivers/usb/core/hub.c:5384 [inline]
hub_event+0x2963/0x4fa0 drivers/usb/core/hub.c:5466
process_one_work+0x777/0xf90 kernel/workqueue.c:2274
worker_thread+0xa8f/0x1430 kernel/workqueue.c:2420
kthread+0x2df/0x300 kernel/kthread.c:255
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:352

Freed by task 2959:
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+0x181/0x230 mm/kasan/common.c:471
slab_free_hook mm/slub.c:1424 [inline]
slab_free_freelist_hook+0xd0/0x150 mm/slub.c:1457
slab_free mm/slub.c:3014 [inline]
kfree+0x12b/0x600 mm/slub.c:3975
device_release+0x70/0x1a0 drivers/base/core.c:1519
kobject_cleanup lib/kobject.c:693 [inline]
kobject_release lib/kobject.c:722 [inline]
kref_put include/linux/kref.h:65 [inline]
kobject_put+0x1a9/0x250 lib/kobject.c:739
usb_unbind_interface+0x1d8/0x850 drivers/usb/core/driver.c:423
__device_release_driver drivers/base/dd.c:1142 [inline]
device_release_driver_internal+0x515/0x7b0 drivers/base/dd.c:1173
bus_remove_device+0x2e7/0x350 drivers/base/bus.c:532
device_del+0x7bc/0x1200 drivers/base/core.c:2821
usb_disable_device+0x3fe/0xc90 drivers/usb/core/message.c:1244
usb_disconnect+0x341/0x880 drivers/usb/core/hub.c:2217
hub_port_connect drivers/usb/core/hub.c:4974 [inline]
hub_port_connect_change drivers/usb/core/hub.c:5238 [inline]
port_event drivers/usb/core/hub.c:5384 [inline]
hub_event+0x1c6c/0x4fa0 drivers/usb/core/hub.c:5466
process_one_work+0x777/0xf90 kernel/workqueue.c:2274
worker_thread+0xa8f/0x1430 kernel/workqueue.c:2420
kthread+0x2df/0x300 kernel/kthread.c:255
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:352
The buggy address belongs to the object at ffff88819bd26000
which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 2368 bytes inside of
4096-byte region [ffff88819bd26000, ffff88819bd27000)

Memory state around the buggy address:
ffff88819bd26800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88819bd26880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88819bd26900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88819bd26980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88819bd26a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
usb (unnamed net_device) (released): Failed to read MII_BMSR
smsc95xx 5-1:1.0 eth1: unregister 'smsc95xx' usb-dummy_hcd.4-1, smsc95xx USB 2.0 Ethernet
usb 5-1: Using ep0 maxpacket: 8
usb 5-1: config 1 interface 0 altsetting 0 bulk endpoint 0x3 has invalid maxpacket 564
usb 5-1: config 1 interface 0 altsetting 0 has 2 endpoint descriptors, different from the interface descriptor's value: 3
usb 5-1: New USB device found, idVendor=0424, idProduct=9e00, bcdDevice= 0.40
usb 5-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 5-1: Manufacturer: syz
usb 5-1: SerialNumber: syz
usb 5-1: bad CDC descriptors
smsc95xx v1.0.6
smsc95xx 5-1:1.0 (unnamed net_device) (uninitialized): Error reading E2P_CMD
smsc95xx 5-1:1.0 (unnamed net_device) (uninitialized): Failed to read reg index 0x00000114: -32
smsc95xx 5-1:1.0 (unnamed net_device) (uninitialized): Error reading MII_ACCESS
smsc95xx 5-1:1.0 (unnamed net_device) (uninitialized): MII is busy in smsc95xx_mdio_read
smsc95xx 5-1:1.0 eth1: register 'smsc95xx' at usb-dummy_hcd.4-1, smsc95xx USB 2.0 Ethernet, b6:78:93:f9:51:03
smsc95xx 5-1:1.0 eth1: unregister 'smsc95xx' usb-dummy_hcd.4-1, smsc95xx USB 2.0 Ethernet
usb 5-1: Using ep0 maxpacket: 8
usb 5-1: config 1 interface 0 altsetting 0 bulk endpoint 0x82 has invalid maxpacket 247
usb 5-1: config 1 interface 0 altsetting 0 bulk endpoint 0x3 has invalid maxpacket 564
usb 5-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 5-1: Product: syz
usb 5-1: Manufacturer: syz
usb 5-1: SerialNumber: syz
usb 5-1: bad CDC descriptors
smsc95xx v1.0.6


---
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,
Jun 12, 2020, 3:34:11 AM6/12/20
to syzkaller-a...@googlegroups.com
syzbot has found a reproducer for the following crash on:

HEAD commit: a191332e ANDROID: GKI: ABI update after re-enabling CONFIG..
git tree: android-5.4
console output: https://syzkaller.appspot.com/x/log.txt?x=117dd2ea100000
kernel config: https://syzkaller.appspot.com/x/.config?x=4ae8d7ed763ae940
dashboard link: https://syzkaller.appspot.com/bug?extid=29dc7d4ae19b703ff947
compiler: Android (6032204 based on r370808) clang version 10.0.1 (https://android.googlesource.com/toolchain/llvm-project 6e765c10313d15c02ab29977a82938f66742c3a9)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=16232cda100000

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

smsc95xx 6-1:1.0 eth6 (unregistering): MII is busy in smsc95xx_mdio_read
==================================================================
BUG: KASAN: use-after-free in atomic64_cmpxchg include/asm-generic/atomic-instrumented.h:1463 [inline]
BUG: KASAN: use-after-free in atomic_long_cmpxchg_release include/asm-generic/atomic-long.h:424 [inline]
BUG: KASAN: use-after-free in __mutex_unlock_fast kernel/locking/mutex.c:181 [inline]
BUG: KASAN: use-after-free in mutex_unlock+0x19/0x40 kernel/locking/mutex.c:737
Write of size 8 at addr ffff8881d4152940 by task kworker/0:2/216

CPU: 0 PID: 216 Comm: kworker/0:2 Not tainted 5.4.46-syzkaller-00106-ga191332e9e93 #0
Freed by task 175:
The buggy address belongs to the object at ffff8881d4152000
which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 2368 bytes inside of
4096-byte region [ffff8881d4152000, ffff8881d4153000)
The buggy address belongs to the page:
page:ffffea0007505400 refcount:1 mapcount:0 mapping:ffff8881da80c280 index:0x0 compound_mapcount: 0
flags: 0x8000000000010200(slab|head)
raw: 8000000000010200 ffffea0007506c00 0000000200000002 ffff8881da80c280
raw: 0000000000000000 0000000000040004 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8881d4152800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8881d4152880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8881d4152900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8881d4152980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8881d4152a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Reply all
Reply to author
Forward
0 new messages