[Android 5.4] KASAN: use-after-free Write in steam_input_open

2 views
Skip to first unread message

syzbot

unread,
Feb 24, 2025, 6:20:22 AM2/24/25
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 6b07fcd94a6a Merge tag 'android12-5.4.290_r00' into androi..
git tree: android12-5.4
console+strace: https://syzkaller.appspot.com/x/log.txt?x=15a60c98580000
kernel config: https://syzkaller.appspot.com/x/.config?x=55297da5fb1e8eb8
dashboard link: https://syzkaller.appspot.com/bug?extid=7ef0477c08c2091b13fa
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=13a1a7a4580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=13a60c98580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/24df6995dc4e/disk-6b07fcd9.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/9e3b4e1aaa60/vmlinux-6b07fcd9.xz
kernel image: https://storage.googleapis.com/syzbot-assets/26f34b81fa98/bzImage-6b07fcd9.xz

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

==================================================================
BUG: KASAN: use-after-free in atomic64_try_cmpxchg include/asm-generic/atomic-instrumented.h:1503 [inline]
BUG: KASAN: use-after-free in atomic_long_try_cmpxchg_acquire include/asm-generic/atomic-long.h:442 [inline]
BUG: KASAN: use-after-free in __mutex_trylock_fast kernel/locking/mutex.c:173 [inline]
BUG: KASAN: use-after-free in mutex_lock+0x98/0x110 kernel/locking/mutex.c:295
Write of size 8 at addr ffff8881ea214440 by task udevd/369

CPU: 0 PID: 369 Comm: udevd Not tainted 5.4.290-syzkaller-00017-g6b07fcd94a6a #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/27/2024
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x1d8/0x241 lib/dump_stack.c:118
print_address_description+0x8c/0x600 mm/kasan/report.c:384
__kasan_report+0xf3/0x120 mm/kasan/report.c:516
kasan_report+0x30/0x60 mm/kasan/common.c:653
check_memory_region_inline mm/kasan/generic.c:141 [inline]
check_memory_region+0x272/0x280 mm/kasan/generic.c:191
atomic64_try_cmpxchg include/asm-generic/atomic-instrumented.h:1503 [inline]
atomic_long_try_cmpxchg_acquire include/asm-generic/atomic-long.h:442 [inline]
__mutex_trylock_fast kernel/locking/mutex.c:173 [inline]
mutex_lock+0x98/0x110 kernel/locking/mutex.c:295
steam_input_open+0x91/0x1a0 drivers/hid/hid-steam.c:297
input_open_device+0x145/0x280 drivers/input/input.c:635
evdev_open_device drivers/input/evdev.c:400 [inline]
evdev_open+0x396/0x590 drivers/input/evdev.c:486
chrdev_open+0x54a/0x630 fs/char_dev.c:414
do_dentry_open+0x964/0x1130 fs/open.c:806
do_last fs/namei.c:3565 [inline]
path_openat+0x29bf/0x34b0 fs/namei.c:3683
do_filp_open+0x20b/0x450 fs/namei.c:3713
do_sys_open+0x39c/0x810 fs/open.c:1123
do_syscall_64+0xca/0x1c0 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x5c/0xc1
RIP: 0033:0x7f93d8a259a4
Code: 24 20 48 8d 44 24 30 48 89 44 24 28 64 8b 04 25 18 00 00 00 85 c0 75 2c 44 89 e2 48 89 ee bf 9c ff ff ff b8 01 01 00 00 0f 05 <48> 3d 00 f0 ff ff 76 60 48 8b 15 55 a4 0d 00 f7 d8 64 89 02 48 83
RSP: 002b:00007ffd04d3c9c0 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f93d8a259a4
RDX: 0000000000080000 RSI: 0000559420096630 RDI: 00000000ffffff9c
RBP: 0000559420096630 R08: 00005594200c14e8 R09: 00007f93d8b00b10
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000080000
R13: 00007ffd04d3cb88 R14: 0000000000000000 R15: 0000559414657ed5

Allocated by task 372:
save_stack mm/kasan/common.c:70 [inline]
set_track mm/kasan/common.c:78 [inline]
__kasan_kmalloc+0x171/0x210 mm/kasan/common.c:529
slab_post_alloc_hook mm/slab.h:584 [inline]
slab_alloc_node mm/slub.c:2829 [inline]
slab_alloc mm/slub.c:2837 [inline]
__kmalloc_track_caller+0x100/0x2b0 mm/slub.c:4449
alloc_dr drivers/base/devres.c:103 [inline]
devm_kmalloc+0x34/0x1d0 drivers/base/devres.c:816
devm_kzalloc include/linux/device.h:953 [inline]
steam_probe+0x11a/0xa70 drivers/hid/hid-steam.c:741
hid_device_probe+0x2ac/0x3b0 drivers/hid/hid-core.c:2294
really_probe+0x496/0xb80 drivers/base/dd.c:567
driver_probe_device+0xe5/0x240 drivers/base/dd.c:752
bus_for_each_drv+0x183/0x200 drivers/base/bus.c:432
__device_attach+0x31c/0x490 drivers/base/dd.c:933
bus_probe_device+0xbd/0x1e0 drivers/base/bus.c:492
device_add+0x88d/0xbb0 drivers/base/core.c:2911
hid_add_device+0x37f/0x4c0 drivers/hid/hid-core.c:2446
usbhid_probe+0xafd/0xea0 drivers/hid/usbhid/hid-core.c:1418
usb_probe_interface+0x5aa/0xa90 drivers/usb/core/driver.c:361
really_probe+0x4dd/0xb80 drivers/base/dd.c:571
driver_probe_device+0xe5/0x240 drivers/base/dd.c:752
bus_for_each_drv+0x183/0x200 drivers/base/bus.c:432
__device_attach+0x31c/0x490 drivers/base/dd.c:933
bus_probe_device+0xbd/0x1e0 drivers/base/bus.c:492
device_add+0x88d/0xbb0 drivers/base/core.c:2911
usb_set_configuration+0x18ce/0x1e30 drivers/usb/core/message.c:2029
generic_probe+0x84/0x140 drivers/usb/core/generic.c:210
really_probe+0x4dd/0xb80 drivers/base/dd.c:571
driver_probe_device+0xe5/0x240 drivers/base/dd.c:752
bus_for_each_drv+0x183/0x200 drivers/base/bus.c:432
__device_attach+0x31c/0x490 drivers/base/dd.c:933
bus_probe_device+0xbd/0x1e0 drivers/base/bus.c:492
device_add+0x88d/0xbb0 drivers/base/core.c:2911
usb_new_device+0xbbc/0x1760 drivers/usb/core/hub.c:2581
hub_port_connect drivers/usb/core/hub.c:5214 [inline]
hub_port_connect_change drivers/usb/core/hub.c:5333 [inline]
port_event drivers/usb/core/hub.c:5479 [inline]
hub_event+0x2c62/0x4d50 drivers/usb/core/hub.c:5561
process_one_work+0x765/0xd20 kernel/workqueue.c:2290
process_scheduled_works kernel/workqueue.c:2352 [inline]
worker_thread+0xe02/0x1470 kernel/workqueue.c:2438
kthread+0x2da/0x360 kernel/kthread.c:288
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:354

Freed by task 372:
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+0x1b5/0x270 mm/kasan/common.c:487
slab_free_hook mm/slub.c:1455 [inline]
slab_free_freelist_hook mm/slub.c:1494 [inline]
slab_free mm/slub.c:3080 [inline]
kfree+0x123/0x370 mm/slub.c:4071
release_nodes+0x85a/0x8e0 drivers/base/devres.c:508
__device_release_driver drivers/base/dd.c:1191 [inline]
device_release_driver_internal+0x519/0x7b0 drivers/base/dd.c:1220
bus_remove_device+0x2ca/0x340 drivers/base/bus.c:534
device_del+0x65a/0xfa0 drivers/base/core.c:3088
hid_remove_device drivers/hid/hid-core.c:2494 [inline]
hid_destroy_device+0x64/0x100 drivers/hid/hid-core.c:2513
usbhid_disconnect+0x9a/0xc0 drivers/hid/usbhid/hid-core.c:1445
usb_unbind_interface+0x1d0/0x840 drivers/usb/core/driver.c:423
__device_release_driver drivers/base/dd.c:1188 [inline]
device_release_driver_internal+0x50a/0x7b0 drivers/base/dd.c:1220
bus_remove_device+0x2ca/0x340 drivers/base/bus.c:534
device_del+0x65a/0xfa0 drivers/base/core.c:3088
usb_disable_device+0x38c/0x750 drivers/usb/core/message.c:1277
usb_disconnect+0x32c/0x890 drivers/usb/core/hub.c:2237
hub_port_connect drivers/usb/core/hub.c:5057 [inline]
hub_port_connect_change drivers/usb/core/hub.c:5333 [inline]
port_event drivers/usb/core/hub.c:5479 [inline]
hub_event+0x1c75/0x4d50 drivers/usb/core/hub.c:5561
process_one_work+0x765/0xd20 kernel/workqueue.c:2290
process_scheduled_works kernel/workqueue.c:2352 [inline]
worker_thread+0xe02/0x1470 kernel/workqueue.c:2438
kthread+0x2da/0x360 kernel/kthread.c:288
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:354

The buggy address belongs to the object at ffff8881ea214400
which belongs to the cache kmalloc-512 of size 512
The buggy address is located 64 bytes inside of
512-byte region [ffff8881ea214400, ffff8881ea214600)
The buggy address belongs to the page:
page:ffffea0007a88500 refcount:1 mapcount:0 mapping:ffff8881f5c02500 index:0x0 compound_mapcount: 0
flags: 0x8000000000010200(slab|head)
raw: 8000000000010200 ffffea0007a94400 0000000200000002 ffff8881f5c02500
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 2, 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+0x18f/0x370 mm/page_alloc.c:2171
get_page_from_freelist+0x2d13/0x2d90 mm/page_alloc.c:3794
__alloc_pages_nodemask+0x393/0x840 mm/page_alloc.c:4893
alloc_slab_page+0x39/0x3c0 mm/slub.c:343
allocate_slab mm/slub.c:1683 [inline]
new_slab+0x97/0x440 mm/slub.c:1749
new_slab_objects mm/slub.c:2505 [inline]
___slab_alloc+0x2fe/0x490 mm/slub.c:2667
__slab_alloc+0x62/0xa0 mm/slub.c:2707
slab_alloc_node mm/slub.c:2792 [inline]
slab_alloc mm/slub.c:2837 [inline]
__kmalloc_track_caller+0x16d/0x2b0 mm/slub.c:4449
__kmalloc_reserve net/core/skbuff.c:142 [inline]
__alloc_skb+0xb4/0x4d0 net/core/skbuff.c:210
alloc_skb include/linux/skbuff.h:1080 [inline]
alloc_skb_with_frags+0x92/0x550 net/core/skbuff.c:5881
sock_alloc_send_pskb+0x831/0x950 net/core/sock.c:2276
unix_dgram_sendmsg+0x6fa/0x1ff0 net/unix/af_unix.c:1698
sock_sendmsg_nosec net/socket.c:638 [inline]
__sock_sendmsg net/socket.c:650 [inline]
sock_write_iter+0x344/0x470 net/socket.c:1009
call_write_iter include/linux/fs.h:1991 [inline]
new_sync_write fs/read_write.c:483 [inline]
__vfs_write+0x5d3/0x750 fs/read_write.c:496
vfs_write+0x206/0x4e0 fs/read_write.c:558
ksys_write+0x199/0x2c0 fs/read_write.c:611
page_owner free stack trace missing

Memory state around the buggy address:
ffff8881ea214300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff8881ea214380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8881ea214400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8881ea214480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8881ea214500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
hid 0003:28DE:1102.0043: No HID_FEATURE_REPORT submitted - nothing to read
hid 0003:28DE:1102.0043: No HID_FEATURE_REPORT submitted - nothing to read
hid 0003:28DE:1102.0043: No HID_FEATURE_REPORT submitted - nothing to read
hid 0003:28DE:1102.0043: No HID_FEATURE_REPORT submitted - nothing to read
hid 0003:28DE:1102.0043: No HID_FEATURE_REPORT submitted - nothing to read
hid 0003:28DE:1102.0043: No HID_FEATURE_REPORT submitted - nothing to read
hid 0003:28DE:1102.0043: No HID_FEATURE_REPORT submitted - nothing to read
hid 0003:28DE:1102.0043: No HID_FEATURE_REPORT submitted - nothing to read
hid 0003:28DE:1102.0043: No HID_FEATURE_REPORT submitted - nothing to read
hid 0003:28DE:1102.0043: No HID_FEATURE_REPORT submitted - nothing to read
hid 0003:28DE:1102.0043: No HID_FEATURE_REPORT submitted - nothing to read
hid 0003:28DE:1102.0043: No HID_FEATURE_REPORT submitted - nothing to read
hid 0003:28DE:1102.0043: No HID_FEATURE_REPORT submitted - nothing to read
hid 0003:28DE:1102.0043: No HID_FEATURE_REPORT submitted - nothing to read
hid 0003:28DE:1102.0043: No HID_FEATURE_REPORT submitted - nothing to read


---
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 report is already addressed, 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 overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, 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