syzbot


KASAN: null-ptr-deref Read in fuse_copy_do

Status: upstream: reported C repro on 2024/11/27 18:04
Subsystems: fuse
[Documentation on labels]
Reported-by: syzbot+87b8e6ed25dbc41759f7@syzkaller.appspotmail.com
Fix commit: fuse: Set *nbytesp=0 in fuse_get_user_pages on allocation failure
Patched on: [ci-upstream-linux-next-kasan-gce-root], missing on: [ci-qemu-gce-upstream-auto ci-qemu-native-arm64-kvm ci-qemu-upstream ci-qemu-upstream-386 ci-qemu2-arm32 ci-qemu2-arm64 ci-qemu2-arm64-compat ci-qemu2-arm64-mte ci-qemu2-riscv64 ci-snapshot-upstream-root ci-upstream-bpf-kasan-gce ci-upstream-bpf-next-kasan-gce ci-upstream-gce-arm64 ci-upstream-gce-leak ci-upstream-kasan-badwrites-root ci-upstream-kasan-gce ci-upstream-kasan-gce-386 ci-upstream-kasan-gce-root ci-upstream-kasan-gce-selinux-root ci-upstream-kasan-gce-smack-root ci-upstream-kmsan-gce-386-root ci-upstream-kmsan-gce-root ci-upstream-net-kasan-gce ci-upstream-net-this-kasan-gce ci2-upstream-fs ci2-upstream-kcsan-gce ci2-upstream-usb]
First crash: 24d, last: 14d
Cause bisection: introduced by (bisect log) :
commit 3b97c3652d9128ab7f8c9b8adec6108611fdb153
Author: Joanne Koong <joannelkoong@gmail.com>
Date: Thu Oct 24 17:18:08 2024 +0000

  fuse: convert direct io to use folios

Crash: KASAN: null-ptr-deref Write in fuse_copy_do (log)
Repro: C syz .config
  
Discussions (4)
Title Replies (including bot) Last reply
[PATCH v2] fuse: Set *nbytesp=0 in fuse_get_user_pages on allocation failure 2 (2) 2024/12/03 04:57
[PATCH] fuse: Set *nbytesp=0 in fuse_get_user_pages on allocation failure 3 (3) 2024/12/02 23:04
[PATCH] fuse: add a null-ptr check 7 (7) 2024/12/02 22:26
[syzbot] [fuse?] KASAN: null-ptr-deref Read in fuse_copy_do 0 (4) 2024/12/02 21:01
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 KASAN: use-after-free Read in fuse_copy_do C 1 663d 766d 0/1 upstream: reported C repro on 2022/11/15 20:38
linux-4.19 KASAN: use-after-free Read in fuse_copy_do C error 1 767d 767d 0/1 upstream: reported C repro on 2022/11/15 07:48
Last patch testing requests (2)
Created Duration User Patch Repo Result
2024/12/02 21:01 1h26m bernd.schubert@fastmail.fm https://github.com/bsbernd/linux folio-syzbot-debug report log
2024/11/29 19:34 2h15m niharchaithanya@gmail.com patch upstream OK log

Sample crash report:
==================================================================
BUG: KASAN: null-ptr-deref in fuse_copy_do+0x183/0x320 fs/fuse/dev.c:809
Write of size 5 at addr 0000000000000000 by task syz-executor159/5840

CPU: 0 UID: 0 PID: 5840 Comm: syz-executor159 Not tainted 6.12.0-syzkaller-09734-g445d9f05fa14 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:94 [inline]
 dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120
 kasan_report+0xd9/0x110 mm/kasan/report.c:602
 check_region_inline mm/kasan/generic.c:183 [inline]
 kasan_check_range+0xef/0x1a0 mm/kasan/generic.c:189
 __asan_memcpy+0x3c/0x60 mm/kasan/shadow.c:106
 fuse_copy_do+0x183/0x320 fs/fuse/dev.c:809
 fuse_copy_one fs/fuse/dev.c:1065 [inline]
 fuse_copy_args+0x1e6/0x770 fs/fuse/dev.c:1083
 copy_out_args fs/fuse/dev.c:1966 [inline]
 fuse_dev_do_write+0x1cc1/0x3720 fs/fuse/dev.c:2052
 fuse_dev_write+0x14f/0x1e0 fs/fuse/dev.c:2087
 new_sync_write fs/read_write.c:586 [inline]
 vfs_write+0x5ae/0x1150 fs/read_write.c:679
 ksys_write+0x12b/0x250 fs/read_write.c:731
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fa4c9df3c0f
Code: 89 54 24 18 48 89 74 24 10 89 7c 24 08 e8 89 5e 02 00 48 8b 54 24 18 48 8b 74 24 10 41 89 c0 8b 7c 24 08 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 31 44 89 c7 48 89 44 24 08 e8 dc 5e 02 00 48
RSP: 002b:00007fa4c9da71e0 EFLAGS: 00000293 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007fa4c9e7f3e8 RCX: 00007fa4c9df3c0f
RDX: 0000000000000015 RSI: 0000000020000540 RDI: 0000000000000003
RBP: 00007fa4c9e7f3e0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000293 R12: 00007fa4c9e4c33c
R13: 00007fa4c9e44027 R14: 00007fff3bcf2380 R15: 00007fa4c9e4a338
 </TASK>
==================================================================

Crashes (8):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/11/27 15:19 upstream 445d9f05fa14 52b38cc1 .config strace log report syz / log C [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root KASAN: null-ptr-deref Write in fuse_copy_do
2024/12/04 23:39 upstream feffde684ac2 b50eb251 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root KASAN: null-ptr-deref Read in fuse_copy_do
2024/11/30 01:04 upstream 509f806f7f70 68914665 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root KASAN: null-ptr-deref Read in fuse_copy_do
2024/11/28 12:33 upstream b86545e02e8c 5df23865 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root KASAN: null-ptr-deref Read in fuse_copy_do
2024/11/27 10:21 upstream 445d9f05fa14 52b38cc1 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root KASAN: null-ptr-deref Read in fuse_copy_do
2024/12/06 16:06 upstream b8f52214c61a 9ac0fdc6 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: null-ptr-deref Read in fuse_copy_do
2024/11/27 01:09 upstream 445d9f05fa14 52b38cc1 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: null-ptr-deref Read in fuse_copy_do
2024/11/27 14:24 upstream 445d9f05fa14 52b38cc1 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root KASAN: null-ptr-deref Write in fuse_copy_do
* Struck through repros no longer work on HEAD.