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

8 views
Skip to first unread message

syzbot

unread,
Mar 14, 2023, 8:05:46 AM3/14/23
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 250ac66f1853 UPSTREAM: usb: gadget: f_fs: Ensure ep0req is..
git tree: android12-5.4
console output: https://syzkaller.appspot.com/x/log.txt?x=169a44dcc80000
kernel config: https://syzkaller.appspot.com/x/.config?x=e270749e5a0ba365
dashboard link: https://syzkaller.appspot.com/bug?extid=ca7ab3dc88cddf5fd925
compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/2b9474fb6a17/disk-250ac66f.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/825061f700a1/vmlinux-250ac66f.xz
kernel image: https://storage.googleapis.com/syzbot-assets/6e4040b78dde/bzImage-250ac66f.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+ca7ab3...@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 __down_read_trylock kernel/locking/rwsem.c:1408 [inline]
BUG: KASAN: use-after-free in down_read_trylock+0xba/0x1d0 kernel/locking/rwsem.c:1568
Write of size 8 at addr ffff8881aecce070 by task kworker/u4:3/363

CPU: 1 PID: 363 Comm: kworker/u4:3 Not tainted 5.4.225-syzkaller-00007-g250ac66f1853 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023
Workqueue: writeback wb_workfn (flush-7:2)
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]
__down_read_trylock kernel/locking/rwsem.c:1408 [inline]
down_read_trylock+0xba/0x1d0 kernel/locking/rwsem.c:1568
trylock_super+0x1b/0xf0 fs/super.c:418
__writeback_inodes_wb fs/fs-writeback.c:1792 [inline]
wb_writeback+0x499/0xd70 fs/fs-writeback.c:1907
wb_check_start_all fs/fs-writeback.c:2031 [inline]
wb_do_writeback fs/fs-writeback.c:2057 [inline]
wb_workfn+0x860/0x10c0 fs/fs-writeback.c:2091
process_one_work+0x765/0xd20 kernel/workqueue.c:2287
worker_thread+0xaef/0x1470 kernel/workqueue.c:2433
kthread+0x2da/0x360 kernel/kthread.c:288
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:354

Allocated by task 16788:
save_stack mm/kasan/common.c:70 [inline]
set_track mm/kasan/common.c:78 [inline]
__kasan_kmalloc+0x130/0x1d0 mm/kasan/common.c:529
kmalloc include/linux/slab.h:556 [inline]
kzalloc include/linux/slab.h:690 [inline]
alloc_super+0x56/0x760 fs/super.c:203
sget+0x1f1/0x4d0 fs/super.c:613
mount_bdev+0xe4/0x340 fs/super.c:1390
legacy_get_tree+0xdf/0x170 fs/fs_context.c:647
vfs_get_tree+0x85/0x260 fs/super.c:1547
do_new_mount+0x292/0x570 fs/namespace.c:2843
do_mount+0x688/0xdd0 fs/namespace.c:3163
ksys_mount+0xc2/0xf0 fs/namespace.c:3372
__do_sys_mount fs/namespace.c:3386 [inline]
__se_sys_mount fs/namespace.c:3383 [inline]
__x64_sys_mount+0xb1/0xc0 fs/namespace.c:3383
do_syscall_64+0xca/0x1c0 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x5c/0xc1

Freed by task 118:
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+0x178/0x230 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+0xeb/0x320 mm/slub.c:4071
process_one_work+0x765/0xd20 kernel/workqueue.c:2287
worker_thread+0xaef/0x1470 kernel/workqueue.c:2433
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 ffff8881aecce000
which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 112 bytes inside of
2048-byte region [ffff8881aecce000, ffff8881aecce800)
The buggy address belongs to the page:
page:ffffea0006bb3200 refcount:1 mapcount:0 mapping:ffff8881f5c0c000 index:0xffff8881aeccb000 compound_mapcount: 0
flags: 0x8000000000010200(slab|head)
raw: 8000000000010200 ffffea0007855208 ffffea0007ae3008 ffff8881f5c0c000
raw: ffff8881aeccb000 0000000000080006 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 0xd2a20(GFP_ATOMIC|__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+0x2ce8/0x2d70 mm/page_alloc.c:3794
__alloc_pages_nodemask+0x393/0x840 mm/page_alloc.c:4891
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+0x5a/0x90 mm/slub.c:2707
slab_alloc_node mm/slub.c:2792 [inline]
slab_alloc mm/slub.c:2837 [inline]
__kmalloc_track_caller+0x168/0x290 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:1079 [inline]
igmpv3_newpack+0x156/0x1030 net/ipv4/igmp.c:361
add_grhead+0x75/0x2c0 net/ipv4/igmp.c:442
add_grec+0x12c9/0x15d0 net/ipv4/igmp.c:576
igmpv3_send_cr net/ipv4/igmp.c:713 [inline]
igmp_ifc_timer_expire+0x7bc/0xea0 net/ipv4/igmp.c:811
call_timer_fn+0x36/0x390 kernel/time/timer.c:1418
expire_timers kernel/time/timer.c:1463 [inline]
__run_timers+0x7c2/0xae0 kernel/time/timer.c:1787
run_timer_softirq+0x46/0x80 kernel/time/timer.c:1800
page_owner free stack trace missing

Memory state around the buggy address:
ffff8881aeccdf00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff8881aeccdf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8881aecce000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8881aecce080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8881aecce100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
device bridge_slave_1 left promiscuous mode
bridge0: port 2(bridge_slave_1) entered disabled state
device bridge_slave_0 left promiscuous mode
bridge0: port 1(bridge_slave_0) entered disabled state


---
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,
Sep 19, 2023, 3:51:48 PM9/19/23
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