syzbot


KASAN: use-after-free Read in cgroup_throttle_swaprate

Status: auto-closed as invalid on 2020/11/17 15:57
Subsystems: mm
[Documentation on labels]
Reported-by: syzbot+5e421ac7ea78f893184b@syzkaller.appspotmail.com
First crash: 1400d, last: 1368d
Discussions (1)
Title Replies (including bot) Last reply
KASAN: use-after-free Read in cgroup_throttle_swaprate 0 (1) 2020/06/23 05:46

Sample crash report:
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:28 [inline]
BUG: KASAN: use-after-free in blk_cgroup_congested include/linux/blk-cgroup.h:288 [inline]
BUG: KASAN: use-after-free in cgroup_throttle_swaprate+0x61e/0x6a1 mm/swapfile.c:3798
Read of size 4 at addr ffff8880939acd80 by task syz-executor.2/30862

CPU: 0 PID: 30862 Comm: syz-executor.2 Not tainted 5.8.0-rc6-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+0x18f/0x20d lib/dump_stack.c:118
 print_address_description.constprop.0.cold+0xae/0x436 mm/kasan/report.c:383
 __kasan_report mm/kasan/report.c:513 [inline]
 kasan_report.cold+0x1f/0x37 mm/kasan/report.c:530
 arch_atomic_read arch/x86/include/asm/atomic.h:31 [inline]
 atomic_read include/asm-generic/atomic-instrumented.h:28 [inline]
 blk_cgroup_congested include/linux/blk-cgroup.h:288 [inline]
 cgroup_throttle_swaprate+0x61e/0x6a1 mm/swapfile.c:3798
 __do_huge_pmd_anonymous_page mm/huge_memory.c:602 [inline]
 do_huge_pmd_anonymous_page+0x569/0x2230 mm/huge_memory.c:775
 create_huge_pmd mm/memory.c:4107 [inline]
 __handle_mm_fault mm/memory.c:4328 [inline]
 handle_mm_fault+0x35dd/0x43f0 mm/memory.c:4394
 do_user_addr_fault+0x5a2/0xd00 arch/x86/mm/fault.c:1295
 handle_page_fault arch/x86/mm/fault.c:1365 [inline]
 exc_page_fault+0xab/0x170 arch/x86/mm/fault.c:1418
 asm_exc_page_fault+0x1e/0x30 arch/x86/include/asm/idtentry.h:542
RIP: 0033:0x443481
Code: Bad RIP value.
RSP: 002b:00007ffd5fedb178 EFLAGS: 00010202
RAX: 0000000020000080 RBX: 0000000000000000 RCX: 000000000000002f
RDX: 0000000000000009 RSI: 0000000000790020 RDI: 0000000020000080
RBP: 0000000000790000 R08: 0000000000000000 R09: 0000000000000004
R10: 0000000000000075 R11: 0000000000000246 R12: 0000000000790008
R13: 00007ffd5fedb370 R14: fffffffffffffffe R15: 00007ffd5fedb380

Allocated by task 1:
 save_stack+0x1b/0x40 mm/kasan/common.c:48
 set_track mm/kasan/common.c:56 [inline]
 __kasan_kmalloc.constprop.0+0xc2/0xd0 mm/kasan/common.c:494
 kmem_cache_alloc_trace+0x14f/0x2d0 mm/slab.c:3551
 kmalloc include/linux/slab.h:555 [inline]
 kzalloc include/linux/slab.h:669 [inline]
 cgroup1_root_to_use kernel/cgroup/cgroup-v1.c:1183 [inline]
 cgroup1_get_tree+0x982/0xe33 kernel/cgroup/cgroup-v1.c:1207
 vfs_get_tree+0x89/0x2f0 fs/super.c:1547
 do_new_mount fs/namespace.c:2875 [inline]
 do_mount+0x1592/0x1fe0 fs/namespace.c:3200
 __do_sys_mount fs/namespace.c:3410 [inline]
 __se_sys_mount fs/namespace.c:3387 [inline]
 __x64_sys_mount+0x18f/0x230 fs/namespace.c:3387
 do_syscall_64+0x60/0xe0 arch/x86/entry/common.c:384
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

Freed by task 24441:
 save_stack+0x1b/0x40 mm/kasan/common.c:48
 set_track mm/kasan/common.c:56 [inline]
 kasan_set_free_info mm/kasan/common.c:316 [inline]
 __kasan_slab_free+0xf5/0x140 mm/kasan/common.c:455
 __cache_free mm/slab.c:3426 [inline]
 kfree+0x103/0x2c0 mm/slab.c:3757
 cgroup_free_root kernel/cgroup/cgroup.c:1304 [inline]
 cgroup_destroy_root kernel/cgroup/cgroup.c:1346 [inline]
 css_free_rwork_fn+0xb86/0x10c0 kernel/cgroup/cgroup.c:4972
 process_one_work+0x94c/0x1670 kernel/workqueue.c:2269
 worker_thread+0x64c/0x1120 kernel/workqueue.c:2415
 kthread+0x3b5/0x4a0 kernel/kthread.c:291
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:293

The buggy address belongs to the object at ffff8880939ac000
 which belongs to the cache kmalloc-8k of size 8192
The buggy address is located 3456 bytes inside of
 8192-byte region [ffff8880939ac000, ffff8880939ae000)
The buggy address belongs to the page:
page:ffffea00024e6b00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 head:ffffea00024e6b00 order:2 compound_mapcount:0 compound_pincount:0
flags: 0xfffe0000010200(slab|head)
raw: 00fffe0000010200 ffffea00024e6108 ffffea00024e7508 ffff8880aa0021c0
raw: 0000000000000000 ffff8880939ac000 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880939acc80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880939acd00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880939acd80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff8880939ace00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880939ace80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/07/20 15:56 upstream 5714ee50bb43 4285ffa3 .config console log report ci-upstream-kasan-gce-selinux-root
2020/07/14 20:25 upstream 0dc589da873b 609fb517 .config console log report ci-upstream-kasan-gce-smack-root
2020/06/19 04:41 upstream 7ae77150d94d bc258b50 .config console log report ci-upstream-kasan-gce-smack-root
* Struck through repros no longer work on HEAD.