linux-nilfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ryusuke Konishi <konishi.ryusuke-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Dipanjan Das <mail.dipanjan.das-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: linux-nilfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Linux Kernel Mailing List
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	syzkaller <syzkaller-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>,
	Marius Fleischer
	<fleischermarius-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>,
	Priyanka Bose
	<its.priyanka.bose-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: Re: KMSAN: uninit-value in nilfs_add_checksums_on_logs
Date: Fri, 17 Feb 2023 01:16:54 +0900	[thread overview]
Message-ID: <CAKFNMon+3JGp9MZ6gugkkDFUqbWgXKEO9JecjEhuUMoeXYQnqw@mail.gmail.com> (raw)
In-Reply-To: <CANX2M5bVbzRi6zH3PTcNE_31TzerstOXUa9Bay4E6y6dX23_pg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Thu, Feb 16, 2023 at 11:43 AM Dipanjan Das wrote:
>
> Hi,
>
> We would like to report the following bug which has been found by our
> modified version of syzkaller.
>
> ======================================================
> description: KMSAN: uninit-value in nilfs_add_checksums_on_logs
> affected file: fs/nilfs2/segbuf.c
> kernel version: 6.2.0-rc5
> kernel commit: 41c66f47061608dc1fd493eebce198f0e74cc2d7
> git tree: kmsan
> kernel config: https://syzkaller.appspot.com/text?tag=KernelConfig&x=a9a22da1efde3af6
> crash reproducer: attached
> ======================================================
> Crash log:
> ======================================================
> NILFS (loop4): segctord starting. Construction interval = 5 seconds,
> CP frequency < 30 seconds
> =====================================================
> BUG: KMSAN: uninit-value in crc32_body lib/crc32.c:112 [inline]
> BUG: KMSAN: uninit-value in crc32_le_generic lib/crc32.c:179 [inline]
> BUG: KMSAN: uninit-value in crc32_le_base+0x3b7/0xc30 lib/crc32.c:197
>  crc32_body lib/crc32.c:112 [inline]
>  crc32_le_generic lib/crc32.c:179 [inline]
>  crc32_le_base+0x3b7/0xc30 lib/crc32.c:197
>  nilfs_segbuf_fill_in_data_crc fs/nilfs2/segbuf.c:208 [inline]
>  nilfs_add_checksums_on_logs+0x6ec/0xea0 fs/nilfs2/segbuf.c:321
>  nilfs_segctor_do_construct+0xa636/0xe870 fs/nilfs2/segment.c:2076
>  nilfs_segctor_construct+0x222/0xe10 fs/nilfs2/segment.c:2379
>  nilfs_segctor_thread_construct fs/nilfs2/segment.c:2487 [inline]
>  nilfs_segctor_thread+0xc19/0x11c0 fs/nilfs2/segment.c:2570
>  kthread+0x30b/0x420 kernel/kthread.c:376
>  ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308
>
> Uninit was created at:
>  __alloc_pages+0x767/0xee0 mm/page_alloc.c:5572
>  alloc_pages+0xa9a/0xd90 mm/mempolicy.c:2286
>  folio_alloc+0x41/0x100 mm/mempolicy.c:2296
>  filemap_alloc_folio+0xa5/0x450 mm/filemap.c:972
>  __filemap_get_folio+0xe7c/0x1960 mm/filemap.c:1966
>  pagecache_get_page+0x46/0x270 mm/folio-compat.c:98
>  find_or_create_page include/linux/pagemap.h:612 [inline]
>  grow_dev_page fs/buffer.c:946 [inline]
>  grow_buffers fs/buffer.c:1011 [inline]
>  __getblk_slow fs/buffer.c:1038 [inline]
>  __getblk_gfp+0x365/0x1750 fs/buffer.c:1333
>  sb_getblk include/linux/buffer_head.h:356 [inline]
>  nilfs_segbuf_extend_segsum fs/nilfs2/segbuf.c:99 [inline]
>  nilfs_segbuf_reset+0xfd/0x520 fs/nilfs2/segbuf.c:129
>  nilfs_segctor_reset_segment_buffer fs/nilfs2/segment.c:421 [inline]
>  nilfs_segctor_collect fs/nilfs2/segment.c:1499 [inline]
>  nilfs_segctor_do_construct+0x20c6/0xe870 fs/nilfs2/segment.c:2045
>  nilfs_segctor_construct+0x222/0xe10 fs/nilfs2/segment.c:2379
>  nilfs_segctor_thread_construct fs/nilfs2/segment.c:2487 [inline]
>  nilfs_segctor_thread+0xc19/0x11c0 fs/nilfs2/segment.c:2570
>  kthread+0x30b/0x420 kernel/kthread.c:376
>  ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308
>
> CPU: 1 PID: 11600 Comm: segctord Not tainted 6.2.0-rc5-00010-g41c66f470616 #8
> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
> 1.13.0-1ubuntu1.1 04/01/2014
> =====================================================
>
> --
> Thanks and Regards,
>
> Dipanjan

Thank you for reporting.

I haven't been able to reproduce this yet, but was able to get the reproducer.
According to the log, it looks like the memory for the segment header
buffer passed to crc32_le() is not initialized.
I'll take a closer look using the reproducer.

Thanks,
Ryusuke Konishi

      parent reply	other threads:[~2023-02-16 16:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-16  2:43 KMSAN: uninit-value in nilfs_add_checksums_on_logs Dipanjan Das
     [not found] ` <CANX2M5bVbzRi6zH3PTcNE_31TzerstOXUa9Bay4E6y6dX23_pg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2023-02-16  3:04   ` Dipanjan Das
2023-02-16 16:16   ` Ryusuke Konishi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKFNMon+3JGp9MZ6gugkkDFUqbWgXKEO9JecjEhuUMoeXYQnqw@mail.gmail.com \
    --to=konishi.ryusuke-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=fleischermarius-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org \
    --cc=its.priyanka.bose-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-nilfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mail.dipanjan.das-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=syzkaller-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).