KASAN: use-after-free Read in dec_rlimit_ucounts

8 views
Skip to first unread message

syzbot

unread,
Nov 14, 2021, 6:28:28 PM11/14/21
to syzkaller-upst...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 73e5c18006f5 Add linux-next specific files for 20211110
git tree: linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=14ebbafab00000
kernel config: https://syzkaller.appspot.com/x/.config?x=ba9c83199208e103
dashboard link: https://syzkaller.appspot.com/bug?extid=3d8df6bbc77b00ffb512
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
CC: [ebie...@xmission.com leg...@kernel.org linux-...@vger.kernel.org]

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

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

==================================================================
BUG: KASAN: use-after-free in dec_rlimit_ucounts+0x127/0x130 kernel/ucount.c:284
Read of size 8 at addr ffff88807f940608 by task kworker/0:3/7915

CPU: 0 PID: 7915 Comm: kworker/0:3 Not tainted 5.15.0-next-20211110-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: events free_ipc
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
print_address_description.constprop.0.cold+0x8d/0x320 mm/kasan/report.c:247
__kasan_report mm/kasan/report.c:433 [inline]
kasan_report.cold+0x83/0xdf mm/kasan/report.c:450
dec_rlimit_ucounts+0x127/0x130 kernel/ucount.c:284
mqueue_evict_inode+0x7f0/0xc90 ipc/mqueue.c:537
evict+0x2ed/0x6b0 fs/inode.c:592
iput_final fs/inode.c:1672 [inline]
iput.part.0+0x539/0x850 fs/inode.c:1698
iput+0x58/0x70 fs/inode.c:1688
dentry_unlink_inode+0x2b1/0x460 fs/dcache.c:376
__dentry_kill+0x3c0/0x640 fs/dcache.c:582
shrink_dentry_list+0x128/0x490 fs/dcache.c:1176
shrink_dcache_parent+0x1fe/0x3c0 fs/dcache.c:1603
do_one_tree fs/dcache.c:1657 [inline]
shrink_dcache_for_umount+0x71/0x330 fs/dcache.c:1674
generic_shutdown_super+0x68/0x400 fs/super.c:447
kill_anon_super fs/super.c:1059 [inline]
kill_litter_super+0x6e/0xa0 fs/super.c:1068
deactivate_locked_super+0x94/0x160 fs/super.c:335
deactivate_super+0xad/0xd0 fs/super.c:366
cleanup_mnt+0x3a2/0x540 fs/namespace.c:1137
mntput_no_expire+0x908/0xcd0 fs/namespace.c:1223
mntput fs/namespace.c:1233 [inline]
kern_unmount fs/namespace.c:4369 [inline]
kern_unmount+0xb5/0xe0 fs/namespace.c:4363
free_ipc_ns ipc/namespace.c:123 [inline]
free_ipc+0xf0/0x200 ipc/namespace.c:141
process_one_work+0x9b2/0x1690 kernel/workqueue.c:2298
worker_thread+0x658/0x11f0 kernel/workqueue.c:2445
kthread+0x405/0x4f0 kernel/kthread.c:327
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
</TASK>

Allocated by task 31632:
kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38
kasan_set_track mm/kasan/common.c:46 [inline]
set_alloc_info mm/kasan/common.c:434 [inline]
__kasan_slab_alloc+0x90/0xc0 mm/kasan/common.c:467
kasan_slab_alloc include/linux/kasan.h:259 [inline]
slab_post_alloc_hook mm/slab.h:519 [inline]
slab_alloc_node mm/slub.c:3234 [inline]
slab_alloc mm/slub.c:3242 [inline]
kmem_cache_alloc+0x202/0x3a0 mm/slub.c:3247
kmem_cache_zalloc include/linux/slab.h:714 [inline]
create_user_ns+0x1ac/0xdd0 kernel/user_namespace.c:105
copy_creds+0x6f0/0xb60 kernel/cred.c:370
copy_process+0x1443/0x75a0 kernel/fork.c:2114
kernel_clone+0xe7/0xab0 kernel/fork.c:2633
__do_sys_clone+0xc8/0x110 kernel/fork.c:2750
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x44/0xae

Last potentially related work creation:
kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38
__kasan_record_aux_stack+0xf5/0x120 mm/kasan/generic.c:348
insert_work+0x48/0x370 kernel/workqueue.c:1354
__queue_work+0x5ca/0xf30 kernel/workqueue.c:1520
queue_work_on+0xee/0x110 kernel/workqueue.c:1547
put_user_ns include/linux/user_namespace.h:156 [inline]
put_cred_rcu+0x35e/0x520 kernel/cred.c:125
rcu_do_batch kernel/rcu/tree.c:2506 [inline]
rcu_core+0x7ab/0x1470 kernel/rcu/tree.c:2741
__do_softirq+0x29b/0x9c2 kernel/softirq.c:558

The buggy address belongs to the object at ffff88807f940388
which belongs to the cache user_namespace of size 776
The buggy address is located 640 bytes inside of
776-byte region [ffff88807f940388, ffff88807f940690)
The buggy address belongs to the page:
page:ffffea0001fe5000 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7f940
head:ffffea0001fe5000 order:2 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 0000000000000000 dead000000000122 ffff8880155c8280
raw: 0000000000000000 0000000080120012 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 9163, ts 190898874041, free_ts 190898491377
prep_new_page mm/page_alloc.c:2418 [inline]
get_page_from_freelist+0xa72/0x2f50 mm/page_alloc.c:4149
__alloc_pages+0x1b2/0x500 mm/page_alloc.c:5369
alloc_pages+0x1a7/0x300 mm/mempolicy.c:2191
alloc_slab_page mm/slub.c:1793 [inline]
allocate_slab mm/slub.c:1930 [inline]
new_slab+0x32d/0x4a0 mm/slub.c:1993
___slab_alloc+0x918/0xfe0 mm/slub.c:3022
__slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3109
slab_alloc_node mm/slub.c:3200 [inline]
slab_alloc mm/slub.c:3242 [inline]
kmem_cache_alloc+0x35c/0x3a0 mm/slub.c:3247
kmem_cache_zalloc include/linux/slab.h:714 [inline]
create_user_ns+0x1ac/0xdd0 kernel/user_namespace.c:105
copy_creds+0x6f0/0xb60 kernel/cred.c:370
copy_process+0x1443/0x75a0 kernel/fork.c:2114
kernel_clone+0xe7/0xab0 kernel/fork.c:2633
__do_sys_clone+0xc8/0x110 kernel/fork.c:2750
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x44/0xae
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1338 [inline]
free_pcp_prepare+0x374/0x870 mm/page_alloc.c:1389
free_unref_page_prepare mm/page_alloc.c:3309 [inline]
free_unref_page+0x19/0x690 mm/page_alloc.c:3388
qlink_free mm/kasan/quarantine.c:146 [inline]
qlist_free_all+0x5a/0xc0 mm/kasan/quarantine.c:165
kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:272
__kasan_slab_alloc+0xa2/0xc0 mm/kasan/common.c:444
kasan_slab_alloc include/linux/kasan.h:259 [inline]
slab_post_alloc_hook mm/slab.h:519 [inline]
slab_alloc_node mm/slub.c:3234 [inline]
kmem_cache_alloc_node+0x255/0x3f0 mm/slub.c:3270
alloc_task_struct_node kernel/fork.c:170 [inline]
dup_task_struct kernel/fork.c:933 [inline]
copy_process+0x5c4/0x75a0 kernel/fork.c:2074
kernel_clone+0xe7/0xab0 kernel/fork.c:2633
__do_sys_clone+0xc8/0x110 kernel/fork.c:2750
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x44/0xae

Memory state around the buggy address:
ffff88807f940500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88807f940580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88807f940600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88807f940680: fb fb fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88807f940700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================


---
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,
Apr 8, 2022, 9:56:25 PM4/8/22
to syzkaller-upst...@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