KASAN: use-after-free Write in rdma_restrack_del

6 views
Skip to first unread message

syzbot

unread,
Sep 23, 2019, 5:06:09 PM9/23/19
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: d573e8a7 Linux 4.19.75
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=13711f45600000
kernel config: https://syzkaller.appspot.com/x/.config?x=50b385e67c7b7cdf
dashboard link: https://syzkaller.appspot.com/bug?extid=e94bcbf30e5a4fc6f6a7
compiler: gcc (GCC) 9.0.0 20181231 (experimental)

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

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

==================================================================
BUG: KASAN: use-after-free in atomic_dec_and_test
include/asm-generic/atomic-instrumented.h:259 [inline]
BUG: KASAN: use-after-free in put_task_struct include/linux/sched/task.h:95
[inline]
BUG: KASAN: use-after-free in rdma_restrack_del+0x86/0x240
drivers/infiniband/core/restrack.c:229
Write of size 4 at addr ffff888092988560 by task syz-executor.1/31503

CPU: 0 PID: 31503 Comm: syz-executor.1 Not tainted 4.19.75 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x172/0x1f0 lib/dump_stack.c:113
print_address_description.cold+0x7c/0x20d mm/kasan/report.c:256
kasan_report_error mm/kasan/report.c:354 [inline]
kasan_report mm/kasan/report.c:412 [inline]
kasan_report.cold+0x8c/0x2ba mm/kasan/report.c:396
check_memory_region_inline mm/kasan/kasan.c:260 [inline]
check_memory_region+0x123/0x190 mm/kasan/kasan.c:267
kasan_check_write+0x14/0x20 mm/kasan/kasan.c:278
atomic_dec_and_test include/asm-generic/atomic-instrumented.h:259 [inline]
put_task_struct include/linux/sched/task.h:95 [inline]
rdma_restrack_del+0x86/0x240 drivers/infiniband/core/restrack.c:229
rdma_destroy_id+0xac/0xab0 drivers/infiniband/core/cma.c:1726
ucma_close+0x115/0x320 drivers/infiniband/core/ucma.c:1770
__fput+0x2dd/0x8b0 fs/file_table.c:278
____fput+0x16/0x20 fs/file_table.c:309
task_work_run+0x145/0x1c0 kernel/task_work.c:113
exit_task_work include/linux/task_work.h:22 [inline]
do_exit+0x994/0x2fa0 kernel/exit.c:876
do_group_exit+0x135/0x370 kernel/exit.c:979
__do_sys_exit_group kernel/exit.c:990 [inline]
__se_sys_exit_group kernel/exit.c:988 [inline]
__x64_sys_exit_group+0x44/0x50 kernel/exit.c:988
do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x459a09
Code: Bad RIP value.
RSP: 002b:00007fffac4e9a28 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 000000000000000b RCX: 0000000000459a09
RDX: 0000000000413631 RSI: 0000000000a74ef0 RDI: 0000000000000000
RBP: 00000000004bf0ed R08: 000000000000000c R09: 00007fffac4e9b30
R10: 00005555556ac940 R11: 0000000000000246 R12: 000000000075bfc8
R13: 0000000000000003 R14: 0000000000000001 R15: 000000000075bfd4

Allocated by task 31503:
save_stack+0x45/0xd0 mm/kasan/kasan.c:448
set_track mm/kasan/kasan.c:460 [inline]
kasan_kmalloc mm/kasan/kasan.c:553 [inline]
kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:531
kasan_slab_alloc+0xf/0x20 mm/kasan/kasan.c:490
kmem_cache_alloc_node+0x144/0x710 mm/slab.c:3649
alloc_task_struct_node kernel/fork.c:157 [inline]
dup_task_struct kernel/fork.c:802 [inline]
copy_process.part.0+0x1ce0/0x7a30 kernel/fork.c:1732
copy_process kernel/fork.c:1689 [inline]
_do_fork+0x257/0xfd0 kernel/fork.c:2202
__do_sys_clone kernel/fork.c:2309 [inline]
__se_sys_clone kernel/fork.c:2303 [inline]
__x64_sys_clone+0xbf/0x150 kernel/fork.c:2303
do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 184:
save_stack+0x45/0xd0 mm/kasan/kasan.c:448
set_track mm/kasan/kasan.c:460 [inline]
__kasan_slab_free+0x102/0x150 mm/kasan/kasan.c:521
kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
kobject: 'queues' (0000000015640ed6): kobject_uevent_env: filter function
caused the event to drop!
__cache_free mm/slab.c:3503 [inline]
kmem_cache_free+0x86/0x260 mm/slab.c:3765
free_task_struct kernel/fork.c:162 [inline]
free_task+0xdd/0x120 kernel/fork.c:416
__put_task_struct+0x20f/0x4c0 kernel/fork.c:689
put_task_struct include/linux/sched/task.h:96 [inline]
delayed_put_task_struct+0x1fb/0x350 kernel/exit.c:181
__rcu_reclaim kernel/rcu/rcu.h:236 [inline]
rcu_do_batch kernel/rcu/tree.c:2584 [inline]
invoke_rcu_callbacks kernel/rcu/tree.c:2897 [inline]
__rcu_process_callbacks kernel/rcu/tree.c:2864 [inline]
rcu_process_callbacks+0xba0/0x1a30 kernel/rcu/tree.c:2881
__do_softirq+0x25c/0x921 kernel/softirq.c:292
kobject: 'rx-0' (0000000083de951f): kobject_add_internal: parent: 'queues',
set: 'queues'

The buggy address belongs to the object at ffff888092988540
which belongs to the cache task_struct(49:syz1) of size 6080
The buggy address is located 32 bytes inside of
6080-byte region [ffff888092988540, ffff888092989d00)
The buggy address belongs to the page:
page:ffffea00024a6200 count:1 mapcount:0 mapping:ffff8880a11bf080 index:0x0
compound_mapcount: 0
kobject: 'rx-0' (0000000083de951f): kobject_uevent_env
flags: 0x1fffc0000008100(slab|head)
raw: 01fffc0000008100 ffffea00015d4788 ffffea0002849488 ffff8880a11bf080
raw: 0000000000000000 ffff888092988540 0000000100000001 ffff8880a07964c0
page dumped because: kasan: bad access detected
page->mem_cgroup:ffff8880a07964c0

kobject: 'rx-0' (0000000083de951f): fill_kobj_path: path
= '/devices/virtual/net/ip_vti0/queues/rx-0'
Memory state around the buggy address:
ffff888092988400: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff888092988480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
> ffff888092988500: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
^
ffff888092988580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888092988600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
kobject: 'tx-0' (00000000878aeac0): kobject_add_internal: parent: 'queues',
set: 'queues'
==================================================================


---
This bug 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 bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

syzbot

unread,
Dec 27, 2019, 4:40:05 PM12/27/19
to syzkaller...@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