KASAN: use-after-free Read in mem_cgroup_throttle_swaprate

8 views
Skip to first unread message

syzbot

unread,
Apr 7, 2020, 1:21:16 PM4/7/20
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: dda0e292 Linux 4.19.114
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=16d18e57e00000
kernel config: https://syzkaller.appspot.com/x/.config?x=f32ac7e5b2d5c341
dashboard link: https://syzkaller.appspot.com/bug?extid=c22ef53fab388f0033b8
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+c22ef5...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: use-after-free in __read_once_size include/linux/compiler.h:193 [inline]
BUG: KASAN: use-after-free in arch_atomic_read arch/x86/include/asm/atomic.h:31 [inline]
BUG: KASAN: use-after-free in atomic_read include/asm-generic/atomic-instrumented.h:22 [inline]
BUG: KASAN: use-after-free in blk_cgroup_congested include/linux/blk-cgroup.h:261 [inline]
BUG: KASAN: use-after-free in mem_cgroup_throttle_swaprate+0x5d6/0x650 mm/swapfile.c:3748
Read of size 4 at addr ffff8880966118d0 by task syz-executor.0/32179

CPU: 1 PID: 32179 Comm: syz-executor.0 Not tainted 4.19.114-syzkaller #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+0x188/0x20d lib/dump_stack.c:118
print_address_description.cold+0x7c/0x212 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+0x88/0x2b9 mm/kasan/report.c:396
__read_once_size include/linux/compiler.h:193 [inline]
arch_atomic_read arch/x86/include/asm/atomic.h:31 [inline]
atomic_read include/asm-generic/atomic-instrumented.h:22 [inline]
blk_cgroup_congested include/linux/blk-cgroup.h:261 [inline]
mem_cgroup_throttle_swaprate+0x5d6/0x650 mm/swapfile.c:3748
mem_cgroup_try_charge_delay+0x67/0xa0 mm/memcontrol.c:6016
wp_page_copy+0x3fe/0x1530 mm/memory.c:2520
do_wp_page+0x518/0xfa0 mm/memory.c:2799
handle_pte_fault mm/memory.c:4057 [inline]
__handle_mm_fault+0x21a4/0x3b60 mm/memory.c:4165
handle_mm_fault+0x1a5/0x670 mm/memory.c:4202
__do_page_fault+0x5ed/0xdd0 arch/x86/mm/fault.c:1412
page_fault+0x1e/0x30 arch/x86/entry/entry_64.S:1204
RIP: 0033:0x40ee98
Code: 00 00 49 8d be 88 00 00 00 48 89 ea 48 89 de 0f 85 dd 00 00 00 e8 88 2e 00 00 8b 05 72 91 33 00 48 8b 15 eb 37 87 00 83 c0 01 <89> 05 62 91 33 00 89 02 48 83 c4 08 5b 5d 41 5c 41 5d 41 5e 41 5f
RSP: 002b:00007fff0c27d790 EFLAGS: 00010202
RAX: 0000000000000001 RBX: 0000001b2f620014 RCX: 0000001b30620000
RDX: 0000001b2f620000 RSI: ffffffff8720008d RDI: 000000008720008d
RBP: 0000001b2f620018 R08: ffffffff816cb3e7 R09: 00000000edce5e79
R10: 00007fff0c27d8d0 R11: 0000000000000246 R12: 0000001b2f62001c
R13: 00000000000c01b3 R14: 000000000076bf00 R15: 000000000076bf0c

Allocated by task 1:
set_track mm/kasan/kasan.c:460 [inline]
kasan_kmalloc mm/kasan/kasan.c:553 [inline]
kasan_kmalloc+0xbf/0xe0 mm/kasan/kasan.c:531
kmem_cache_alloc_trace+0x14d/0x7a0 mm/slab.c:3625
kmalloc include/linux/slab.h:515 [inline]
kzalloc include/linux/slab.h:709 [inline]
cgroup1_mount+0x68b/0x113b kernel/cgroup/cgroup-v1.c:1224
cgroup_mount+0x17b/0xa30 kernel/cgroup/cgroup.c:2080
mount_fs+0xa3/0x30c fs/super.c:1261
vfs_kern_mount.part.0+0x68/0x400 fs/namespace.c:961
vfs_kern_mount fs/namespace.c:951 [inline]
do_new_mount fs/namespace.c:2469 [inline]
do_mount+0x4f4/0x2a40 fs/namespace.c:2799
ksys_mount+0xd7/0x150 fs/namespace.c:3015
__do_sys_mount fs/namespace.c:3029 [inline]
__se_sys_mount fs/namespace.c:3026 [inline]
__x64_sys_mount+0xba/0x150 fs/namespace.c:3026
do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 22956:
set_track mm/kasan/kasan.c:460 [inline]
__kasan_slab_free+0xf7/0x140 mm/kasan/kasan.c:521
__cache_free mm/slab.c:3503 [inline]
kfree+0xce/0x220 mm/slab.c:3822
cgroup_free_root kernel/cgroup/cgroup.c:1246 [inline]
cgroup_free_root kernel/cgroup/cgroup.c:1242 [inline]
cgroup_destroy_root kernel/cgroup/cgroup.c:1289 [inline]
css_free_rwork_fn+0x8c8/0xce0 kernel/cgroup/cgroup.c:4678
process_one_work+0x91f/0x1640 kernel/workqueue.c:2155
worker_thread+0x96/0xe20 kernel/workqueue.c:2298
kthread+0x34a/0x420 kernel/kthread.c:246
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415

The buggy address belongs to the object at ffff888096611140
which belongs to the cache kmalloc-8192 of size 8192
The buggy address is located 1936 bytes inside of
8192-byte region [ffff888096611140, ffff888096613140)
The buggy address belongs to the page:
page:ffffea0002598400 count:1 mapcount:0 mapping:ffff88812c3d5080 index:0x0 compound_mapcount: 0
flags: 0xfffe0000008100(slab|head)
raw: 00fffe0000008100 ffffea0002597e08 ffffea0002598b08 ffff88812c3d5080
raw: 0000000000000000 ffff888096611140 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff888096611780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888096611800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888096611880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888096611900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888096611980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


---
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,
Aug 5, 2020, 1:21:11 PM8/5/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