KASAN: use-after-free Write in _free_event

8 views
Skip to first unread message

syzbot

unread,
Sep 21, 2019, 9:03:08 PM9/21/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=15f9e903600000
kernel config: https://syzkaller.appspot.com/x/.config?x=50b385e67c7b7cdf
dashboard link: https://syzkaller.appspot.com/bug?extid=672b9572a3ebe193b4b1
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+672b95...@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 _free_event+0x39b/0x1220
kernel/events/core.c:4460
Write of size 4 at addr ffff88809eb566e0 by task syz-executor.5/9194

CPU: 1 PID: 9194 Comm: syz-executor.5 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]
_free_event+0x39b/0x1220 kernel/events/core.c:4460
put_event+0x47/0x60 kernel/events/core.c:4547
perf_event_release_kernel+0x6d1/0xd80 kernel/events/core.c:4662
perf_release+0x37/0x50 kernel/events/core.c:4672
__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: fd b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7
48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff
ff 0f 83 cb b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ffc710cc848 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 000000000000000b RCX: 0000000000459a09
RDX: 0000000000413631 RSI: 0000000000a74ef0 RDI: 0000000000000000
RBP: 00000000004bf0ed R08: 000000000000000c R09: 00007ffc710cc950
R10: 0000555555f40940 R11: 0000000000000246 R12: 000000000075bfc8
R13: 0000000000000004 R14: 0000000000000001 R15: 000000000075bfd4

Allocated by task 9194:
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 18:
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
__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

The buggy address belongs to the object at ffff88809eb566c0
which belongs to the cache task_struct(81:syz5) of size 6080
The buggy address is located 32 bytes inside of
6080-byte region [ffff88809eb566c0, ffff88809eb57e80)
The buggy address belongs to the page:
page:ffffea00027ad580 count:1 mapcount:0 mapping:ffff888096f76b00 index:0x0
compound_mapcount: 0
flags: 0x1fffc0000008100(slab|head)
raw: 01fffc0000008100 ffffea00022eeb88 ffffea00027a0588 ffff888096f76b00
raw: 0000000000000000 ffff88809eb566c0 0000000100000001 ffff888095bb0200
page dumped because: kasan: bad access detected
page->mem_cgroup:ffff888095bb0200

Memory state around the buggy address:
ffff88809eb56580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88809eb56600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
> ffff88809eb56680: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
^
ffff88809eb56700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88809eb56780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
net_ratelimit: 12 callbacks suppressed
protocol 88fb is buggy, dev hsr_slave_0
protocol 88fb is buggy, dev hsr_slave_1


---
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,
Jan 26, 2020, 3:58:05 AM1/26/20
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