2024-05-03 12:34:52

by Aleksandr Nogikh

[permalink] [raw]
Subject: Re: [syzbot] [crypto?] KMSAN: uninit-value in skcipher_walk_virt

#syz set subsystems: bcachefs

On Fri, May 3, 2024 at 2:24 PM syzbot
<[email protected]> wrote:
>
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: f03359bca01b Merge tag 'for-6.9-rc6-tag' of git://git.kern..
> git tree: upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=17c169df180000
> kernel config: https://syzkaller.appspot.com/x/.config?x=bbf567496022057b
> dashboard link: https://syzkaller.appspot.com/bug?extid=97b4444a5bd7bf30b3a8
> compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
> userspace arch: i386
>
> Unfortunately, I don't have any reproducer for this issue yet.
>
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/b345b1c01095/disk-f03359bc.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/d59970ea319e/vmlinux-f03359bc.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/47407f406f40/bzImage-f03359bc.xz
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: [email protected]
>
> loop3: detected capacity change from 0 to 32768
> bcachefs (loop3): mounting version 1.7: mi_btree_bitmap opts=metadata_checksum=none,data_checksum=none,nojournal_transaction_names
> bcachefs (loop3): recovering from clean shutdown, journal seq 10
> =====================================================
> BUG: KMSAN: uninit-value in skcipher_walk_virt+0x91/0x1a0 crypto/skcipher.c:504
> skcipher_walk_virt+0x91/0x1a0 crypto/skcipher.c:504
> chacha_stream_xor+0x7c/0x710 crypto/chacha_generic.c:22
> crypto_chacha_crypt+0x79/0xb0 crypto/chacha_generic.c:45
> crypto_skcipher_encrypt+0x1a0/0x1e0 crypto/skcipher.c:671
> do_encrypt_sg fs/bcachefs/checksum.c:107 [inline]
> do_encrypt+0x99c/0xc30 fs/bcachefs/checksum.c:127
> gen_poly_key fs/bcachefs/checksum.c:190 [inline]
> bch2_checksum+0x21f/0x7c0 fs/bcachefs/checksum.c:226
> bch2_btree_node_read_done+0x1898/0x75e0 fs/bcachefs/btree_io.c:1055
> btree_node_read_work+0x8a5/0x1eb0 fs/bcachefs/btree_io.c:1324
> bch2_btree_node_read+0x3d42/0x4b50
> __bch2_btree_root_read fs/bcachefs/btree_io.c:1748 [inline]
> bch2_btree_root_read+0xa6c/0x13d0 fs/bcachefs/btree_io.c:1772
> read_btree_roots+0x454/0xee0 fs/bcachefs/recovery.c:457
> bch2_fs_recovery+0x7adb/0x9310 fs/bcachefs/recovery.c:785
> bch2_fs_start+0x7b2/0xbd0 fs/bcachefs/super.c:1043
> bch2_fs_open+0x135f/0x1670 fs/bcachefs/super.c:2102
> bch2_mount+0x90d/0x1d90 fs/bcachefs/fs.c:1903
> legacy_get_tree+0x114/0x290 fs/fs_context.c:662
> vfs_get_tree+0xa7/0x570 fs/super.c:1779
> do_new_mount+0x71f/0x15e0 fs/namespace.c:3352
> path_mount+0x742/0x1f20 fs/namespace.c:3679
> do_mount fs/namespace.c:3692 [inline]
> __do_sys_mount fs/namespace.c:3898 [inline]
> __se_sys_mount+0x725/0x810 fs/namespace.c:3875
> __ia32_sys_mount+0xe3/0x150 fs/namespace.c:3875
> ia32_sys_call+0x3a9a/0x40a0 arch/x86/include/generated/asm/syscalls_32.h:22
> do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline]
> __do_fast_syscall_32+0xb4/0x120 arch/x86/entry/common.c:386
> do_fast_syscall_32+0x38/0x80 arch/x86/entry/common.c:411
> do_SYSENTER_32+0x1f/0x30 arch/x86/entry/common.c:449
> entry_SYSENTER_compat_after_hwframe+0x84/0x8e
>
> Local variable __req_desc.i created at:
> do_encrypt_sg fs/bcachefs/checksum.c:101 [inline]
> do_encrypt+0x8f9/0xc30 fs/bcachefs/checksum.c:127
> gen_poly_key fs/bcachefs/checksum.c:190 [inline]
> bch2_checksum+0x21f/0x7c0 fs/bcachefs/checksum.c:226
>
> CPU: 1 PID: 15218 Comm: syz-executor.3 Not tainted 6.9.0-rc6-syzkaller-00131-gf03359bca01b #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
> =====================================================
>
>
> ---
> 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 [email protected].
>
> 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 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
>
> --
> You received this message because you are subscribed to the Google Groups "syzkaller-bugs" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/msgid/syzkaller-bugs/000000000000dcd2ae06178bccb0%40google.com.


2024-05-04 17:21:06

by Kent Overstreet

[permalink] [raw]
Subject: Re: [syzbot] [crypto?] KMSAN: uninit-value in skcipher_walk_virt

This is odd - it seems to be req->base.flags that's uninitialized, and I
can't find the code that's supposed to be initializing it - but bcachefs
usage seems to be the same as all the other uses I'm looking at; if it
is req->base.flags then other code must be buggy as well?

On Fri, May 03, 2024 at 02:34:30PM +0200, Aleksandr Nogikh wrote:
> #syz set subsystems: bcachefs
>
> On Fri, May 3, 2024 at 2:24 PM syzbot
> <[email protected]> wrote:
> >
> > Hello,
> >
> > syzbot found the following issue on:
> >
> > HEAD commit: f03359bca01b Merge tag 'for-6.9-rc6-tag' of git://git.kern..
> > git tree: upstream
> > console output: https://syzkaller.appspot.com/x/log.txt?x=17c169df180000
> > kernel config: https://syzkaller.appspot.com/x/.config?x=bbf567496022057b
> > dashboard link: https://syzkaller.appspot.com/bug?extid=97b4444a5bd7bf30b3a8
> > compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
> > userspace arch: i386
> >
> > Unfortunately, I don't have any reproducer for this issue yet.
> >
> > Downloadable assets:
> > disk image: https://storage.googleapis.com/syzbot-assets/b345b1c01095/disk-f03359bc.raw.xz
> > vmlinux: https://storage.googleapis.com/syzbot-assets/d59970ea319e/vmlinux-f03359bc.xz
> > kernel image: https://storage.googleapis.com/syzbot-assets/47407f406f40/bzImage-f03359bc.xz
> >
> > IMPORTANT: if you fix the issue, please add the following tag to the commit:
> > Reported-by: [email protected]
> >
> > loop3: detected capacity change from 0 to 32768
> > bcachefs (loop3): mounting version 1.7: mi_btree_bitmap opts=metadata_checksum=none,data_checksum=none,nojournal_transaction_names
> > bcachefs (loop3): recovering from clean shutdown, journal seq 10
> > =====================================================
> > BUG: KMSAN: uninit-value in skcipher_walk_virt+0x91/0x1a0 crypto/skcipher.c:504
> > skcipher_walk_virt+0x91/0x1a0 crypto/skcipher.c:504
> > chacha_stream_xor+0x7c/0x710 crypto/chacha_generic.c:22
> > crypto_chacha_crypt+0x79/0xb0 crypto/chacha_generic.c:45
> > crypto_skcipher_encrypt+0x1a0/0x1e0 crypto/skcipher.c:671
> > do_encrypt_sg fs/bcachefs/checksum.c:107 [inline]
> > do_encrypt+0x99c/0xc30 fs/bcachefs/checksum.c:127
> > gen_poly_key fs/bcachefs/checksum.c:190 [inline]
> > bch2_checksum+0x21f/0x7c0 fs/bcachefs/checksum.c:226
> > bch2_btree_node_read_done+0x1898/0x75e0 fs/bcachefs/btree_io.c:1055
> > btree_node_read_work+0x8a5/0x1eb0 fs/bcachefs/btree_io.c:1324
> > bch2_btree_node_read+0x3d42/0x4b50
> > __bch2_btree_root_read fs/bcachefs/btree_io.c:1748 [inline]
> > bch2_btree_root_read+0xa6c/0x13d0 fs/bcachefs/btree_io.c:1772
> > read_btree_roots+0x454/0xee0 fs/bcachefs/recovery.c:457
> > bch2_fs_recovery+0x7adb/0x9310 fs/bcachefs/recovery.c:785
> > bch2_fs_start+0x7b2/0xbd0 fs/bcachefs/super.c:1043
> > bch2_fs_open+0x135f/0x1670 fs/bcachefs/super.c:2102
> > bch2_mount+0x90d/0x1d90 fs/bcachefs/fs.c:1903
> > legacy_get_tree+0x114/0x290 fs/fs_context.c:662
> > vfs_get_tree+0xa7/0x570 fs/super.c:1779
> > do_new_mount+0x71f/0x15e0 fs/namespace.c:3352
> > path_mount+0x742/0x1f20 fs/namespace.c:3679
> > do_mount fs/namespace.c:3692 [inline]
> > __do_sys_mount fs/namespace.c:3898 [inline]
> > __se_sys_mount+0x725/0x810 fs/namespace.c:3875
> > __ia32_sys_mount+0xe3/0x150 fs/namespace.c:3875
> > ia32_sys_call+0x3a9a/0x40a0 arch/x86/include/generated/asm/syscalls_32.h:22
> > do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline]
> > __do_fast_syscall_32+0xb4/0x120 arch/x86/entry/common.c:386
> > do_fast_syscall_32+0x38/0x80 arch/x86/entry/common.c:411
> > do_SYSENTER_32+0x1f/0x30 arch/x86/entry/common.c:449
> > entry_SYSENTER_compat_after_hwframe+0x84/0x8e
> >
> > Local variable __req_desc.i created at:
> > do_encrypt_sg fs/bcachefs/checksum.c:101 [inline]
> > do_encrypt+0x8f9/0xc30 fs/bcachefs/checksum.c:127
> > gen_poly_key fs/bcachefs/checksum.c:190 [inline]
> > bch2_checksum+0x21f/0x7c0 fs/bcachefs/checksum.c:226
> >
> > CPU: 1 PID: 15218 Comm: syz-executor.3 Not tainted 6.9.0-rc6-syzkaller-00131-gf03359bca01b #0
> > Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
> > =====================================================
> >
> >
> > ---
> > 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 [email protected].
> >
> > 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 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
> >
> > --
> > You received this message because you are subscribed to the Google Groups "syzkaller-bugs" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
> > To view this discussion on the web visit https://groups.google.com/d/msgid/syzkaller-bugs/000000000000dcd2ae06178bccb0%40google.com.

2024-05-06 10:52:46

by Ard Biesheuvel

[permalink] [raw]
Subject: Re: [syzbot] [crypto?] KMSAN: uninit-value in skcipher_walk_virt

On Sat, 4 May 2024 at 19:21, Kent Overstreet <[email protected]> wrote:
>
> This is odd - it seems to be req->base.flags that's uninitialized, and I
> can't find the code that's supposed to be initializing it - but bcachefs
> usage seems to be the same as all the other uses I'm looking at; if it
> is req->base.flags then other code must be buggy as well?
>

You seem to be missing a call to

skcipher_request_set_callback()

which initializes some (irrelevant in this case) async related fields
but also the flags field.