[Android 6.1] KASAN: use-after-free Read in process_one_work

0 views
Skip to first unread message

syzbot

unread,
May 21, 2023, 7:04:46 PM5/21/23
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: cffbdd825e02 ANDROID: ABI: Update oplus symbol list
git tree: android14-6.1
console output: https://syzkaller.appspot.com/x/log.txt?x=17ff377e280000
kernel config: https://syzkaller.appspot.com/x/.config?x=772a621c45fe488b
dashboard link: https://syzkaller.appspot.com/bug?extid=a652b345402bfb128209
compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=139a2e41280000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=106f7dd9280000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/ed6179c04124/disk-cffbdd82.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/ba554ef0cb8d/vmlinux-cffbdd82.xz
kernel image: https://storage.googleapis.com/syzbot-assets/514dd1219229/bzImage-cffbdd82.xz

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

==================================================================
BUG: KASAN: use-after-free in __list_del_entry_valid+0xa6/0x130 lib/list_debug.c:62
Read of size 8 at addr ffff888118ef0bc0 by task kworker/0:7/1215

CPU: 0 PID: 1215 Comm: kworker/0:7 Not tainted 6.1.25-syzkaller-00258-gcffbdd825e02 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/28/2023
Workqueue: events free_work
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x151/0x1b7 lib/dump_stack.c:106
print_address_description mm/kasan/report.c:284 [inline]
print_report+0x158/0x4e0 mm/kasan/report.c:395
kasan_report+0x13c/0x170 mm/kasan/report.c:495
__asan_report_load8_noabort+0x14/0x20 mm/kasan/report_generic.c:351
__list_del_entry_valid+0xa6/0x130 lib/list_debug.c:62
__list_del_entry include/linux/list.h:134 [inline]
list_del_init include/linux/list.h:206 [inline]
process_one_work+0x4d7/0xcb0 kernel/workqueue.c:2240
worker_thread+0xa5d/0x1260 kernel/workqueue.c:2443
kthread+0x26d/0x300 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306
</TASK>

Allocated by task 19:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
kasan_save_alloc_info+0x1f/0x30 mm/kasan/generic.c:505
____kasan_kmalloc mm/kasan/common.c:379 [inline]
__kasan_kmalloc+0x9c/0xb0 mm/kasan/common.c:388
kasan_kmalloc include/linux/kasan.h:212 [inline]
__do_kmalloc_node mm/slab_common.c:955 [inline]
__kmalloc_node+0xb4/0x1e0 mm/slab_common.c:962
kmalloc_node include/linux/slab.h:579 [inline]
kvmalloc_node+0x72/0x190 mm/util.c:586
kvmalloc include/linux/slab.h:706 [inline]
kvzalloc include/linux/slab.h:714 [inline]
alloc_netdev_mqs+0x8c/0xfa0 net/core/dev.c:10590
alloc_etherdev_mqs+0x36/0x40 net/ethernet/eth.c:394
usbnet_probe+0x1a0/0x25a0 drivers/net/usb/usbnet.c:1693
usb_probe_interface+0x5b0/0xa80 drivers/usb/core/driver.c:396
really_probe+0x2af/0x910 drivers/base/dd.c:639
__driver_probe_device+0x1b8/0x290 drivers/base/dd.c:778
driver_probe_device+0x54/0x3d0 drivers/base/dd.c:808
__device_attach_driver+0x2e3/0x490 drivers/base/dd.c:936
bus_for_each_drv+0x182/0x200 drivers/base/bus.c:427
__device_attach+0x309/0x500 drivers/base/dd.c:1008
device_initial_probe+0x1a/0x20 drivers/base/dd.c:1057
bus_probe_device+0xbb/0x1d0 drivers/base/bus.c:487
device_add+0xb51/0xef0 drivers/base/core.c:3664
usb_set_configuration+0x190c/0x1e70 drivers/usb/core/message.c:2170
usb_generic_driver_probe+0x8b/0x150 drivers/usb/core/generic.c:238
usb_probe_device+0x13e/0x260 drivers/usb/core/driver.c:293
really_probe+0x2af/0x910 drivers/base/dd.c:639
__driver_probe_device+0x1b8/0x290 drivers/base/dd.c:778
driver_probe_device+0x54/0x3d0 drivers/base/dd.c:808
__device_attach_driver+0x2e3/0x490 drivers/base/dd.c:936
bus_for_each_drv+0x182/0x200 drivers/base/bus.c:427
__device_attach+0x309/0x500 drivers/base/dd.c:1008
device_initial_probe+0x1a/0x20 drivers/base/dd.c:1057
bus_probe_device+0xbb/0x1d0 drivers/base/bus.c:487
device_add+0xb51/0xef0 drivers/base/core.c:3664
usb_new_device+0xf32/0x1810 drivers/usb/core/hub.c:2575
hub_port_connect drivers/usb/core/hub.c:5355 [inline]
hub_port_connect_change drivers/usb/core/hub.c:5499 [inline]
port_event drivers/usb/core/hub.c:5655 [inline]
hub_event+0x2f57/0x5240 drivers/usb/core/hub.c:5737
process_one_work+0x73d/0xcb0 kernel/workqueue.c:2296
process_scheduled_works kernel/workqueue.c:2359 [inline]
worker_thread+0xd6e/0x1260 kernel/workqueue.c:2445
kthread+0x26d/0x300 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306

Freed by task 19:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:516
____kasan_slab_free+0x131/0x180 mm/kasan/common.c:241
__kasan_slab_free+0x11/0x20 mm/kasan/common.c:249
kasan_slab_free include/linux/kasan.h:178 [inline]
slab_free_hook mm/slub.c:1744 [inline]
slab_free_freelist_hook mm/slub.c:1770 [inline]
slab_free mm/slub.c:3681 [inline]
__kmem_cache_free+0x218/0x3b0 mm/slub.c:3694
kfree+0x7a/0xf0 mm/slab_common.c:1007
kvfree+0x35/0x40 mm/util.c:632
netdev_freemem+0x3f/0x60 net/core/dev.c:10544
netdev_release+0x7f/0xb0 net/core/net-sysfs.c:1906
device_release+0x95/0x1c0
kobject_cleanup lib/kobject.c:681 [inline]
kobject_release lib/kobject.c:712 [inline]
kref_put include/linux/kref.h:65 [inline]
kobject_put+0x178/0x260 lib/kobject.c:729
put_device+0x1f/0x30 drivers/base/core.c:3772
free_netdev+0x397/0x480 net/core/dev.c:10737
usbnet_disconnect+0x245/0x390 drivers/net/usb/usbnet.c:1632
usb_unbind_interface+0x1f4/0x8b0 drivers/usb/core/driver.c:458
device_remove drivers/base/dd.c:550 [inline]
__device_release_driver drivers/base/dd.c:1253 [inline]
device_release_driver_internal+0x532/0x850 drivers/base/dd.c:1279
device_release_driver+0x19/0x20 drivers/base/dd.c:1302
bus_remove_device+0x2ea/0x350 drivers/base/bus.c:529
device_del+0x61a/0xe80 drivers/base/core.c:3852
usb_disable_device+0x380/0x720 drivers/usb/core/message.c:1419
usb_disconnect+0x32a/0x890 drivers/usb/core/hub.c:2238
hub_port_connect drivers/usb/core/hub.c:5199 [inline]
hub_port_connect_change drivers/usb/core/hub.c:5499 [inline]
port_event drivers/usb/core/hub.c:5655 [inline]
hub_event+0x1f93/0x5240 drivers/usb/core/hub.c:5737
process_one_work+0x73d/0xcb0 kernel/workqueue.c:2296
process_scheduled_works kernel/workqueue.c:2359 [inline]
worker_thread+0xd6e/0x1260 kernel/workqueue.c:2445
kthread+0x26d/0x300 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306

Last potentially related work creation:
kasan_save_stack+0x3b/0x60 mm/kasan/common.c:45
__kasan_record_aux_stack+0xb4/0xc0 mm/kasan/generic.c:486
kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:496
insert_work+0x56/0x310 kernel/workqueue.c:1365
__queue_work+0x9d0/0xd80 kernel/workqueue.c:1524
queue_work_on+0x105/0x170 kernel/workqueue.c:1552
usbnet_link_change+0xeb/0x100
usbnet_probe+0x1c02/0x25a0 drivers/net/usb/usbnet.c:1834
usb_probe_interface+0x5b0/0xa80 drivers/usb/core/driver.c:396
really_probe+0x2af/0x910 drivers/base/dd.c:639
__driver_probe_device+0x1b8/0x290 drivers/base/dd.c:778
driver_probe_device+0x54/0x3d0 drivers/base/dd.c:808
__device_attach_driver+0x2e3/0x490 drivers/base/dd.c:936
bus_for_each_drv+0x182/0x200 drivers/base/bus.c:427
__device_attach+0x309/0x500 drivers/base/dd.c:1008
device_initial_probe+0x1a/0x20 drivers/base/dd.c:1057
bus_probe_device+0xbb/0x1d0 drivers/base/bus.c:487
device_add+0xb51/0xef0 drivers/base/core.c:3664
usb_set_configuration+0x190c/0x1e70 drivers/usb/core/message.c:2170
usb_generic_driver_probe+0x8b/0x150 drivers/usb/core/generic.c:238
usb_probe_device+0x13e/0x260 drivers/usb/core/driver.c:293
really_probe+0x2af/0x910 drivers/base/dd.c:639
__driver_probe_device+0x1b8/0x290 drivers/base/dd.c:778
driver_probe_device+0x54/0x3d0 drivers/base/dd.c:808
__device_attach_driver+0x2e3/0x490 drivers/base/dd.c:936
bus_for_each_drv+0x182/0x200 drivers/base/bus.c:427
__device_attach+0x309/0x500 drivers/base/dd.c:1008
device_initial_probe+0x1a/0x20 drivers/base/dd.c:1057
bus_probe_device+0xbb/0x1d0 drivers/base/bus.c:487
device_add+0xb51/0xef0 drivers/base/core.c:3664
usb_new_device+0xf32/0x1810 drivers/usb/core/hub.c:2575
hub_port_connect drivers/usb/core/hub.c:5355 [inline]
hub_port_connect_change drivers/usb/core/hub.c:5499 [inline]
port_event drivers/usb/core/hub.c:5655 [inline]
hub_event+0x2f57/0x5240 drivers/usb/core/hub.c:5737
process_one_work+0x73d/0xcb0 kernel/workqueue.c:2296
process_scheduled_works kernel/workqueue.c:2359 [inline]
worker_thread+0xd6e/0x1260 kernel/workqueue.c:2445
kthread+0x26d/0x300 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306

The buggy address belongs to the object at ffff888118ef0000
which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 3008 bytes inside of
4096-byte region [ffff888118ef0000, ffff888118ef1000)

The buggy address belongs to the physical page:
page:ffffea000463bc00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x118ef0
head:ffffea000463bc00 order:3 compound_mapcount:0 compound_pincount:0
flags: 0x4000000000010200(slab|head|zone=1)
raw: 4000000000010200 0000000000000000 dead000000000001 ffff888100042140
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), pid 543, tgid 543 (udevd), ts 287076198389, free_ts 286719139845
set_page_owner include/linux/page_owner.h:33 [inline]
post_alloc_hook+0x213/0x220 mm/page_alloc.c:2569
prep_new_page mm/page_alloc.c:2576 [inline]
get_page_from_freelist+0x2411/0x24f0 mm/page_alloc.c:4368
__alloc_pages+0x3a1/0x780 mm/page_alloc.c:5633
allocate_slab mm/slub.c:1959 [inline]
new_slab+0xce/0x4c0 mm/slub.c:2012
___slab_alloc+0x6f9/0xb80 mm/slub.c:3200
__slab_alloc+0x5d/0xa0 mm/slub.c:3299
slab_alloc_node mm/slub.c:3384 [inline]
__kmem_cache_alloc_node+0x1af/0x250 mm/slub.c:3457
kmalloc_trace+0x2a/0xa0 mm/slab_common.c:1045
kmalloc include/linux/slab.h:553 [inline]
kzalloc include/linux/slab.h:689 [inline]
kernfs_iop_get_link+0x65/0x610 fs/kernfs/symlink.c:135
vfs_readlink+0x166/0x390 fs/namei.c:5026
do_readlinkat+0x27f/0x3a0 fs/stat.c:480
__do_sys_readlink fs/stat.c:501 [inline]
__se_sys_readlink fs/stat.c:498 [inline]
__x64_sys_readlink+0x7f/0x90 fs/stat.c:498
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
page last free stack trace:
reset_page_owner include/linux/page_owner.h:26 [inline]
free_pages_prepare mm/page_alloc.c:1481 [inline]
free_pcp_prepare mm/page_alloc.c:1555 [inline]
free_unref_page_prepare+0x83d/0x850 mm/page_alloc.c:3468
free_unref_page+0x8d/0x480 mm/page_alloc.c:3564
free_the_page mm/page_alloc.c:788 [inline]
__free_pages+0x61/0xf0 mm/page_alloc.c:5722
__free_slab+0xce/0x1a0 mm/slub.c:2036
free_slab mm/slub.c:2051 [inline]
discard_slab mm/slub.c:2057 [inline]
__unfreeze_partials+0x165/0x1a0 mm/slub.c:2606
put_cpu_partial+0xa9/0x100 mm/slub.c:2682
__slab_free+0x1c8/0x280 mm/slub.c:3558
do_slab_free mm/slub.c:3635 [inline]
___cache_free+0xc6/0xd0 mm/slub.c:3688
qlink_free+0x4d/0x90 mm/kasan/quarantine.c:168
qlist_free_all+0x52/0xc0 mm/kasan/quarantine.c:187
kasan_quarantine_reduce+0x15a/0x180 mm/kasan/quarantine.c:294
__kasan_slab_alloc+0x24/0x80 mm/kasan/common.c:310
kasan_slab_alloc include/linux/kasan.h:202 [inline]
slab_post_alloc_hook+0x53/0x2c0 mm/slab.h:768
slab_alloc_node mm/slub.c:3418 [inline]
__kmem_cache_alloc_node+0x191/0x250 mm/slub.c:3457
kmalloc_trace+0x2a/0xa0 mm/slab_common.c:1045
kmalloc include/linux/slab.h:553 [inline]
load_elf_binary+0x1ad4/0x26b0 fs/binfmt_elf.c:911

Memory state around the buggy address:
ffff888118ef0a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888118ef0b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888118ef0b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888118ef0c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888118ef0c80: 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.

If the bug is already fixed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to change bug's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the bug is a duplicate of another bug, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup
Reply all
Reply to author
Forward
0 new messages