syzbot


KASAN: use-after-free Read in fuse_copy_one

Status: upstream: reported C repro on 2022/11/15 14:31
Bug presence: origin:upstream
Labels: missing-backport
[Documentation on labels]
Reported-by: syzbot+fa07b4a72f8a92222f0b@syzkaller.appspotmail.com
First crash: 528d, last: 30d
Cause bisection: failed (error log, bisect log)
  
Bug presence (4)
Date Name Commit Repro Result
2023/09/15 android13-5.15-lts (ToT) ea586874d2f9 C [report] KASAN: use-after-free Read in fuse_copy_one
2023/05/03 lts (merge base) d86dfc4d95cd C [report] KASAN: use-after-free Read in fuse_copy_one
2023/05/03 upstream (ToT) 348551ddaf31 C [report] KASAN: slab-use-after-free Read in fuse_copy_args
2023/09/15 upstream (ToT) 9fdfb15a3dbf C Didn't crash
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 19d 528d 0/2 upstream: reported C repro on 2022/11/15 07:36
android-5-10 KASAN: use-after-free Read in fuse_copy_one C error inconclusive 1 528d 528d 0/2 auto-obsoleted due to no activity on 2023/05/17 19:00
Last patch testing requests (9)
Created Duration User Patch Repo Result
2023/04/11 13:51 17m tudor.ambarus@linaro.org git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 0d1409e4 report log
2023/04/07 11:00 16m tudor.ambarus@linaro.org git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git v6.1-rc1 report log
2023/04/07 10:43 8m tudor.ambarus@linaro.org git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git v6.0 report log
2023/04/07 08:53 22m tudor.ambarus@linaro.org git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git v5.19 report log
2023/04/07 08:21 8m tudor.ambarus@linaro.org git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git v5.17 report log
2023/04/06 08:37 9m tudor.ambarus@linaro.org git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git v5.15.106 report log
2022/12/20 15:19 11m tudor.ambarus@linaro.org android13-5.15-lts report log
2022/12/09 15:30 6m tudor.ambarus@linaro.org git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git linux-5.15.y report log
2022/12/09 15:30 16m tudor.ambarus@linaro.org upstream OK log
Fix bisection attempts (13)
Created Duration User Patch Repo Result
2024/03/27 11:22 51m bisect fix android13-5.15-lts job log (0) log
2024/02/26 06:08 58m bisect fix android13-5.15-lts job log (0) log
2024/01/18 23:24 39m bisect fix android13-5.15-lts job log (0) log
2023/12/19 07:05 1h18m bisect fix android13-5.15-lts job log (0) log
2023/11/19 01:30 1h29m bisect fix android13-5.15-lts job log (0) log
2023/10/18 04:37 39m bisect fix android13-5.15-lts job log (0) log
2023/09/07 04:38 1h16m bisect fix android13-5.15-lts job log (0) log
2023/07/05 10:09 1h12m bisect fix android13-5.15-lts job log (0) log
2023/06/02 01:42 17m bisect fix android13-5.15-lts job log (0) log
2023/05/02 06:11 18m bisect fix android13-5.15-lts job log (0) log
2023/04/02 02:48 17m bisect fix android13-5.15-lts job log (0) log
2023/03/03 01:29 1h18m bisect fix android13-5.15-lts job log (0) log
2023/01/31 17:01 23m bisect fix android13-5.15-lts job log (0) log

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in fuse_copy_one+0x1e7/0x3f0 fs/fuse/dev.c:1017
Read of size 256 at addr ffff88811f8ca010 by task syz-executor302/4941

CPU: 0 PID: 4941 Comm: syz-executor302 Not tainted 5.15.74-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x151/0x1b7 lib/dump_stack.c:106
 print_address_description+0x87/0x3d0 mm/kasan/report.c:256
 __kasan_report mm/kasan/report.c:435 [inline]
 kasan_report+0x1a6/0x1f0 mm/kasan/report.c:452
 kasan_check_range+0x2aa/0x2e0 mm/kasan/generic.c:189
 memcpy+0x2d/0x70 mm/kasan/shadow.c:65
 fuse_copy_one+0x1e7/0x3f0 fs/fuse/dev.c:1017
 fuse_copy_args+0x309/0x400 fs/fuse/dev.c:1035
 fuse_dev_do_read+0xc9b/0x1190 fs/fuse/dev.c:1310
 fuse_dev_read+0x180/0x210 fs/fuse/dev.c:1377
 call_read_iter include/linux/fs.h:2123 [inline]
 new_sync_read fs/read_write.c:404 [inline]
 vfs_read+0xabc/0xd80 fs/read_write.c:485
 ksys_read+0x198/0x2c0 fs/read_write.c:623
 __do_sys_read fs/read_write.c:633 [inline]
 __se_sys_read fs/read_write.c:631 [inline]
 __x64_sys_read+0x7b/0x90 fs/read_write.c:631
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7f589d294bc9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 41 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:00007f589d1e22f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
RAX: ffffffffffffffda RBX: 00007f589d3264f0 RCX: 00007f589d294bc9
RDX: 0000000000002020 RSI: 0000000020002140 RDI: 0000000000000003
RBP: 00007f589d2f3284 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f589d2ed160
R13: 00007f589d2ef278 R14: 00007f589d2f1280 R15: 00007f589d3264f8
 </TASK>

Allocated by task 4923:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:45 [inline]
 set_alloc_info mm/kasan/common.c:433 [inline]
 ____kasan_kmalloc+0xdc/0x110 mm/kasan/common.c:512
 __kasan_kmalloc+0x9/0x10 mm/kasan/common.c:521
 kasan_kmalloc include/linux/kasan.h:254 [inline]
 __kmalloc+0x203/0x350 mm/slub.c:4423
 kmalloc include/linux/slab.h:596 [inline]
 __d_alloc+0xab/0x6b0 fs/dcache.c:1760
 d_alloc fs/dcache.c:1823 [inline]
 d_alloc_parallel+0xe0/0x12b0 fs/dcache.c:2575
 __lookup_slow+0x14e/0x400 fs/namei.c:1644
 lookup_slow+0x5a/0x80 fs/namei.c:1676
 walk_component+0x425/0x5a0 fs/namei.c:1972
 lookup_last fs/namei.c:2427 [inline]
 path_lookupat+0x18d/0x460 fs/namei.c:2451
 filename_lookup+0x277/0x640 fs/namei.c:2480
 user_path_at_empty+0x44/0x1b0 fs/namei.c:2853
 user_path_at include/linux/namei.h:57 [inline]
 do_mount fs/namespace.c:3334 [inline]
 __do_sys_mount fs/namespace.c:3545 [inline]
 __se_sys_mount+0x293/0x3c0 fs/namespace.c:3522
 __x64_sys_mount+0xbf/0xd0 fs/namespace.c:3522
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

Freed by task 20:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4c/0x70 mm/kasan/common.c:45
 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:370
 ____kasan_slab_free+0x126/0x160 mm/kasan/common.c:365
 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:373
 kasan_slab_free include/linux/kasan.h:220 [inline]
 slab_free_hook mm/slub.c:1721 [inline]
 slab_free_freelist_hook+0xc9/0x1a0 mm/slub.c:1747
 slab_free mm/slub.c:3515 [inline]
 kmem_cache_free_bulk+0x3dc/0x720 mm/slub.c:3656
 kfree_bulk include/linux/slab.h:448 [inline]
 kfree_rcu_work+0x2cb/0x6c0 kernel/rcu/tree.c:3281
 process_one_work+0x6db/0xc00 kernel/workqueue.c:2313
 worker_thread+0xb3e/0x1340 kernel/workqueue.c:2460
 kthread+0x41c/0x500 kernel/kthread.c:319
 ret_from_fork+0x1f/0x30

Last potentially related work creation:
 kasan_save_stack+0x3b/0x60 mm/kasan/common.c:38
 __kasan_record_aux_stack+0xd3/0xf0 mm/kasan/generic.c:348
 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:358
 kvfree_call_rcu+0xb2/0x7f0 kernel/rcu/tree.c:3558
 copy_name fs/dcache.c:2844 [inline]
 __d_move+0xb3e/0x16d0 fs/dcache.c:2907
 __d_unalias+0x1cc/0x220 fs/dcache.c:3021
 d_splice_alias+0x22f/0x3b0 fs/dcache.c:3084
 fuse_lookup+0x2b4/0x5f0 fs/fuse/dir.c:478
 __lookup_slow+0x2b3/0x400 fs/namei.c:1659
 lookup_slow+0x5a/0x80 fs/namei.c:1676
 walk_component+0x425/0x5a0 fs/namei.c:1972
 link_path_walk+0x682/0xde0
 path_parentat fs/namei.c:2498 [inline]
 filename_parentat+0x27e/0x6b0 fs/namei.c:2521
 filename_create+0xef/0x4f0 fs/namei.c:3689
 do_mkdirat+0xc2/0x420 fs/namei.c:3952
 __do_sys_mkdir fs/namei.c:3983 [inline]
 __se_sys_mkdir fs/namei.c:3981 [inline]
 __x64_sys_mkdir+0x6e/0x80 fs/namei.c:3981
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

Second to last potentially related work creation:
 kasan_save_stack+0x3b/0x60 mm/kasan/common.c:38
 __kasan_record_aux_stack+0xd3/0xf0 mm/kasan/generic.c:348
 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:358
 kvfree_call_rcu+0xb2/0x7f0 kernel/rcu/tree.c:3558
 copy_name fs/dcache.c:2844 [inline]
 __d_move+0xb3e/0x16d0 fs/dcache.c:2907
 __d_unalias+0x1cc/0x220 fs/dcache.c:3021
 d_splice_alias+0x22f/0x3b0 fs/dcache.c:3084
 fuse_lookup+0x2b4/0x5f0 fs/fuse/dir.c:478
 __lookup_slow+0x2b3/0x400 fs/namei.c:1659
 lookup_slow+0x5a/0x80 fs/namei.c:1676
 walk_component+0x425/0x5a0 fs/namei.c:1972
 link_path_walk+0x682/0xde0
 path_parentat fs/namei.c:2498 [inline]
 filename_parentat+0x27e/0x6b0 fs/namei.c:2521
 filename_create+0xef/0x4f0 fs/namei.c:3689
 do_mkdirat+0xc2/0x420 fs/namei.c:3952
 __do_sys_mkdir fs/namei.c:3983 [inline]
 __se_sys_mkdir fs/namei.c:3981 [inline]
 __x64_sys_mkdir+0x6e/0x80 fs/namei.c:3981
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

The buggy address belongs to the object at ffff88811f8ca000
 which belongs to the cache kmalloc-rcl-512 of size 512
The buggy address is located 16 bytes inside of
 512-byte region [ffff88811f8ca000, ffff88811f8ca200)
The buggy address belongs to the page:
page:ffffea00047e3200 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88811f8c9000 pfn:0x11f8c8
head:ffffea00047e3200 order:2 compound_mapcount:0 compound_pincount:0
flags: 0x4000000000010200(slab|head|zone=1)
raw: 4000000000010200 ffffea00047e8700 0000000400000004 ffff88810004c300
raw: ffff88811f8c9000 000000008010000b 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), pid 1972, ts 1087064259248, free_ts 0
 set_page_owner include/linux/page_owner.h:33 [inline]
 post_alloc_hook+0x1ab/0x1b0 mm/page_alloc.c:2495
 prep_new_page mm/page_alloc.c:2501 [inline]
 get_page_from_freelist+0x38b/0x400 mm/page_alloc.c:4281
 __alloc_pages+0x3a8/0x7c0 mm/page_alloc.c:5548
 allocate_slab+0x62/0x580 mm/slub.c:1928
 new_slab mm/slub.c:1991 [inline]
 ___slab_alloc+0x2e2/0x6f0 mm/slub.c:3024
 __slab_alloc+0x4a/0x90 mm/slub.c:3111
 slab_alloc_node mm/slub.c:3202 [inline]
 slab_alloc mm/slub.c:3244 [inline]
 __kmalloc+0x25b/0x350 mm/slub.c:4419
 kmalloc include/linux/slab.h:596 [inline]
 __d_alloc+0xab/0x6b0 fs/dcache.c:1760
 d_alloc fs/dcache.c:1823 [inline]
 d_alloc_parallel+0xe0/0x12b0 fs/dcache.c:2575
 __lookup_slow+0x14e/0x400 fs/namei.c:1644
 lookup_slow+0x5a/0x80 fs/namei.c:1676
 walk_component+0x425/0x5a0 fs/namei.c:1972
 lookup_last fs/namei.c:2427 [inline]
 path_lookupat+0x18d/0x460 fs/namei.c:2451
 filename_lookup+0x277/0x640 fs/namei.c:2480
 user_path_at_empty+0x44/0x1b0 fs/namei.c:2853
 user_path_at include/linux/namei.h:57 [inline]
 vfs_statx+0x104/0x6a0 fs/stat.c:221
page_owner free stack trace missing

Memory state around the buggy address:
 ffff88811f8c9f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88811f8c9f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88811f8ca000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                         ^
 ffff88811f8ca080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88811f8ca100: 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 14:30 android13-5.15-lts 7f2e600bf63a 97de9cfc .config console log report syz C [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Read in fuse_copy_one
* Struck through repros no longer work on HEAD.