KASAN: use-after-free Read in shmem_fault

9 views
Skip to first unread message

syzbot

unread,
Apr 30, 2019, 10:22:06 PM4/30/19
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 19bb613a Linux 4.19.37
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=13a6ab24a00000
kernel config: https://syzkaller.appspot.com/x/.config?x=2f4f1677ff80cdff
dashboard link: https://syzkaller.appspot.com/bug?extid=26b762fc0ee9661d623d
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+26b762...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: use-after-free in __lock_acquire+0x33b2/0x48f0
kernel/locking/lockdep.c:3290
Read of size 8 at addr ffff8880899091e0 by task syz-executor.5/8766

CPU: 0 PID: 8766 Comm: syz-executor.5 Not tainted 4.19.37 #5
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+0x172/0x1f0 lib/dump_stack.c:113
print_address_description.cold+0x7c/0x20d 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+0x8c/0x2ba mm/kasan/report.c:396
__asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433
__lock_acquire+0x33b2/0x48f0 kernel/locking/lockdep.c:3290
lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:3900
__raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline]
_raw_spin_lock+0x2f/0x40 kernel/locking/spinlock.c:144
spin_lock include/linux/spinlock.h:329 [inline]
shmem_fault+0x5ba/0x760 mm/shmem.c:2016
__do_fault+0x116/0x480 mm/memory.c:3263
do_shared_fault mm/memory.c:3730 [inline]
do_fault mm/memory.c:3808 [inline]
handle_pte_fault mm/memory.c:4035 [inline]
__handle_mm_fault+0x2b13/0x3f80 mm/memory.c:4159
handle_mm_fault+0x43f/0xb30 mm/memory.c:4196
__do_page_fault+0x62a/0xe90 arch/x86/mm/fault.c:1395
do_page_fault+0x71/0x581 arch/x86/mm/fault.c:1470
page_fault+0x1e/0x30 arch/x86/entry/entry_64.S:1165
RIP: 0033:0x401abc
Code: ff 01 64 48 8b 3c 25 00 00 00 00 48 81 c7 08 ff ff ff e8 07 f7 01 00
85 c0 75 13 48 63 44 24 04 48 8b 54 24 18 48 8b 4c 24 08 <48> 89 0c c2 64
f0 83 2c 25 d0 ff ff ff 01 64 f0 83 04 25 d0 ff ff
RSP: 002b:00007f4bd8056010 EFLAGS: 00010246
RAX: 0000000000000000 RBX: 00007f4bd80564f0 RCX: 00008f0000509120
RDX: 0000000020003800 RSI: 0000000000000000 RDI: 00007f4bd8058608
RBP: 0000000020003800 R08: 0000000000000090 R09: 0000000000000005
R10: 00000000000000b3 R11: 0000000000000206 R12: 0000000000000000
R13: 0000000020000000 R14: 00000000004dd838 R15: 00000000ffffffff

Allocated by task 8766:
save_stack+0x45/0xd0 mm/kasan/kasan.c:448
set_track mm/kasan/kasan.c:460 [inline]
kasan_kmalloc mm/kasan/kasan.c:553 [inline]
kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:531
kasan_slab_alloc+0xf/0x20 mm/kasan/kasan.c:490
kmem_cache_alloc+0x12e/0x700 mm/slab.c:3559
shmem_alloc_inode+0x1c/0x50 mm/shmem.c:3595
alloc_inode+0x66/0x190 fs/inode.c:210
new_inode_pseudo+0x19/0xf0 fs/inode.c:903
new_inode+0x1f/0x40 fs/inode.c:932
shmem_get_inode+0x84/0x780 mm/shmem.c:2192
__shmem_file_setup.part.0+0x1e2/0x2b0 mm/shmem.c:3951
__shmem_file_setup mm/shmem.c:3945 [inline]
shmem_kernel_file_setup mm/shmem.c:3981 [inline]
shmem_zero_setup+0xe2/0x474 mm/shmem.c:4025
mmap_region+0x1369/0x1760 mm/mmap.c:1779
do_mmap+0x8e2/0x1080 mm/mmap.c:1536
do_mmap_pgoff include/linux/mm.h:2306 [inline]
vm_mmap_pgoff+0x1c5/0x230 mm/util.c:357
ksys_mmap_pgoff+0xf7/0x630 mm/mmap.c:1586
__do_sys_mmap arch/x86/kernel/sys_x86_64.c:100 [inline]
__se_sys_mmap arch/x86/kernel/sys_x86_64.c:91 [inline]
__x64_sys_mmap+0xe9/0x1b0 arch/x86/kernel/sys_x86_64.c:91
do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 8755:
save_stack+0x45/0xd0 mm/kasan/kasan.c:448
set_track mm/kasan/kasan.c:460 [inline]
__kasan_slab_free+0x102/0x150 mm/kasan/kasan.c:521
kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
__cache_free mm/slab.c:3503 [inline]
kmem_cache_free+0x86/0x260 mm/slab.c:3765
shmem_destroy_callback+0x6e/0xc0 mm/shmem.c:3606
__rcu_reclaim kernel/rcu/rcu.h:236 [inline]
rcu_do_batch kernel/rcu/tree.c:2584 [inline]
invoke_rcu_callbacks kernel/rcu/tree.c:2897 [inline]
__rcu_process_callbacks kernel/rcu/tree.c:2864 [inline]
rcu_process_callbacks+0xba9/0x1a40 kernel/rcu/tree.c:2881
__do_softirq+0x266/0x92f kernel/softirq.c:292

The buggy address belongs to the object at ffff888089909040
which belongs to the cache shmem_inode_cache(81:syz5) of size 1192
The buggy address is located 416 bytes inside of
1192-byte region [ffff888089909040, ffff8880899094e8)
The buggy address belongs to the page:
page:ffffea0002264240 count:1 mapcount:0 mapping:ffff88808a8c2d80
index:0xffff888089909ffd
flags: 0x1fffc0000000100(slab)
raw: 01fffc0000000100 ffff88808ac0e148 ffffea000284e8c8 ffff88808a8c2d80
raw: ffff888089909ffd ffff888089909040 0000000100000003 ffff888060f2a9c0
page dumped because: kasan: bad access detected
page->mem_cgroup:ffff888060f2a9c0

Memory state around the buggy address:
ffff888089909080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888089909100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
> ffff888089909180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888089909200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888089909280: 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,
Oct 25, 2019, 4:45:05 AM10/25/19
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