lkml.org 
[lkml]   [2021]   [Nov]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectBUG: KASAN: use-after-free in dec_rlimit_ucounts
Hi there, I can still reproduce this quickly on today's linux-next and all
the way back to 5.15-rc6 by running a syscall fuzzer for a while. The trace
points out to this line,

for (iter = ucounts; iter; iter = iter->ns->ucounts) {

It looks KASAN indicated that that "ns" had already been freed. Is that
possible or perhaps this is more of refcount issue?

BUG: KASAN: use-after-free in dec_rlimit_ucounts
Read of size 8 at addr ffff0008c0739860 by task trinity-c27/10924

CPU: 27 PID: 10924 Comm: trinity-c27 Not tainted 5.15.0-next-20211115-dirty #192
Hardware name: MiTAC RAPTOR EV-883832-X3-0001/RAPTOR, BIOS 1.6 06/28/2020
Call trace:
dump_backtrace
show_stack
dump_stack_lvl
print_address_description.constprop.0
kasan_report
__asan_report_load8_noabort
dec_rlimit_ucounts
dec_rlimit_ucounts at kernel/ucount.c:284
mqueue_evict_inode
mqueue_evict_inode at ipc/mqueue.c:544
evict
iput.part.0
iput
__arm64_sys_mq_unlink
invoke_syscall
el0_svc_common.constprop.0
do_el0_svc
el0_svc
el0t_64_sync_handler
el0t_64_sync

Allocated by task 10615:
kasan_save_stack
__kasan_slab_alloc
slab_post_alloc_hook
kmem_cache_alloc
create_user_ns
unshare_userns
ksys_unshare
__arm64_sys_unshare
invoke_syscall
el0_svc_common.constprop.0
do_el0_svc
el0_svc
el0t_64_sync_handler
el0t_64_sync

Freed by task 8660:
kasan_save_stack
kasan_set_track
kasan_set_free_info
__kasan_slab_free
slab_free_freelist_hook
kmem_cache_free
free_user_ns
process_one_work
worker_thread
kthread
ret_from_fork

Last potentially related work creation:
kasan_save_stack
__kasan_record_aux_stack
kasan_record_aux_stack_noalloc
insert_work
__queue_work
queue_work_on
__put_user_ns
put_cred_rcu
rcu_do_batch
rcu_core
rcu_core_si
__do_softirq

The buggy address belongs to the object at ffff0008c07395e8
which belongs to the cache user_namespace of size 768
The buggy address is located 632 bytes inside of
768-byte region [ffff0008c07395e8, ffff0008c07398e8)
The buggy address belongs to the page:
page:fffffc002301ce00 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff0008c073cec8 pfn:0x940738
head:fffffc002301ce00 order:3 compound_mapcount:0 compound_pincount:0
memcg:ffff0008b9b5f101
flags: 0xbfffc0000010200(slab|head|node=0|zone=2|lastcpupid=0xffff)
raw: 0bfffc0000010200 ffff000800f3e9c8 ffff000800f3e9c8 ffff000802e69b80
raw: ffff0008c073cec8 00000000001d0012 00000001ffffffff ffff0008b9b5f101
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff0008c0739700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff0008c0739780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff0008c0739800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff0008c0739880: fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc
ffff0008c0739900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc

\
 
 \ /
  Last update: 2021-11-17 23:02    [W:0.189 / U:9.628 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site