[Android 5.10] KASAN: use-after-free Write in steam_input_close

4 views
Skip to first unread message

syzbot

unread,
Oct 8, 2024, 4:27:28 PM10/8/24
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: e5e5644ea27f Revert "udf: Avoid excessive partition lengths"
git tree: android13-5.10-lts
console+strace: https://syzkaller.appspot.com/x/log.txt?x=174b1780580000
kernel config: https://syzkaller.appspot.com/x/.config?x=d3a5f406b765d0a
dashboard link: https://syzkaller.appspot.com/bug?extid=2669c17738f56c1b2203
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=13f47707980000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=14194f9f980000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/1a33e633442e/disk-e5e5644e.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/3ea75692c279/vmlinux-e5e5644e.xz
kernel image: https://storage.googleapis.com/syzbot-assets/a024dd784b97/bzImage-e5e5644e.xz

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

==================================================================
BUG: KASAN: use-after-free in instrument_atomic_read_write include/linux/instrumented.h:101 [inline]
BUG: KASAN: use-after-free in atomic64_try_cmpxchg_acquire include/asm-generic/atomic-instrumented.h:1515 [inline]
BUG: KASAN: use-after-free in atomic_long_try_cmpxchg_acquire include/asm-generic/atomic-long.h:443 [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:298
Write of size 8 at addr ffff88810d4d1840 by task acpid/79

CPU: 1 PID: 79 Comm: acpid Not tainted 5.10.226-syzkaller-00709-ge5e5644ea27f #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack_lvl+0x1e2/0x24b lib/dump_stack.c:118
print_address_description+0x81/0x3b0 mm/kasan/report.c:248
__kasan_report mm/kasan/report.c:435 [inline]
kasan_report+0x179/0x1c0 mm/kasan/report.c:452
kasan_check_range+0x293/0x2a0 mm/kasan/generic.c:189
__kasan_check_write+0x14/0x20 mm/kasan/shadow.c:37
instrument_atomic_read_write include/linux/instrumented.h:101 [inline]
atomic64_try_cmpxchg_acquire include/asm-generic/atomic-instrumented.h:1515 [inline]
atomic_long_try_cmpxchg_acquire include/asm-generic/atomic-long.h:443 [inline]
__mutex_trylock_fast kernel/locking/mutex.c:173 [inline]
mutex_lock+0x98/0x110 kernel/locking/mutex.c:298
steam_input_close+0x90/0x1e0 drivers/hid/hid-steam.c:308
input_close_device+0x269/0x300 drivers/input/input.c:694
evdev_close_device drivers/input/evdev.c:414 [inline]
evdev_release+0x7be/0x850 drivers/input/evdev.c:456
__fput+0x33d/0x7b0 fs/file_table.c:281
____fput+0x15/0x20 fs/file_table.c:314
task_work_run+0x129/0x190 kernel/task_work.c:189
tracehook_notify_resume include/linux/tracehook.h:188 [inline]
exit_to_user_mode_loop+0xbf/0xd0 kernel/entry/common.c:172
exit_to_user_mode_prepare kernel/entry/common.c:199 [inline]
syscall_exit_to_user_mode+0xa2/0x1a0 kernel/entry/common.c:274
do_syscall_64+0x40/0x70 arch/x86/entry/common.c:56
entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7fbe3cc910a8
Code: 48 8b 05 83 9d 0d 00 64 c7 00 16 00 00 00 83 c8 ff 48 83 c4 20 5b c3 64 8b 04 25 18 00 00 00 85 c0 75 20 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 76 5b 48 8b 15 51 9d 0d 00 f7 d8 64 89 02 48 83
RSP: 002b:00007ffe78fd8778 EFLAGS: 00000246 ORIG_RAX: 0000000000000003
RAX: 0000000000000000 RBX: 00007ffe78fd8ac8 RCX: 00007fbe3cc910a8
RDX: 0000000000000000 RSI: 000000000000001e RDI: 000000000000000a
RBP: 000000000000000a R08: 0000000000000008 R09: 00007ffe78fd88e8
R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffe78fd88e8
R13: 0000000000000100 R14: 00007ffe78fd89e8 R15: 00007ffe78fd88e8

Allocated by task 0:
(stack is not available)

Freed by task 308:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track+0x4b/0x70 mm/kasan/common.c:45
kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:370
____kasan_slab_free+0x121/0x160 mm/kasan/common.c:362
__kasan_slab_free+0x11/0x20 mm/kasan/common.c:370
kasan_slab_free include/linux/kasan.h:220 [inline]
slab_free_hook mm/slub.c:1595 [inline]
slab_free_freelist_hook+0xc0/0x190 mm/slub.c:1621
slab_free mm/slub.c:3203 [inline]
kfree+0xc3/0x270 mm/slub.c:4191
release_nodes+0x873/0x8f0 drivers/base/devres.c:524
devres_release_all+0x7b/0xa0 drivers/base/devres.c:545
__device_release_driver drivers/base/dd.c:1190 [inline]
device_release_driver_internal+0x515/0x7c0 drivers/base/dd.c:1221
device_release_driver+0x19/0x20 drivers/base/dd.c:1244
bus_remove_device+0x2f8/0x360 drivers/base/bus.c:533
device_del+0x68b/0xf00 drivers/base/core.c:3455
hid_remove_device drivers/hid/hid-core.c:2501 [inline]
hid_destroy_device+0x68/0x110 drivers/hid/hid-core.c:2520
usbhid_disconnect+0x9e/0xc0 drivers/hid/usbhid/hid-core.c:1445
usb_unbind_interface+0x1fa/0x8c0 drivers/usb/core/driver.c:459
device_release_driver_internal+0x506/0x7c0 drivers/base/dd.c:1221
device_release_driver+0x19/0x20 drivers/base/dd.c:1244
bus_remove_device+0x2f8/0x360 drivers/base/bus.c:533
device_del+0x68b/0xf00 drivers/base/core.c:3455
usb_disable_device+0x380/0x720 drivers/usb/core/message.c:1411
usb_disconnect+0x32a/0x890 drivers/usb/core/hub.c:2271
hub_port_connect drivers/usb/core/hub.c:5296 [inline]
hub_port_connect_change drivers/usb/core/hub.c:5597 [inline]
port_event drivers/usb/core/hub.c:5747 [inline]
hub_event+0x1e73/0x47c0 drivers/usb/core/hub.c:5829
process_one_work+0x6dc/0xbd0 kernel/workqueue.c:2301
process_scheduled_works kernel/workqueue.c:2363 [inline]
worker_thread+0xe18/0x1510 kernel/workqueue.c:2449
kthread+0x34b/0x3d0 kernel/kthread.c:313
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298

The buggy address belongs to the object at ffff88810d4d1800
which belongs to the cache kmalloc-512 of size 512
The buggy address is located 64 bytes inside of
512-byte region [ffff88810d4d1800, ffff88810d4d1a00)
The buggy address belongs to the page:
page:ffffea0004353400 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10d4d0
head:ffffea0004353400 order:2 compound_mapcount:0 compound_pincount:0
flags: 0x4000000000010200(slab|head)
raw: 4000000000010200 ffffea0004352d00 0000000400000004 ffff888100043080
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), pid 83, ts 3882288887, free_ts 0
set_page_owner include/linux/page_owner.h:35 [inline]
post_alloc_hook mm/page_alloc.c:2456 [inline]
prep_new_page+0x166/0x180 mm/page_alloc.c:2462
get_page_from_freelist+0x2d8c/0x2f30 mm/page_alloc.c:4254
__alloc_pages_nodemask+0x435/0xaf0 mm/page_alloc.c:5348
allocate_slab mm/slub.c:1808 [inline]
new_slab+0x80/0x400 mm/slub.c:1869
new_slab_objects mm/slub.c:2627 [inline]
___slab_alloc+0x302/0x4b0 mm/slub.c:2791
__slab_alloc+0x63/0xa0 mm/slub.c:2831
slab_alloc_node mm/slub.c:2913 [inline]
slab_alloc mm/slub.c:2955 [inline]
__kmalloc_track_caller+0x1f8/0x320 mm/slub.c:4536
__kmalloc_reserve net/core/skbuff.c:144 [inline]
__alloc_skb+0xbc/0x510 net/core/skbuff.c:212
alloc_skb include/linux/skbuff.h:1126 [inline]
alloc_skb_with_frags+0xa1/0x570 net/core/skbuff.c:5951
sock_alloc_send_pskb+0x915/0xa50 net/core/sock.c:2388
unix_dgram_sendmsg+0x700/0x1f90 net/unix/af_unix.c:1725
sock_sendmsg_nosec net/socket.c:652 [inline]
__sock_sendmsg net/socket.c:664 [inline]
__sys_sendto+0x545/0x700 net/socket.c:2006
__do_sys_sendto net/socket.c:2018 [inline]
__se_sys_sendto net/socket.c:2014 [inline]
__x64_sys_sendto+0xe5/0x100 net/socket.c:2014
do_syscall_64+0x34/0x70
entry_SYSCALL_64_after_hwframe+0x61/0xcb
page_owner free stack trace missing

Memory state around the buggy address:
ffff88810d4d1700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88810d4d1780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88810d4d1800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88810d4d1880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88810d4d1900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
hid 0003:28DE:1102.0010: No HID_FEATURE_REPORT submitted - nothing to read
hid 0003:28DE:1102.0010: No HID_FEATURE_REPORT submitted - nothing to read
hid 0003:28DE:1102.0010: 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