syzbot


KASAN: use-after-free Read in fuse_copy_do

Status: upstream: reported C repro on 2022/11/15 20:38
Reported-by: syzbot+838dae48269e71d6f5c6@syzkaller.appspotmail.com
First crash: 526d, last: 422d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 KASAN: use-after-free Read in fuse_copy_do C error 1 526d 526d 0/1 upstream: reported C repro on 2022/11/15 07:48
Fix bisection attempts (2)
Created Duration User Patch Repo Result
2023/02/27 06:57 29m bisect fix linux-4.14.y job log (0) log
2023/01/26 03:15 24m bisect fix linux-4.14.y job log (0) log

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in memcpy include/linux/string.h:376 [inline]
BUG: KASAN: use-after-free in fuse_copy_do+0x32f/0x430 fs/fuse/dev.c:810
Read of size 256 at addr ffff8880a91d62d0 by task syz-executor280/8941

CPU: 0 PID: 8941 Comm: syz-executor280 Not tainted 4.14.299-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x1b2/0x281 lib/dump_stack.c:58
 print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:252
 kasan_report_error.cold+0x8a/0x191 mm/kasan/report.c:351
 kasan_report+0x6f/0x80 mm/kasan/report.c:409
 memcpy+0x20/0x50 mm/kasan/kasan.c:302
 memcpy include/linux/string.h:376 [inline]
 fuse_copy_do+0x32f/0x430 fs/fuse/dev.c:810
 fuse_copy_one fs/fuse/dev.c:1061 [inline]
 fuse_copy_args+0x183/0x420 fs/fuse/dev.c:1079
 fuse_dev_do_read+0x161e/0x2150 fs/fuse/dev.c:1337
 fuse_dev_read+0x12a/0x1a0 fs/fuse/dev.c:1403
 call_read_iter include/linux/fs.h:1774 [inline]
 new_sync_read fs/read_write.c:401 [inline]
 __vfs_read+0x449/0x620 fs/read_write.c:413
 vfs_read+0x139/0x340 fs/read_write.c:447
 SYSC_read fs/read_write.c:574 [inline]
 SyS_read+0xf2/0x210 fs/read_write.c:567
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x5e/0xd3

Allocated by task 8936:
 save_stack mm/kasan/kasan.c:447 [inline]
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc+0xeb/0x160 mm/kasan/kasan.c:551
 __do_kmalloc mm/slab.c:3720 [inline]
 __kmalloc+0x15a/0x400 mm/slab.c:3729
 kmalloc include/linux/slab.h:493 [inline]
 __d_alloc+0x61f/0xa20 fs/dcache.c:1639
 d_alloc+0x46/0x240 fs/dcache.c:1710
 d_alloc_parallel+0xd6/0x16b0 fs/dcache.c:2492
 lookup_slow+0x175/0x400 fs/namei.c:1679
 walk_component+0x6a1/0xbc0 fs/namei.c:1825
 lookup_last fs/namei.c:2293 [inline]
 path_lookupat+0x1bb/0x780 fs/namei.c:2343
 filename_lookup+0x18a/0x510 fs/namei.c:2377
 user_path include/linux/namei.h:62 [inline]
 do_mount+0x118/0x2a30 fs/namespace.c:2845
 SYSC_mount fs/namespace.c:3121 [inline]
 SyS_mount+0xa8/0x120 fs/namespace.c:3098
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x5e/0xd3

Freed by task 0:
 save_stack mm/kasan/kasan.c:447 [inline]
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_slab_free+0xc3/0x1a0 mm/kasan/kasan.c:524
 __cache_free mm/slab.c:3496 [inline]
 kfree+0xc9/0x250 mm/slab.c:3815
 __rcu_reclaim kernel/rcu/rcu.h:195 [inline]
 rcu_do_batch kernel/rcu/tree.c:2699 [inline]
 invoke_rcu_callbacks kernel/rcu/tree.c:2962 [inline]
 __rcu_process_callbacks kernel/rcu/tree.c:2929 [inline]
 rcu_process_callbacks+0x780/0x1180 kernel/rcu/tree.c:2946
 __do_softirq+0x24d/0x9ff kernel/softirq.c:288

The buggy address belongs to the object at ffff8880a91d62c0
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 16 bytes inside of
 512-byte region [ffff8880a91d62c0, ffff8880a91d64c0)
The buggy address belongs to the page:
page:ffffea0002a47580 count:1 mapcount:0 mapping:ffff8880a91d6040 index:0x0
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffff8880a91d6040 0000000000000000 0000000100000006
raw: ffffea0002aaf3e0 ffffea0002a49a60 ffff88813fe74940 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880a91d6180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880a91d6200: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff8880a91d6280: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
                                                 ^
 ffff8880a91d6300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880a91d6380: 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 20:38 linux-4.14.y e911713e40ca 97de9cfc .config console log report syz C [disk image] [vmlinux] [kernel image] ci2-linux-4-14 KASAN: use-after-free Read in fuse_copy_do
* Struck through repros no longer work on HEAD.