syzbot


KASAN: use-after-free Read in fuse_copy_one

Status: upstream: reported C repro on 2022/11/15 07:36
Reported-by: syzbot+a6da5581b45970c073a0@syzkaller.appspotmail.com
First crash: 521d, last: 12d
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-5-15 KASAN: use-after-free Read in fuse_copy_one origin:upstream missing-backport C error 1 22d 520d 0/2 upstream: reported C repro on 2022/11/15 14:31
android-5-10 KASAN: use-after-free Read in fuse_copy_one C error inconclusive 1 521d 521d 0/2 auto-obsoleted due to no activity on 2023/05/17 19:00
Last patch testing requests (6)
Created Duration User Patch Repo Result
2024/04/07 08:58 7m retest repro android12-5.4 report log
2024/01/28 05:36 6m retest repro android12-5.4 report log
2023/11/19 05:14 7m retest repro android12-5.4 report log
2023/09/10 05:01 4m retest repro android12-5.4 report log
2023/07/02 04:10 11m retest repro android12-5.4 report log
2023/04/23 02:58 7m retest repro android12-5.4 report log

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in fuse_copy_do fs/fuse/dev.c:753 [inline]
BUG: KASAN: use-after-free in fuse_copy_one+0x1e8/0x3e0 fs/fuse/dev.c:1005
Read of size 256 at addr ffff8881e6393010 by task syz-executor124/335

CPU: 0 PID: 335 Comm: syz-executor124 Not tainted 5.4.210-syzkaller-00003-g5a34019eb955 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1d8/0x241 lib/dump_stack.c:118
 print_address_description+0x8c/0x630 mm/kasan/report.c:384
 __kasan_report+0xf6/0x130 mm/kasan/report.c:516
 kasan_report+0x30/0x60 mm/kasan/common.c:653
 check_memory_region_inline mm/kasan/generic.c:141 [inline]
 check_memory_region+0x298/0x2d0 mm/kasan/generic.c:191
 memcpy+0x25/0x50 mm/kasan/common.c:123
 fuse_copy_do fs/fuse/dev.c:753 [inline]
 fuse_copy_one+0x1e8/0x3e0 fs/fuse/dev.c:1005
 fuse_copy_args+0x341/0x420 fs/fuse/dev.c:1023
 fuse_dev_do_read+0xbdf/0x10d0 fs/fuse/dev.c:1298
 fuse_dev_read+0x177/0x220 fs/fuse/dev.c:1365
 call_read_iter include/linux/fs.h:1970 [inline]
 new_sync_read fs/read_write.c:414 [inline]
 __vfs_read+0x5e0/0x760 fs/read_write.c:427
 vfs_read+0x166/0x370 fs/read_write.c:461
 ksys_read+0x198/0x2c0 fs/read_write.c:587
 do_syscall_64+0xcb/0x1c0 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x7f533a437659
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 11 15 00 00 90 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 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f533a3852f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
RAX: ffffffffffffffda RBX: 00007f533a4c84f0 RCX: 00007f533a437659
RDX: 0000000000002020 RSI: 0000000020002140 RDI: 0000000000000003
RBP: 00007f533a495264 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f533a48f140
R13: 00007f533a491258 R14: 00007f533a493260 R15: 00007f533a4c84f8

Allocated by task 320:
 save_stack mm/kasan/common.c:70 [inline]
 set_track mm/kasan/common.c:78 [inline]
 __kasan_kmalloc+0x131/0x1e0 mm/kasan/common.c:529
 kmalloc include/linux/slab.h:561 [inline]
 __d_alloc+0xac/0x6a0 fs/dcache.c:1706
 d_alloc fs/dcache.c:1769 [inline]
 d_alloc_parallel+0xe6/0x1310 fs/dcache.c:2521
 __lookup_slow+0x15a/0x450 fs/namei.c:1731
 lookup_slow+0x53/0x70 fs/namei.c:1765
 walk_component+0x62a/0xb30 fs/namei.c:1885
 lookup_last fs/namei.c:2348 [inline]
 path_lookupat+0x188/0x3f0 fs/namei.c:2393
 filename_lookup+0x223/0x6a0 fs/namei.c:2423
 user_path_at include/linux/namei.h:49 [inline]
 do_mount+0x134/0xe10 fs/namespace.c:3101
 ksys_mount+0xc2/0xf0 fs/namespace.c:3372
 __do_sys_mount fs/namespace.c:3386 [inline]
 __se_sys_mount fs/namespace.c:3383 [inline]
 __x64_sys_mount+0xb1/0xc0 fs/namespace.c:3383
 do_syscall_64+0xcb/0x1c0 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

Freed by task 10:
 save_stack mm/kasan/common.c:70 [inline]
 set_track mm/kasan/common.c:78 [inline]
 kasan_set_free_info mm/kasan/common.c:345 [inline]
 __kasan_slab_free+0x178/0x240 mm/kasan/common.c:487
 slab_free_hook mm/slub.c:1455 [inline]
 slab_free_freelist_hook+0x80/0x150 mm/slub.c:1494
 slab_free mm/slub.c:3080 [inline]
 kfree+0xc6/0x260 mm/slub.c:4071
 __rcu_reclaim kernel/rcu/rcu.h:215 [inline]
 rcu_do_batch+0x455/0xa10 kernel/rcu/tree.c:2167
 rcu_core+0x4ba/0xca0 kernel/rcu/tree.c:2387
 __do_softirq+0x23e/0x643 kernel/softirq.c:292

The buggy address belongs to the object at ffff8881e6393000
 which belongs to the cache kmalloc-rcl-512 of size 512
The buggy address is located 16 bytes inside of
 512-byte region [ffff8881e6393000, ffff8881e6393200)
The buggy address belongs to the page:
page:ffffea000798e400 refcount:1 mapcount:0 mapping:ffff8881f5c0db80 index:0x0 compound_mapcount: 0
flags: 0x8000000000010200(slab|head)
raw: 8000000000010200 dead000000000100 dead000000000122 ffff8881f5c0db80
raw: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 2, migratetype Reclaimable, gfp_mask 0xd20d0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_RECLAIMABLE)
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook mm/page_alloc.c:2165 [inline]
 prep_new_page+0x194/0x380 mm/page_alloc.c:2171
 get_page_from_freelist+0x524/0x560 mm/page_alloc.c:3794
 __alloc_pages_nodemask+0x372/0x860 mm/page_alloc.c:4857
 alloc_slab_page+0x39/0x3e0 mm/slub.c:343
 allocate_slab mm/slub.c:1683 [inline]
 new_slab+0x97/0x450 mm/slub.c:1749
 new_slab_objects mm/slub.c:2505 [inline]
 ___slab_alloc+0x320/0x4a0 mm/slub.c:2667
 __slab_alloc+0x5a/0x90 mm/slub.c:2707
 slab_alloc_node mm/slub.c:2792 [inline]
 slab_alloc mm/slub.c:2837 [inline]
 __kmalloc+0x197/0x2b0 mm/slub.c:3909
 kmalloc include/linux/slab.h:561 [inline]
 __d_alloc+0xac/0x6a0 fs/dcache.c:1706
 d_alloc fs/dcache.c:1769 [inline]
 d_alloc_parallel+0xe6/0x1310 fs/dcache.c:2521
 __lookup_slow+0x15a/0x450 fs/namei.c:1731
 lookup_slow+0x53/0x70 fs/namei.c:1765
 walk_component+0x62a/0xb30 fs/namei.c:1885
 lookup_last fs/namei.c:2348 [inline]
 path_lookupat+0x188/0x3f0 fs/namei.c:2393
 filename_lookup+0x223/0x6a0 fs/namei.c:2423
 user_path_at include/linux/namei.h:49 [inline]
 do_mount+0x134/0xe10 fs/namespace.c:3101
page_owner free stack trace missing

Memory state around the buggy address:
 ffff8881e6392f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8881e6392f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8881e6393000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                         ^
 ffff8881e6393080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8881e6393100: 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
2022/11/15 07:36 android12-5.4 5a34019eb955 97de9cfc .config strace log report syz C [disk image] [vmlinux] [kernel image] ci2-android-5-4-kasan KASAN: use-after-free Read in fuse_copy_one
* Struck through repros no longer work on HEAD.