[lkml]   [2019]   [Sep]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectKASAN: use-after-free Read in move_expired_inodes

syzbot found the following crash on:

HEAD commit: b41dae06 Merge tag 'xfs-5.4-merge-7' of git://git.kernel.o..
git tree: net-next
console output:
kernel config:
dashboard link:
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:

BUG: KASAN: use-after-free in move_expired_inodes+0x8c8/0x9c0
Read of size 8 at addr ffff88805929a868 by task kworker/u4:8/10864

CPU: 1 PID: 10864 Comm: kworker/u4:8 Not tainted 5.3.0+ #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Workqueue: writeback wb_workfn (flush-8:0)
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x172/0x1f0 lib/dump_stack.c:113
print_address_description.cold+0xd4/0x306 mm/kasan/report.c:351
__kasan_report.cold+0x1b/0x36 mm/kasan/report.c:482
kasan_report+0x12/0x17 mm/kasan/common.c:618
__asan_report_load8_noabort+0x14/0x20 mm/kasan/generic_report.c:132
move_expired_inodes+0x8c8/0x9c0 fs/fs-writeback.c:1241
queue_io+0x1c5/0x590 fs/fs-writeback.c:1290
wb_writeback+0xa99/0xd90 fs/fs-writeback.c:1882
wb_check_start_all fs/fs-writeback.c:2010 [inline]
wb_do_writeback fs/fs-writeback.c:2036 [inline]
wb_workfn+0xb0e/0x11e0 fs/fs-writeback.c:2070
process_one_work+0x9af/0x1740 kernel/workqueue.c:2269
worker_thread+0x98/0xe40 kernel/workqueue.c:2415
kthread+0x361/0x430 kernel/kthread.c:255
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352

Allocated by task 21365:
save_stack+0x23/0x90 mm/kasan/common.c:69
set_track mm/kasan/common.c:77 [inline]
__kasan_kmalloc mm/kasan/common.c:493 [inline]
__kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:466
kasan_slab_alloc+0xf/0x20 mm/kasan/common.c:501
slab_post_alloc_hook mm/slab.h:520 [inline]
slab_alloc mm/slab.c:3319 [inline]
kmem_cache_alloc+0x121/0x710 mm/slab.c:3483
ext4_alloc_inode+0x1f/0x640 fs/ext4/super.c:1073
alloc_inode+0x68/0x1e0 fs/inode.c:227
new_inode_pseudo+0x19/0xf0 fs/inode.c:916
new_inode+0x1f/0x40 fs/inode.c:945
__ext4_new_inode+0x3d5/0x4e50 fs/ext4/ialloc.c:829
ext4_create+0x236/0x5e0 fs/ext4/namei.c:2587
lookup_open+0x12be/0x1a50 fs/namei.c:3224
do_last fs/namei.c:3314 [inline]
path_openat+0x14ac/0x4630 fs/namei.c:3525
do_filp_open+0x1a1/0x280 fs/namei.c:3555
do_sys_open+0x3fe/0x5d0 fs/open.c:1089
__do_sys_openat fs/open.c:1116 [inline]
__se_sys_openat fs/open.c:1110 [inline]
__x64_sys_openat+0x9d/0x100 fs/open.c:1110
do_syscall_64+0xfa/0x760 arch/x86/entry/common.c:290

Freed by task 21405:
save_stack+0x23/0x90 mm/kasan/common.c:69
set_track mm/kasan/common.c:77 [inline]
__kasan_slab_free+0x102/0x150 mm/kasan/common.c:455
kasan_slab_free+0xe/0x10 mm/kasan/common.c:463
__cache_free mm/slab.c:3425 [inline]
kmem_cache_free+0x86/0x320 mm/slab.c:3693
ext4_free_in_core_inode+0x28/0x30 fs/ext4/super.c:1120
i_callback+0x44/0x80 fs/inode.c:216
__rcu_reclaim kernel/rcu/rcu.h:222 [inline]
rcu_do_batch kernel/rcu/tree.c:2157 [inline]
rcu_core+0x581/0x1560 kernel/rcu/tree.c:2377
rcu_core_si+0x9/0x10 kernel/rcu/tree.c:2386
__do_softirq+0x262/0x98c kernel/softirq.c:292

The buggy address belongs to the object at ffff88805929a500
which belongs to the cache ext4_inode_cache(33:syz2) of size 2000
The buggy address is located 872 bytes inside of
2000-byte region [ffff88805929a500, ffff88805929acd0)
The buggy address belongs to the page:
page:ffffea000164a680 refcount:1 mapcount:0 mapping:ffff88809b51f8c0
flags: 0x1fffc0000000200(slab)
raw: 01fffc0000000200 ffffea00016446c8 ffffea00028cc3c8 ffff88809b51f8c0
raw: ffff88805929afff ffff88805929a500 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff88805929a700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88805929a780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
> ffff88805929a800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88805929a880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88805929a900: 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 for more information about syzbot.
syzbot engineers can be reached at

syzbot will keep track of this bug report. See: for how to communicate with syzbot.

 \ /
  Last update: 2019-09-25 18:56    [W:0.036 / U:0.348 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site