[syzbot] [fuse?] KASAN: null-ptr-deref Read in fuse_copy_do

14 views
Skip to first unread message

syzbot

unread,
Nov 27, 2024, 1:04:23 PM11/27/24
to linux-...@vger.kernel.org, linux-...@vger.kernel.org, mik...@szeredi.hu, syzkall...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 445d9f05fa14 Merge tag 'nfsd-6.13' of git://git.kernel.org..
git tree: upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=12733530580000
kernel config: https://syzkaller.appspot.com/x/.config?x=3c44a32edb32752c
dashboard link: https://syzkaller.appspot.com/bug?extid=87b8e6ed25dbc41759f7
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=11fd43c0580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=15cf2f5f980000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/9fd8dd2a6550/disk-445d9f05.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/af034d90afcb/vmlinux-445d9f05.xz
kernel image: https://storage.googleapis.com/syzbot-assets/07a713832258/bzImage-445d9f05.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+87b8e6...@syzkaller.appspotmail.com

==================================================================
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>
==================================================================


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

syzbot

unread,
Nov 29, 2024, 2:00:05 AM11/29/24
to joanne...@gmail.com, jo...@toxicpanda.com, linux-...@vger.kernel.org, linux-...@vger.kernel.org, mik...@szeredi.hu, msze...@redhat.com, syzkall...@googlegroups.com
syzbot has bisected this issue to:

commit 3b97c3652d9128ab7f8c9b8adec6108611fdb153
Author: Joanne Koong <joanne...@gmail.com>
Date: Thu Oct 24 17:18:08 2024 +0000

fuse: convert direct io to use folios

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=1648df5f980000
start commit: 445d9f05fa14 Merge tag 'nfsd-6.13' of git://git.kernel.org..
git tree: upstream
final oops: https://syzkaller.appspot.com/x/report.txt?x=1548df5f980000
console output: https://syzkaller.appspot.com/x/log.txt?x=1148df5f980000
Reported-by: syzbot+87b8e6...@syzkaller.appspotmail.com
Fixes: 3b97c3652d91 ("fuse: convert direct io to use folios")

For information about bisection process see: https://goo.gl/tpsmEJ#bisection

Nihar Chaithanya

unread,
Nov 29, 2024, 2:34:13 PM11/29/24
to syzbot+87b8e6...@syzkaller.appspotmail.com, syzkall...@googlegroups.com
#syz test
0002-fuse-add-a-null-ptr-check.patch

syzbot

unread,
Nov 29, 2024, 4:50:03 PM11/29/24
to linux-...@vger.kernel.org, niharch...@gmail.com, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-by: syzbot+87b8e6...@syzkaller.appspotmail.com
Tested-by: syzbot+87b8e6...@syzkaller.appspotmail.com

Tested on:

commit: 2eff01ee Merge tag 'char-misc-6.13-rc1' of git://git.k..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=111119e8580000
kernel config: https://syzkaller.appspot.com/x/.config?x=92c00fea95836451
dashboard link: https://syzkaller.appspot.com/bug?extid=87b8e6ed25dbc41759f7
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=12dc19e8580000

Note: testing is done by a robot and is best-effort only.

syzbot

unread,
Dec 2, 2024, 4:02:00 PM12/2/24
to linux-...@vger.kernel.org, syzkall...@googlegroups.com
For archival purposes, forwarding an incoming command email to
linux-...@vger.kernel.org, syzkall...@googlegroups.com.

***

Subject: Re: [syzbot] [fuse?] KASAN: null-ptr-deref Read in fuse_copy_do
Author: bernd.s...@fastmail.fm

#syz test: https://github.com/bsbernd/linux folio-syzbot-debug

syzbot

unread,
Dec 2, 2024, 5:32:05 PM12/2/24
to bernd.s...@fastmail.fm, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
kernel BUG in fuse_copy_do

fuse: *val=0000000000000000 buf=ffff88807d82c550, cs->write=0 op-code=15
------------[ cut here ]------------
kernel BUG at fs/fuse/dev.c:810!
Oops: invalid opcode: 0000 [#1] PREEMPT SMP KASAN NOPTI
CPU: 1 UID: 0 PID: 6694 Comm: syz.0.15 Not tainted 6.13.0-rc1-syzkaller-g4e968a4c8fcf #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
RIP: 0010:fuse_copy_do+0x334/0x3d0 fs/fuse/dev.c:810
Code: 74 05 e8 7f f8 f5 fe 8b 6b 3c e8 67 10 93 fe 8b 4c 24 0c 41 89 e8 4c 89 fe 48 8b 14 24 48 c7 c7 40 05 a9 8b e8 6d 48 72 fe 90 <0f> 0b 48 8b 7c 24 10 e8 50 f8 f5 fe e9 2e fd ff ff 48 89 df e8 43
RSP: 0018:ffffc90003407898 EFLAGS: 00010286
RAX: 0000000000000048 RBX: ffff8880249eb220 RCX: ffffffff81794fa9
RDX: 0000000000000000 RSI: ffffffff8179f976 RDI: 0000000000000005
RBP: 000000000000000f R08: 0000000000000005 R09: 0000000000000000
R10: 0000000080000000 R11: 0000000000000001 R12: ffffc90003407978
R13: ffffc90003407ca4 R14: ffffc90003407c60 R15: 0000000000000000
FS: 00007feebcbfe6c0(0000) GS:ffff8880b8700000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000000002000a000 CR3: 0000000037394000 CR4: 00000000003526f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
fuse_copy_one fs/fuse/dev.c:1072 [inline]
fuse_copy_args+0x1e6/0x770 fs/fuse/dev.c:1090
copy_out_args fs/fuse/dev.c:1973 [inline]
fuse_dev_do_write+0x1cc1/0x3720 fs/fuse/dev.c:2059
fuse_dev_write+0x14f/0x1e0 fs/fuse/dev.c:2094
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:0x7feebd97f2bf
Code: 89 54 24 18 48 89 74 24 10 89 7c 24 08 e8 f9 8d 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 4c 8e 02 00 48
RSP: 002b:00007feebcbfdfd0 EFLAGS: 00000293 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 0000000020008380 RCX: 00007feebd97f2bf
RDX: 0000000000000015 RSI: 0000000020000540 RDI: 0000000000000003
RBP: 0000000000000050 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000003 R11: 0000000000000293 R12: 0000000000000003
R13: 0000000020000c40 R14: 00007feebdb45fa0 R15: 00007fff5d43f8a8
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:fuse_copy_do+0x334/0x3d0 fs/fuse/dev.c:810
Code: 74 05 e8 7f f8 f5 fe 8b 6b 3c e8 67 10 93 fe 8b 4c 24 0c 41 89 e8 4c 89 fe 48 8b 14 24 48 c7 c7 40 05 a9 8b e8 6d 48 72 fe 90 <0f> 0b 48 8b 7c 24 10 e8 50 f8 f5 fe e9 2e fd ff ff 48 89 df e8 43
RSP: 0018:ffffc90003407898 EFLAGS: 00010286
RAX: 0000000000000048 RBX: ffff8880249eb220 RCX: ffffffff81794fa9
RDX: 0000000000000000 RSI: ffffffff8179f976 RDI: 0000000000000005
RBP: 000000000000000f R08: 0000000000000005 R09: 0000000000000000
R10: 0000000080000000 R11: 0000000000000001 R12: ffffc90003407978
R13: ffffc90003407ca4 R14: ffffc90003407c60 R15: 0000000000000000
FS: 00007feebcbfe6c0(0000) GS:ffff8880b8700000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000000002000a000 CR3: 0000000037394000 CR4: 00000000003526f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400


Tested on:

commit: 4e968a4c debug folio conversion null ptr
git tree: https://github.com/bsbernd/linux folio-syzbot-debug
console output: https://syzkaller.appspot.com/x/log.txt?x=114a2fc0580000
kernel config: https://syzkaller.appspot.com/x/.config?x=6851fe4f61792030
dashboard link: https://syzkaller.appspot.com/bug?extid=87b8e6ed25dbc41759f7
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40

Note: no patches were applied.
Reply all
Reply to author
Forward
0 new messages