KASAN: use-after-free Read in dput

18 views
Skip to first unread message

syzbot

unread,
Jul 7, 2018, 10:09:02 AM7/7/18
to linux-...@vger.kernel.org, linux-...@vger.kernel.org, syzkall...@googlegroups.com, vi...@zeniv.linux.org.uk
Hello,

syzbot found the following crash on:

HEAD commit: 526674536360 Add linux-next specific files for 20180706
git tree: linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=121481b2400000
kernel config: https://syzkaller.appspot.com/x/.config?x=c8d1cfc0cb798e48
dashboard link: https://syzkaller.appspot.com/bug?extid=f364b40402d79b9902d7
compiler: gcc (GCC) 8.0.1 20180413 (experimental)
syzkaller repro:https://syzkaller.appspot.com/x/repro.syz?x=16b47cc2400000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=137cec58400000

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+f364b4...@syzkaller.appspotmail.com

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+0x1c9/0x2b4 lib/dump_stack.c:113
==================================================================
fail_dump lib/fault-inject.c:51 [inline]
should_fail.cold.4+0xa/0x11 lib/fault-inject.c:149
BUG: KASAN: use-after-free in fast_dput fs/dcache.c:717 [inline]
BUG: KASAN: use-after-free in dput.part.26+0x634/0x7a0 fs/dcache.c:836
Read of size 4 at addr ffff8801a7b8c4a0 by task syz-executor287/4482

__should_failslab+0x124/0x180 mm/failslab.c:32
should_failslab+0x9/0x14 mm/slab_common.c:1557
slab_pre_alloc_hook mm/slab.h:423 [inline]
slab_alloc mm/slab.c:3378 [inline]
__do_kmalloc mm/slab.c:3716 [inline]
__kmalloc+0x2c8/0x760 mm/slab.c:3727
kmalloc include/linux/slab.h:518 [inline]
kzalloc include/linux/slab.h:707 [inline]
prealloc_shrinker+0x124/0x450 mm/vmscan.c:361
register_shrinker+0x17/0x40 mm/vmscan.c:413
sget_fc+0x778/0x960 fs/super.c:562
vfs_get_super+0x6e/0x270 fs/super.c:1263
proc_get_tree+0x88/0xb0 fs/proc/root.c:159
vfs_get_tree+0x1cb/0x5c0 fs/super.c:1751
do_new_mount fs/namespace.c:2567 [inline]
do_mount+0x6c1/0x1fb0 fs/namespace.c:2889
ksys_mount+0x12d/0x140 fs/namespace.c:3105
__do_sys_mount fs/namespace.c:3119 [inline]
__se_sys_mount fs/namespace.c:3116 [inline]
__x64_sys_mount+0xbe/0x150 fs/namespace.c:3116
do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x441d79
Code: e8 6c e6 ff ff 48 83 c4 18 c3 0f 1f 80 00 00 00 00 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 07 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ffe4c8551b8 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000441d79
RDX: 0000000020000540 RSI: 0000000020000500 RDI: 00000000200004c0
RBP: 00007ffe4c8551d0 R08: 0000000020000580 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: ffffffffffffffff
R13: 0000000000000004 R14: 0000000000000000 R15: 0000000000000000
CPU: 0 PID: 4482 Comm: syz-executor287 Not tainted
4.18.0-rc3-next-20180706+ #1
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+0x1c9/0x2b4 lib/dump_stack.c:113
print_address_description+0x6c/0x20b mm/kasan/report.c:256
kasan_report_error mm/kasan/report.c:354 [inline]
kasan_report.cold.7+0x242/0x30d mm/kasan/report.c:412
__asan_report_load4_noabort+0x14/0x20 mm/kasan/report.c:432
fast_dput fs/dcache.c:717 [inline]
dput.part.26+0x634/0x7a0 fs/dcache.c:836
dput+0x15/0x20 fs/dcache.c:831
proc_kill_sb+0x125/0x1e0 fs/proc/root.c:198
deactivate_locked_super+0x97/0x100 fs/super.c:328
vfs_get_super+0x20f/0x270 fs/super.c:1270
proc_get_tree+0x88/0xb0 fs/proc/root.c:159
vfs_get_tree+0x1cb/0x5c0 fs/super.c:1751
do_new_mount fs/namespace.c:2567 [inline]
do_mount+0x6c1/0x1fb0 fs/namespace.c:2889
ksys_mount+0x12d/0x140 fs/namespace.c:3105
__do_sys_mount fs/namespace.c:3119 [inline]
__se_sys_mount fs/namespace.c:3116 [inline]
__x64_sys_mount+0xbe/0x150 fs/namespace.c:3116
do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x441d79
Code: e8 6c e6 ff ff 48 83 c4 18 c3 0f 1f 80 00 00 00 00 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 07 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ffe4c8551b8 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000441d79
RDX: 0000000020000540 RSI: 0000000020000500 RDI: 00000000200004c0
RBP: 00007ffe4c8551d0 R08: 0000000020000580 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: ffffffffffffffff
R13: 0000000000000004 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 4473:
save_stack+0x43/0xd0 mm/kasan/kasan.c:448
set_track mm/kasan/kasan.c:460 [inline]
kasan_kmalloc+0xc4/0xe0 mm/kasan/kasan.c:553
kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:490
kmem_cache_alloc+0x12e/0x760 mm/slab.c:3554
__d_alloc+0xc8/0xd50 fs/dcache.c:1617
d_alloc+0x96/0x380 fs/dcache.c:1701
d_alloc_name+0xbb/0x120 fs/dcache.c:1755
proc_setup_self+0xe1/0x3af fs/proc/self.c:43
proc_fill_super+0x37e/0x630 fs/proc/root.c:133
vfs_get_super+0x15e/0x270 fs/super.c:1268
proc_get_tree+0x88/0xb0 fs/proc/root.c:159
vfs_get_tree+0x1cb/0x5c0 fs/super.c:1751
do_new_mount fs/namespace.c:2567 [inline]
do_mount+0x6c1/0x1fb0 fs/namespace.c:2889
ksys_mount+0x12d/0x140 fs/namespace.c:3105
__do_sys_mount fs/namespace.c:3119 [inline]
__se_sys_mount fs/namespace.c:3116 [inline]
__x64_sys_mount+0xbe/0x150 fs/namespace.c:3116
do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 4474:
save_stack+0x43/0xd0 mm/kasan/kasan.c:448
set_track mm/kasan/kasan.c:460 [inline]
__kasan_slab_free+0x11a/0x170 mm/kasan/kasan.c:521
kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
__cache_free mm/slab.c:3498 [inline]
kmem_cache_free+0x86/0x2d0 mm/slab.c:3756
__d_free+0x20/0x30 fs/dcache.c:257
__rcu_reclaim kernel/rcu/rcu.h:258 [inline]
rcu_do_batch kernel/rcu/tree.c:2576 [inline]
invoke_rcu_callbacks kernel/rcu/tree.c:2878 [inline]
__rcu_process_callbacks kernel/rcu/tree.c:2845 [inline]
rcu_process_callbacks+0xe01/0x2810 kernel/rcu/tree.c:2862
__do_softirq+0x2e8/0xb17 kernel/softirq.c:288

The buggy address belongs to the object at ffff8801a7b8c4a0
which belongs to the cache dentry(17:syz4) of size 288
The buggy address is located 0 bytes inside of
288-byte region [ffff8801a7b8c4a0, ffff8801a7b8c5c0)
The buggy address belongs to the page:
page:ffffea00069ee300 count:1 mapcount:0 mapping:ffff8801ccf543c0 index:0x0
flags: 0x2fffc0000000100(slab)
raw: 02fffc0000000100 ffff8801d4348948 ffffea00069ee788 ffff8801ccf543c0
raw: 0000000000000000 ffff8801a7b8c080 000000010000000b ffff8801ab42c3c0
page dumped because: kasan: bad access detected
page->mem_cgroup:ffff8801ab42c3c0

Memory state around the buggy address:
ffff8801a7b8c380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8801a7b8c400: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
> ffff8801a7b8c480: fc fc fc fc fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8801a7b8c500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8801a7b8c580: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================


---
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#bug-status-tracking for how to communicate with
syzbot.
syzbot can test patches for this bug, for details see:
https://goo.gl/tpsmEJ#testing-patches

Eric Biggers

unread,
Jun 10, 2019, 7:01:19 PM6/10/19
to syzbot, syzkall...@googlegroups.com
Last occurred 304 days ago, and only ever occurred on linux-next. Looks related
to the fs_context patchset, which was changed a lot before being merged.

#syz invalid
Reply all
Reply to author
Forward
0 new messages