syzbot


KASAN: use-after-free Read in mem_cgroup_throttle_swaprate

Status: auto-closed as invalid on 2020/08/05 17:21
Reported-by: syzbot+c22ef53fab388f0033b8@syzkaller.appspotmail.com
First crash: 1478d, last: 1478d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in mem_cgroup_throttle_swaprate mm 2 1468d 1464d 0/26 auto-closed as invalid on 2020/08/15 19:49

Sample crash report:
==================================================================
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
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/04/07 17:20 linux-4.19.y dda0e2920330 db9bcd4b .config console log report ci2-linux-4-19
* Struck through repros no longer work on HEAD.