syzbot


KASAN: use-after-free Read in fuse_copy_one

Status: auto-obsoleted due to no activity on 2023/05/17 19:00
Reported-by: syzbot+5656d401995e0d601704@syzkaller.appspotmail.com
First crash: 737d, last: 737d
Cause bisection: failed (error log, bisect log)
  
Fix bisection the fix commit could be any of (bisect log):
  0118fb827bc7 Merge branch 'android12-5.10' into branch 'android12-5.10-lts'
  bf760358eac3 Merge branch 'android12-5.10' into android12-5.10-lts
  
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-54 KASAN: use-after-free Read in fuse_copy_one C 1 14d 737d 0/2 upstream: reported C repro on 2022/11/15 07:36
android-5-15 KASAN: use-after-free Read in fuse_copy_one origin:upstream missing-backport C error error 1 207d 737d 0/2 auto-obsoleted due to no activity on 2024/08/08 22:29
Last patch testing requests (3)
Created Duration User Patch Repo Result
2022/12/12 08:46 11m tudor.ambarus@linaro.org git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git linux-5.15.y report log
2022/12/12 08:46 8m tudor.ambarus@linaro.org git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git linux-5.10.y report log
2022/12/12 08:45 19m tudor.ambarus@linaro.org git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master OK log

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in fuse_copy_do fs/fuse/dev.c:770 [inline]
BUG: KASAN: use-after-free in fuse_copy_one+0x1e7/0x3f0 fs/fuse/dev.c:1021
Read of size 256 at addr ffff88811f178c10 by task syz-executor162/969

CPU: 1 PID: 969 Comm: syz-executor162 Not tainted 5.10.149-syzkaller #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_lvl+0x1e2/0x24b lib/dump_stack.c:118
 print_address_description+0x81/0x3c0 mm/kasan/report.c:233
 __kasan_report mm/kasan/report.c:419 [inline]
 kasan_report+0x1a4/0x1f0 mm/kasan/report.c:436
 check_region_inline mm/kasan/generic.c:135 [inline]
 kasan_check_range+0x2aa/0x2e0 mm/kasan/generic.c:186
 memcpy+0x2d/0x70 mm/kasan/shadow.c:65
 fuse_copy_do fs/fuse/dev.c:770 [inline]
 fuse_copy_one+0x1e7/0x3f0 fs/fuse/dev.c:1021
 fuse_copy_args+0x309/0x400 fs/fuse/dev.c:1039
 fuse_dev_do_read+0xc96/0x1190 fs/fuse/dev.c:1314
 fuse_dev_read+0x16f/0x210 fs/fuse/dev.c:1381
 call_read_iter include/linux/fs.h:1946 [inline]
 new_sync_read fs/read_write.c:415 [inline]
 vfs_read+0x9e2/0xbf0 fs/read_write.c:496
 ksys_read+0x198/0x2c0 fs/read_write.c:634
 __do_sys_read fs/read_write.c:644 [inline]
 __se_sys_read fs/read_write.c:642 [inline]
 __x64_sys_read+0x7b/0x90 fs/read_write.c:642
 do_syscall_64+0x34/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x61/0xc6
RIP: 0033:0x7fc579830469
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 b1 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:00007fc5797e02f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
RAX: ffffffffffffffda RBX: 00007fc5798c14c0 RCX: 00007fc579830469
RDX: 0000000000002020 RSI: 0000000020002140 RDI: 0000000000000003
RBP: 00007fc57988e49c R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fc579888378
R13: 00007fc57988a490 R14: 00007fc57988c498 R15: 00007fc5798c14c8

Allocated by task 969:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:428 [inline]
 ____kasan_kmalloc+0xdc/0x110 mm/kasan/common.c:507
 __kasan_kmalloc+0x9/0x10 mm/kasan/common.c:516
 kasan_kmalloc include/linux/kasan.h:269 [inline]
 __kmalloc+0x1f7/0x360 mm/slub.c:4042
 kmalloc include/linux/slab.h:557 [inline]
 __d_alloc+0xab/0x6b0 fs/dcache.c:1725
 d_alloc fs/dcache.c:1788 [inline]
 d_alloc_parallel+0xe6/0x1330 fs/dcache.c:2540
 __lookup_slow+0x14e/0x400 fs/namei.c:1615
 lookup_slow+0x5a/0x80 fs/namei.c:1647
 walk_component+0x425/0x5a0 fs/namei.c:1942
 lookup_last fs/namei.c:2391 [inline]
 path_lookupat+0x18d/0x460 fs/namei.c:2415
 filename_lookup+0x23f/0x6c0 fs/namei.c:2448
 user_path_at_empty+0x40/0x50 fs/namei.c:2728
 user_path_at include/linux/namei.h:59 [inline]
 do_mount fs/namespace.c:3239 [inline]
 __do_sys_mount fs/namespace.c:3450 [inline]
 __se_sys_mount+0x293/0x3c0 fs/namespace.c:3427
 __x64_sys_mount+0xbf/0xd0 fs/namespace.c:3427
 do_syscall_64+0x34/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x61/0xc6

Freed by task 74:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4c/0x80 mm/kasan/common.c:46
 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:357
 ____kasan_slab_free+0x121/0x160 mm/kasan/common.c:360
 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:368
 kasan_slab_free include/linux/kasan.h:235 [inline]
 slab_free_hook mm/slub.c:1604 [inline]
 slab_free_freelist_hook+0xcc/0x1a0 mm/slub.c:1630
 slab_free mm/slub.c:3212 [inline]
 kmem_cache_free_bulk+0x437/0x590 mm/slub.c:3345
 kfree_bulk include/linux/slab.h:409 [inline]
 kfree_rcu_work+0x2bb/0x690 kernel/rcu/tree.c:3229
 process_one_work+0x726/0xc10 kernel/workqueue.c:2296
 worker_thread+0xb27/0x1550 kernel/workqueue.c:2442
 kthread+0x349/0x3d0 kernel/kthread.c:313
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:299

The buggy address belongs to the object at ffff88811f178c00
 which belongs to the cache kmalloc-rcl-512 of size 512
The buggy address is located 16 bytes inside of
 512-byte region [ffff88811f178c00, ffff88811f178e00)
The buggy address belongs to the page:
page:ffffea00047c5e00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11f178
head:ffffea00047c5e00 order:2 compound_mapcount:0 compound_pincount:0
flags: 0x8000000000010200(slab|head)
raw: 8000000000010200 dead000000000100 dead000000000122 ffff88810004c300
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 0x1d20d0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL|__GFP_RECLAIMABLE), pid 894, ts 32186343926, free_ts 0
 set_page_owner include/linux/page_owner.h:35 [inline]
 post_alloc_hook mm/page_alloc.c:2386 [inline]
 prep_new_page mm/page_alloc.c:2392 [inline]
 get_page_from_freelist+0x755/0x810 mm/page_alloc.c:4073
 __alloc_pages_nodemask+0x3b6/0x890 mm/page_alloc.c:5160
 alloc_slab_page mm/slub.c:1815 [inline]
 allocate_slab+0x78/0x540 mm/slub.c:1817
 new_slab mm/slub.c:1878 [inline]
 new_slab_objects mm/slub.c:2636 [inline]
 ___slab_alloc+0x131/0x2e0 mm/slub.c:2800
 __slab_alloc+0x63/0xa0 mm/slub.c:2840
 slab_alloc_node mm/slub.c:2922 [inline]
 slab_alloc mm/slub.c:2964 [inline]
 __kmalloc+0x24f/0x360 mm/slub.c:4038
 kmalloc include/linux/slab.h:557 [inline]
 __d_alloc+0xab/0x6b0 fs/dcache.c:1725
 d_alloc fs/dcache.c:1788 [inline]
 d_alloc_parallel+0xe6/0x1330 fs/dcache.c:2540
 __lookup_slow+0x14e/0x400 fs/namei.c:1615
 lookup_slow+0x5a/0x80 fs/namei.c:1647
 walk_component+0x425/0x5a0 fs/namei.c:1942
 lookup_last fs/namei.c:2391 [inline]
 path_lookupat+0x18d/0x460 fs/namei.c:2415
 filename_lookup+0x23f/0x6c0 fs/namei.c:2448
 user_path_at_empty+0x40/0x50 fs/namei.c:2728
 user_path_at include/linux/namei.h:59 [inline]
 vfs_statx+0x116/0x3f0 fs/stat.c:193
 vfs_fstatat fs/stat.c:215 [inline]
 __do_sys_newfstatat fs/stat.c:383 [inline]
 __se_sys_newfstatat+0xc8/0x780 fs/stat.c:377
page_owner free stack trace missing

Memory state around the buggy address:
 ffff88811f178b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88811f178b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88811f178c00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                         ^
 ffff88811f178c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88811f178d00: 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:40 android12-5.10-lts 0118fb827bc7 97de9cfc .config strace log report syz C ci2-android-5-10 KASAN: use-after-free Read in fuse_copy_one
* Struck through repros no longer work on HEAD.