[syzbot] [crypto?] KMSAN: uninit-value in skcipher_walk_virt

16 views
Skip to first unread message

syzbot

unread,
May 3, 2024, 8:24:27 AMMay 3
to da...@davemloft.net, her...@gondor.apana.org.au, linux-...@vger.kernel.org, linux-...@vger.kernel.org, syzkall...@googlegroups.com
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: syzbot+97b444...@syzkaller.appspotmail.com

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

Aleksandr Nogikh

unread,
May 3, 2024, 8:34:46 AMMay 3
to syzbot, Kent Overstreet, da...@davemloft.net, her...@gondor.apana.org.au, linux-...@vger.kernel.org, linux-...@vger.kernel.org, syzkall...@googlegroups.com
#syz set subsystems: bcachefs
> --
> 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 syzkaller-bug...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/syzkaller-bugs/000000000000dcd2ae06178bccb0%40google.com.

syzbot

unread,
May 3, 2024, 10:41:09 AMMay 3
to n.zhand...@fintech.ru, linux-...@vger.kernel.org, n.zhand...@fintech.ru, syzkall...@googlegroups.com
> req->base.flags were not initialized, zero might suit in this case.
> Do it with skcipher_request_set_callback() as it's common practice.
>
> #syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

This crash does not have a reproducer. I cannot test it.

>
> ---
> fs/bcachefs/checksum.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/fs/bcachefs/checksum.c b/fs/bcachefs/checksum.c
> index 7ed779b411f6..088fd2e7bdf1 100644
> --- a/fs/bcachefs/checksum.c
> +++ b/fs/bcachefs/checksum.c
> @@ -102,6 +102,7 @@ static inline int do_encrypt_sg(struct crypto_sync_skcipher *tfm,
> int ret;
>
> skcipher_request_set_sync_tfm(req, tfm);
> + skcipher_request_set_callback(req, 0, NULL, NULL);
> skcipher_request_set_crypt(req, sg, sg, len, nonce.d);
>
> ret = crypto_skcipher_encrypt(req);

Nikita Zhandarovich

unread,
May 3, 2024, 10:41:09 AMMay 3
to syzbot+97b444...@syzkaller.appspotmail.com, Nikita Zhandarovich, syzkall...@googlegroups.com, linux-...@vger.kernel.org
req->base.flags were not initialized, zero might suit in this case.
Do it with skcipher_request_set_callback() as it's common practice.

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

Kent Overstreet

unread,
May 4, 2024, 1:32:20 PMMay 4
to Aleksandr Nogikh, syzbot, da...@davemloft.net, her...@gondor.apana.org.au, linux-...@vger.kernel.org, linux-...@vger.kernel.org, syzkall...@googlegroups.com
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?

Ard Biesheuvel

unread,
May 6, 2024, 6:52:44 AMMay 6
to Kent Overstreet, Aleksandr Nogikh, syzbot, da...@davemloft.net, her...@gondor.apana.org.au, linux-...@vger.kernel.org, linux-...@vger.kernel.org, syzkall...@googlegroups.com
On Sat, 4 May 2024 at 19:21, Kent Overstreet <kent.ov...@linux.dev> 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.
Reply all
Reply to author
Forward
0 new messages