linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [syzbot] [exfat?] KMSAN: uninit-value in __exfat_get_dentry_set
@ 2024-10-05 14:32 syzbot
  2024-10-12 15:38 ` Suraj Sonawane
                   ` (6 more replies)
  0 siblings, 7 replies; 17+ messages in thread
From: syzbot @ 2024-10-05 14:32 UTC (permalink / raw)
  To: linkinjeon, linux-fsdevel, linux-kernel, sj1557.seo,
	syzkaller-bugs, yuezhang.mo

Hello,

syzbot found the following issue on:

HEAD commit:    e32cde8d2bd7 Merge tag 'sched_ext-for-6.12-rc1-fixes-1' of..
git tree:       upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=16cf7dd0580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=b1fd45f2013d812f
dashboard link: https://syzkaller.appspot.com/bug?extid=01218003be74b5e1213a
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=11cf7dd0580000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=11d06580580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/16d4da549bf4/disk-e32cde8d.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/a01bc9a0e174/vmlinux-e32cde8d.xz
kernel image: https://storage.googleapis.com/syzbot-assets/93f4dfad6909/bzImage-e32cde8d.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/433ba0700154/mount_0.gz

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

exFAT-fs (loop0): failed to load upcase table (idx : 0x00010000, chksum : 0x726052d3, utbl_chksum : 0xe619d30d)
=====================================================
BUG: KMSAN: uninit-value in __exfat_get_dentry_set+0x10ca/0x14d0 fs/exfat/dir.c:804
 __exfat_get_dentry_set+0x10ca/0x14d0 fs/exfat/dir.c:804
 exfat_get_dentry_set+0x58/0xec0 fs/exfat/dir.c:859
 __exfat_write_inode+0x3c1/0xe30 fs/exfat/inode.c:46
 __exfat_truncate+0x7f3/0xbb0 fs/exfat/file.c:211
 exfat_truncate+0xee/0x2a0 fs/exfat/file.c:257
 exfat_write_failed fs/exfat/inode.c:421 [inline]
 exfat_direct_IO+0x5a3/0x900 fs/exfat/inode.c:485
 generic_file_direct_write+0x275/0x6a0 mm/filemap.c:3977
 __generic_file_write_iter+0x242/0x460 mm/filemap.c:4141
 exfat_file_write_iter+0x894/0xfb0 fs/exfat/file.c:598
 do_iter_readv_writev+0x88a/0xa30
 vfs_writev+0x56a/0x14f0 fs/read_write.c:1064
 do_pwritev fs/read_write.c:1165 [inline]
 __do_sys_pwritev2 fs/read_write.c:1224 [inline]
 __se_sys_pwritev2+0x280/0x470 fs/read_write.c:1215
 __x64_sys_pwritev2+0x11f/0x1a0 fs/read_write.c:1215
 x64_sys_call+0x2edb/0x3ba0 arch/x86/include/generated/asm/syscalls_64.h:329
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Uninit was stored to memory at:
 memcpy_to_iter lib/iov_iter.c:65 [inline]
 iterate_bvec include/linux/iov_iter.h:123 [inline]
 iterate_and_advance2 include/linux/iov_iter.h:304 [inline]
 iterate_and_advance include/linux/iov_iter.h:328 [inline]
 _copy_to_iter+0xe53/0x2b30 lib/iov_iter.c:185
 copy_page_to_iter+0x419/0x880 lib/iov_iter.c:362
 shmem_file_read_iter+0xa09/0x12b0 mm/shmem.c:3167
 do_iter_readv_writev+0x88a/0xa30
 vfs_iter_read+0x278/0x760 fs/read_write.c:923
 lo_read_simple drivers/block/loop.c:283 [inline]
 do_req_filebacked drivers/block/loop.c:516 [inline]
 loop_handle_cmd drivers/block/loop.c:1910 [inline]
 loop_process_work+0x20fc/0x3750 drivers/block/loop.c:1945
 loop_rootcg_workfn+0x2b/0x40 drivers/block/loop.c:1976
 process_one_work kernel/workqueue.c:3229 [inline]
 process_scheduled_works+0xae0/0x1c40 kernel/workqueue.c:3310
 worker_thread+0xea7/0x14f0 kernel/workqueue.c:3391
 kthread+0x3e2/0x540 kernel/kthread.c:389
 ret_from_fork+0x6d/0x90 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244

Uninit was stored to memory at:
 memcpy_from_iter lib/iov_iter.c:73 [inline]
 iterate_bvec include/linux/iov_iter.h:123 [inline]
 iterate_and_advance2 include/linux/iov_iter.h:304 [inline]
 iterate_and_advance include/linux/iov_iter.h:328 [inline]
 __copy_from_iter lib/iov_iter.c:249 [inline]
 copy_page_from_iter_atomic+0x12b7/0x3100 lib/iov_iter.c:481
 copy_folio_from_iter_atomic include/linux/uio.h:201 [inline]
 generic_perform_write+0x8d1/0x1080 mm/filemap.c:4066
 shmem_file_write_iter+0x2ba/0x2f0 mm/shmem.c:3221
 do_iter_readv_writev+0x88a/0xa30
 vfs_iter_write+0x44d/0xd40 fs/read_write.c:988
 lo_write_bvec drivers/block/loop.c:243 [inline]
 lo_write_simple drivers/block/loop.c:264 [inline]
 do_req_filebacked drivers/block/loop.c:511 [inline]
 loop_handle_cmd drivers/block/loop.c:1910 [inline]
 loop_process_work+0x15e6/0x3750 drivers/block/loop.c:1945
 loop_rootcg_workfn+0x2b/0x40 drivers/block/loop.c:1976
 process_one_work kernel/workqueue.c:3229 [inline]
 process_scheduled_works+0xae0/0x1c40 kernel/workqueue.c:3310
 worker_thread+0xea7/0x14f0 kernel/workqueue.c:3391
 kthread+0x3e2/0x540 kernel/kthread.c:389
 ret_from_fork+0x6d/0x90 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244

Uninit was created at:
 __alloc_pages_noprof+0x9d6/0xe70 mm/page_alloc.c:4756
 alloc_pages_mpol_noprof+0x299/0x990 mm/mempolicy.c:2265
 alloc_pages_noprof mm/mempolicy.c:2345 [inline]
 folio_alloc_noprof+0x1db/0x310 mm/mempolicy.c:2352
 filemap_alloc_folio_noprof+0xa6/0x440 mm/filemap.c:1010
 __filemap_get_folio+0xac4/0x1550 mm/filemap.c:1952
 block_write_begin+0x6e/0x2b0 fs/buffer.c:2226
 exfat_write_begin+0xfb/0x400 fs/exfat/inode.c:434
 exfat_extend_valid_size fs/exfat/file.c:553 [inline]
 exfat_file_write_iter+0x474/0xfb0 fs/exfat/file.c:588
 do_iter_readv_writev+0x88a/0xa30
 vfs_writev+0x56a/0x14f0 fs/read_write.c:1064
 do_pwritev fs/read_write.c:1165 [inline]
 __do_sys_pwritev2 fs/read_write.c:1224 [inline]
 __se_sys_pwritev2+0x280/0x470 fs/read_write.c:1215
 __x64_sys_pwritev2+0x11f/0x1a0 fs/read_write.c:1215
 x64_sys_call+0x2edb/0x3ba0 arch/x86/include/generated/asm/syscalls_64.h:329
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

CPU: 0 UID: 0 PID: 5188 Comm: syz-executor221 Not tainted 6.12.0-rc1-syzkaller-00031-ge32cde8d2bd7 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/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 syzkaller@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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [syzbot] [exfat?] KMSAN: uninit-value in __exfat_get_dentry_set
  2024-10-05 14:32 [syzbot] [exfat?] KMSAN: uninit-value in __exfat_get_dentry_set syzbot
@ 2024-10-12 15:38 ` Suraj Sonawane
  2024-10-12 18:23   ` syzbot
  2024-10-14  6:39 ` Yuezhang.Mo
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 17+ messages in thread
From: Suraj Sonawane @ 2024-10-12 15:38 UTC (permalink / raw)
  To: syzbot
  Cc: linkinjeon, linux-fsdevel, linux-kernel, sj1557.seo,
	syzkaller-bugs, yuezhang.mo


[-- Attachment #1.1: Type: text/plain, Size: 7884 bytes --]

#syz test

On Sat, Oct 5, 2024 at 8:02 PM syzbot <
syzbot+01218003be74b5e1213a@syzkaller.appspotmail.com> wrote:

> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit:    e32cde8d2bd7 Merge tag 'sched_ext-for-6.12-rc1-fixes-1'
> of..
> git tree:       upstream
> console+strace: https://syzkaller.appspot.com/x/log.txt?x=16cf7dd0580000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=b1fd45f2013d812f
> dashboard link:
> https://syzkaller.appspot.com/bug?extid=01218003be74b5e1213a
> compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for
> Debian) 2.40
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=11cf7dd0580000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=11d06580580000
>
> Downloadable assets:
> disk image:
> https://storage.googleapis.com/syzbot-assets/16d4da549bf4/disk-e32cde8d.raw.xz
> vmlinux:
> https://storage.googleapis.com/syzbot-assets/a01bc9a0e174/vmlinux-e32cde8d.xz
> kernel image:
> https://storage.googleapis.com/syzbot-assets/93f4dfad6909/bzImage-e32cde8d.xz
> mounted in repro:
> https://storage.googleapis.com/syzbot-assets/433ba0700154/mount_0.gz
>
> IMPORTANT: if you fix the issue, please add the following tag to the
> commit:
> Reported-by: syzbot+01218003be74b5e1213a@syzkaller.appspotmail.com
>
> exFAT-fs (loop0): failed to load upcase table (idx : 0x00010000, chksum :
> 0x726052d3, utbl_chksum : 0xe619d30d)
> =====================================================
> BUG: KMSAN: uninit-value in __exfat_get_dentry_set+0x10ca/0x14d0
> fs/exfat/dir.c:804
>  __exfat_get_dentry_set+0x10ca/0x14d0 fs/exfat/dir.c:804
>  exfat_get_dentry_set+0x58/0xec0 fs/exfat/dir.c:859
>  __exfat_write_inode+0x3c1/0xe30 fs/exfat/inode.c:46
>  __exfat_truncate+0x7f3/0xbb0 fs/exfat/file.c:211
>  exfat_truncate+0xee/0x2a0 fs/exfat/file.c:257
>  exfat_write_failed fs/exfat/inode.c:421 [inline]
>  exfat_direct_IO+0x5a3/0x900 fs/exfat/inode.c:485
>  generic_file_direct_write+0x275/0x6a0 mm/filemap.c:3977
>  __generic_file_write_iter+0x242/0x460 mm/filemap.c:4141
>  exfat_file_write_iter+0x894/0xfb0 fs/exfat/file.c:598
>  do_iter_readv_writev+0x88a/0xa30
>  vfs_writev+0x56a/0x14f0 fs/read_write.c:1064
>  do_pwritev fs/read_write.c:1165 [inline]
>  __do_sys_pwritev2 fs/read_write.c:1224 [inline]
>  __se_sys_pwritev2+0x280/0x470 fs/read_write.c:1215
>  __x64_sys_pwritev2+0x11f/0x1a0 fs/read_write.c:1215
>  x64_sys_call+0x2edb/0x3ba0
> arch/x86/include/generated/asm/syscalls_64.h:329
>  do_syscall_x64 arch/x86/entry/common.c:52 [inline]
>  do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83
>  entry_SYSCALL_64_after_hwframe+0x77/0x7f
>
> Uninit was stored to memory at:
>  memcpy_to_iter lib/iov_iter.c:65 [inline]
>  iterate_bvec include/linux/iov_iter.h:123 [inline]
>  iterate_and_advance2 include/linux/iov_iter.h:304 [inline]
>  iterate_and_advance include/linux/iov_iter.h:328 [inline]
>  _copy_to_iter+0xe53/0x2b30 lib/iov_iter.c:185
>  copy_page_to_iter+0x419/0x880 lib/iov_iter.c:362
>  shmem_file_read_iter+0xa09/0x12b0 mm/shmem.c:3167
>  do_iter_readv_writev+0x88a/0xa30
>  vfs_iter_read+0x278/0x760 fs/read_write.c:923
>  lo_read_simple drivers/block/loop.c:283 [inline]
>  do_req_filebacked drivers/block/loop.c:516 [inline]
>  loop_handle_cmd drivers/block/loop.c:1910 [inline]
>  loop_process_work+0x20fc/0x3750 drivers/block/loop.c:1945
>  loop_rootcg_workfn+0x2b/0x40 drivers/block/loop.c:1976
>  process_one_work kernel/workqueue.c:3229 [inline]
>  process_scheduled_works+0xae0/0x1c40 kernel/workqueue.c:3310
>  worker_thread+0xea7/0x14f0 kernel/workqueue.c:3391
>  kthread+0x3e2/0x540 kernel/kthread.c:389
>  ret_from_fork+0x6d/0x90 arch/x86/kernel/process.c:147
>  ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
>
> Uninit was stored to memory at:
>  memcpy_from_iter lib/iov_iter.c:73 [inline]
>  iterate_bvec include/linux/iov_iter.h:123 [inline]
>  iterate_and_advance2 include/linux/iov_iter.h:304 [inline]
>  iterate_and_advance include/linux/iov_iter.h:328 [inline]
>  __copy_from_iter lib/iov_iter.c:249 [inline]
>  copy_page_from_iter_atomic+0x12b7/0x3100 lib/iov_iter.c:481
>  copy_folio_from_iter_atomic include/linux/uio.h:201 [inline]
>  generic_perform_write+0x8d1/0x1080 mm/filemap.c:4066
>  shmem_file_write_iter+0x2ba/0x2f0 mm/shmem.c:3221
>  do_iter_readv_writev+0x88a/0xa30
>  vfs_iter_write+0x44d/0xd40 fs/read_write.c:988
>  lo_write_bvec drivers/block/loop.c:243 [inline]
>  lo_write_simple drivers/block/loop.c:264 [inline]
>  do_req_filebacked drivers/block/loop.c:511 [inline]
>  loop_handle_cmd drivers/block/loop.c:1910 [inline]
>  loop_process_work+0x15e6/0x3750 drivers/block/loop.c:1945
>  loop_rootcg_workfn+0x2b/0x40 drivers/block/loop.c:1976
>  process_one_work kernel/workqueue.c:3229 [inline]
>  process_scheduled_works+0xae0/0x1c40 kernel/workqueue.c:3310
>  worker_thread+0xea7/0x14f0 kernel/workqueue.c:3391
>  kthread+0x3e2/0x540 kernel/kthread.c:389
>  ret_from_fork+0x6d/0x90 arch/x86/kernel/process.c:147
>  ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
>
> Uninit was created at:
>  __alloc_pages_noprof+0x9d6/0xe70 mm/page_alloc.c:4756
>  alloc_pages_mpol_noprof+0x299/0x990 mm/mempolicy.c:2265
>  alloc_pages_noprof mm/mempolicy.c:2345 [inline]
>  folio_alloc_noprof+0x1db/0x310 mm/mempolicy.c:2352
>  filemap_alloc_folio_noprof+0xa6/0x440 mm/filemap.c:1010
>  __filemap_get_folio+0xac4/0x1550 mm/filemap.c:1952
>  block_write_begin+0x6e/0x2b0 fs/buffer.c:2226
>  exfat_write_begin+0xfb/0x400 fs/exfat/inode.c:434
>  exfat_extend_valid_size fs/exfat/file.c:553 [inline]
>  exfat_file_write_iter+0x474/0xfb0 fs/exfat/file.c:588
>  do_iter_readv_writev+0x88a/0xa30
>  vfs_writev+0x56a/0x14f0 fs/read_write.c:1064
>  do_pwritev fs/read_write.c:1165 [inline]
>  __do_sys_pwritev2 fs/read_write.c:1224 [inline]
>  __se_sys_pwritev2+0x280/0x470 fs/read_write.c:1215
>  __x64_sys_pwritev2+0x11f/0x1a0 fs/read_write.c:1215
>  x64_sys_call+0x2edb/0x3ba0
> arch/x86/include/generated/asm/syscalls_64.h:329
>  do_syscall_x64 arch/x86/entry/common.c:52 [inline]
>  do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83
>  entry_SYSCALL_64_after_hwframe+0x77/0x7f
>
> CPU: 0 UID: 0 PID: 5188 Comm: syz-executor221 Not tainted
> 6.12.0-rc1-syzkaller-00031-ge32cde8d2bd7 #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
> Google 09/13/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 syzkaller@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
>
> --
> 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-bugs+unsubscribe@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/syzkaller-bugs/67014df7.050a0220.49194.04c0.GAE%40google.com
> .
>

[-- Attachment #1.2: Type: text/html, Size: 10124 bytes --]

[-- Attachment #2: 0001-fs-fix-uinit.patch --]
[-- Type: text/x-patch, Size: 1008 bytes --]

From a5923aca821c5b3a5d4980bd7d604062a5215dfc Mon Sep 17 00:00:00 2001
From: Suraj Sonawane <surajsonawane0215@gmail.com>
Date: Sat, 12 Oct 2024 21:04:41 +0530
Subject: [PATCH] fs: fix uinit

Fix the uninitialized symbol

Signed-off-by: Suraj Sonawane <surajsonawane0215@gmail.com>
---
 fs/exfat/dir.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/fs/exfat/dir.c b/fs/exfat/dir.c
index 7446bf09a..6efbb5787 100644
--- a/fs/exfat/dir.c
+++ b/fs/exfat/dir.c
@@ -791,6 +791,7 @@ static int __exfat_get_dentry_set(struct exfat_entry_set_cache *es,
 	es->modified = false;
 	es->start_off = off;
 	es->bh = es->__bh;
+	memset(es->__bh, 0, sizeof(es->__bh));
 
 	bh = sb_bread(sb, sec);
 	if (!bh)
@@ -801,6 +802,12 @@ static int __exfat_get_dentry_set(struct exfat_entry_set_cache *es,
 		struct exfat_dentry *ep;
 
 		ep = exfat_get_dentry_cached(es, ES_IDX_FILE);
+
+		if (!ep) {
+			brelse(bh);
+			return -EIO;
+		}
+
 		if (ep->type != EXFAT_FILE) {
 			brelse(bh);
 			return -EIO;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [syzbot] [exfat?] KMSAN: uninit-value in __exfat_get_dentry_set
  2024-10-12 15:38 ` Suraj Sonawane
@ 2024-10-12 18:23   ` syzbot
  0 siblings, 0 replies; 17+ messages in thread
From: syzbot @ 2024-10-12 18:23 UTC (permalink / raw)
  To: linkinjeon, linux-fsdevel, linux-kernel, sj1557.seo,
	surajsonawane0215, syzkaller-bugs, yuezhang.mo

Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
KMSAN: uninit-value in __exfat_get_dentry_set

loop0: detected capacity change from 0 to 256
exFAT-fs (loop0): failed to load upcase table (idx : 0x00010000, chksum : 0x726052d3, utbl_chksum : 0xe619d30d)
=====================================================
BUG: KMSAN: uninit-value in __exfat_get_dentry_set+0x1148/0x1540 fs/exfat/dir.c:811
 __exfat_get_dentry_set+0x1148/0x1540 fs/exfat/dir.c:811
 exfat_get_dentry_set+0x58/0xec0 fs/exfat/dir.c:866
 __exfat_write_inode+0x3c1/0xe30 fs/exfat/inode.c:46
 __exfat_truncate+0x7f3/0xbb0 fs/exfat/file.c:211
 exfat_truncate+0xee/0x2a0 fs/exfat/file.c:257
 exfat_write_failed fs/exfat/inode.c:421 [inline]
 exfat_direct_IO+0x5a3/0x900 fs/exfat/inode.c:485
 generic_file_direct_write+0x275/0x6a0 mm/filemap.c:3977
 __generic_file_write_iter+0x242/0x460 mm/filemap.c:4141
 exfat_file_write_iter+0x894/0xfb0 fs/exfat/file.c:598
 do_iter_readv_writev+0x88a/0xa30
 vfs_writev+0x56a/0x14f0 fs/read_write.c:1064
 do_pwritev fs/read_write.c:1165 [inline]
 __do_sys_pwritev2 fs/read_write.c:1224 [inline]
 __se_sys_pwritev2+0x280/0x470 fs/read_write.c:1215
 __x64_sys_pwritev2+0x11f/0x1a0 fs/read_write.c:1215
 x64_sys_call+0x2edb/0x3ba0 arch/x86/include/generated/asm/syscalls_64.h:329
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Uninit was stored to memory at:
 memcpy_to_iter lib/iov_iter.c:65 [inline]
 iterate_bvec include/linux/iov_iter.h:123 [inline]
 iterate_and_advance2 include/linux/iov_iter.h:304 [inline]
 iterate_and_advance include/linux/iov_iter.h:328 [inline]
 _copy_to_iter+0xe53/0x2b30 lib/iov_iter.c:185
 copy_page_to_iter+0x419/0x880 lib/iov_iter.c:362
 shmem_file_read_iter+0xa09/0x12b0 mm/shmem.c:3167
 do_iter_readv_writev+0x88a/0xa30
 vfs_iter_read+0x278/0x760 fs/read_write.c:923
 lo_read_simple drivers/block/loop.c:283 [inline]
 do_req_filebacked drivers/block/loop.c:516 [inline]
 loop_handle_cmd drivers/block/loop.c:1910 [inline]
 loop_process_work+0x20fc/0x3750 drivers/block/loop.c:1945
 loop_workfn+0x48/0x60 drivers/block/loop.c:1969
 process_one_work kernel/workqueue.c:3229 [inline]
 process_scheduled_works+0xae0/0x1c40 kernel/workqueue.c:3310
 worker_thread+0xea7/0x14f0 kernel/workqueue.c:3391
 kthread+0x3e2/0x540 kernel/kthread.c:389
 ret_from_fork+0x6d/0x90 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244

Uninit was stored to memory at:
 memcpy_from_iter lib/iov_iter.c:73 [inline]
 iterate_bvec include/linux/iov_iter.h:123 [inline]
 iterate_and_advance2 include/linux/iov_iter.h:304 [inline]
 iterate_and_advance include/linux/iov_iter.h:328 [inline]
 __copy_from_iter lib/iov_iter.c:249 [inline]
 copy_page_from_iter_atomic+0x12b7/0x3100 lib/iov_iter.c:481
 copy_folio_from_iter_atomic include/linux/uio.h:201 [inline]
 generic_perform_write+0x8d1/0x1080 mm/filemap.c:4066
 shmem_file_write_iter+0x2ba/0x2f0 mm/shmem.c:3221
 do_iter_readv_writev+0x88a/0xa30
 vfs_iter_write+0x44d/0xd40 fs/read_write.c:988
 lo_write_bvec drivers/block/loop.c:243 [inline]
 lo_write_simple drivers/block/loop.c:264 [inline]
 do_req_filebacked drivers/block/loop.c:511 [inline]
 loop_handle_cmd drivers/block/loop.c:1910 [inline]
 loop_process_work+0x15e6/0x3750 drivers/block/loop.c:1945
 loop_workfn+0x48/0x60 drivers/block/loop.c:1969
 process_one_work kernel/workqueue.c:3229 [inline]
 process_scheduled_works+0xae0/0x1c40 kernel/workqueue.c:3310
 worker_thread+0xea7/0x14f0 kernel/workqueue.c:3391
 kthread+0x3e2/0x540 kernel/kthread.c:389
 ret_from_fork+0x6d/0x90 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244

Uninit was created at:
 __alloc_pages_noprof+0x9a7/0xe00 mm/page_alloc.c:4756
 alloc_pages_mpol_noprof+0x299/0x990 mm/mempolicy.c:2265
 alloc_pages_noprof mm/mempolicy.c:2345 [inline]
 folio_alloc_noprof+0x1db/0x310 mm/mempolicy.c:2352
 filemap_alloc_folio_noprof+0xa6/0x440 mm/filemap.c:1010
 __filemap_get_folio+0xac4/0x1550 mm/filemap.c:1952
 block_write_begin+0x6e/0x2b0 fs/buffer.c:2226
 exfat_write_begin+0xfb/0x400 fs/exfat/inode.c:434
 exfat_extend_valid_size fs/exfat/file.c:553 [inline]
 exfat_file_write_iter+0x474/0xfb0 fs/exfat/file.c:588
 do_iter_readv_writev+0x88a/0xa30
 vfs_writev+0x56a/0x14f0 fs/read_write.c:1064
 do_pwritev fs/read_write.c:1165 [inline]
 __do_sys_pwritev2 fs/read_write.c:1224 [inline]
 __se_sys_pwritev2+0x280/0x470 fs/read_write.c:1215
 __x64_sys_pwritev2+0x11f/0x1a0 fs/read_write.c:1215
 x64_sys_call+0x2edb/0x3ba0 arch/x86/include/generated/asm/syscalls_64.h:329
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

CPU: 0 UID: 0 PID: 5959 Comm: syz.0.15 Not tainted 6.12.0-rc2-syzkaller-00305-g7234e2ea0edd-dirty #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
=====================================================


Tested on:

commit:         7234e2ea Merge tag 'scsi-fixes' of git://git.kernel.or..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1552705f980000
kernel config:  https://syzkaller.appspot.com/x/.config?x=981fe2ff8a1e457a
dashboard link: https://syzkaller.appspot.com/bug?extid=01218003be74b5e1213a
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch:          https://syzkaller.appspot.com/x/patch.diff?x=16ebf840580000


^ permalink raw reply	[flat|nested] 17+ messages in thread

* RE: [syzbot] [exfat?] KMSAN: uninit-value in __exfat_get_dentry_set
  2024-10-05 14:32 [syzbot] [exfat?] KMSAN: uninit-value in __exfat_get_dentry_set syzbot
  2024-10-12 15:38 ` Suraj Sonawane
@ 2024-10-14  6:39 ` Yuezhang.Mo
  2024-10-14  7:51   ` syzbot
  2024-10-14  9:00 ` Yuezhang.Mo
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 17+ messages in thread
From: Yuezhang.Mo @ 2024-10-14  6:39 UTC (permalink / raw)
  To: syzbot, linkinjeon@kernel.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org, sj1557.seo@samsung.com,
	syzkaller-bugs@googlegroups.com

[-- Attachment #1: Type: text/plain, Size: 9162 bytes --]

#syz test

On Sat, Oct 5, 2024 at 8:02 PM syzbot <syzbot+01218003be74b5e1213a@syzkaller.appspotmail.com> wrote:
> 
> Hello,
> 
> syzbot found the following issue on:
> 
> HEAD commit:    e32cde8d2bd7 Merge tag 'sched_ext-for-6.12-rc1-fixes-1'
> of..
> git tree:       upstream
> console+strace:
> https://urldefense.com/v3/__https://syzkaller.appspot.com/x/log.txt?x=16cf7d
> d0580000__;!!JmoZiZGBv3RvKRSx!_EFM31JxDI_sBC6NhWwWIWcja8UUVBXZY
> WyhK0O9vUuSsqy-ZOla4TuepNTA3X-btBmzePMIOD0CGeGE0kSF4M2hOwVy5
> 7mr5yQIbTA6$
> kernel config:
> https://urldefense.com/v3/__https://syzkaller.appspot.com/x/.config?x=b1fd45
> f2013d812f__;!!JmoZiZGBv3RvKRSx!_EFM31JxDI_sBC6NhWwWIWcja8UUVBX
> ZYWyhK0O9vUuSsqy-ZOla4TuepNTA3X-btBmzePMIOD0CGeGE0kSF4M2hOwV
> y57mr50IfSXOd$
> dashboard link:
> https://urldefense.com/v3/__https://syzkaller.appspot.com/bug?extid=012180
> 03be74b5e1213a__;!!JmoZiZGBv3RvKRSx!_EFM31JxDI_sBC6NhWwWIWcja8U
> UVBXZYWyhK0O9vUuSsqy-ZOla4TuepNTA3X-btBmzePMIOD0CGeGE0kSF4M2h
> OwVy57mr5-IoYOKx$
> compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian)
> 2.40
> syz repro:
> https://urldefense.com/v3/__https://syzkaller.appspot.com/x/repro.syz?x=11cf
> 7dd0580000__;!!JmoZiZGBv3RvKRSx!_EFM31JxDI_sBC6NhWwWIWcja8UUVB
> XZYWyhK0O9vUuSsqy-ZOla4TuepNTA3X-btBmzePMIOD0CGeGE0kSF4M2hOw
> Vy57mr58TvVCus$
> C reproducer:
> https://urldefense.com/v3/__https://syzkaller.appspot.com/x/repro.c?x=11d06
> 580580000__;!!JmoZiZGBv3RvKRSx!_EFM31JxDI_sBC6NhWwWIWcja8UUVBXZ
> YWyhK0O9vUuSsqy-ZOla4TuepNTA3X-btBmzePMIOD0CGeGE0kSF4M2hOwVy
> 57mr5w2Sgp57$
> 
> Downloadable assets:
> disk image:
> https://urldefense.com/v3/__https://storage.googleapis.com/syzbot-assets/16
> d4da549bf4/disk-e32cde8d.raw.xz__;!!JmoZiZGBv3RvKRSx!_EFM31JxDI_sBC6
> NhWwWIWcja8UUVBXZYWyhK0O9vUuSsqy-ZOla4TuepNTA3X-btBmzePMIOD0
> CGeGE0kSF4M2hOwVy57mr54CRCyjy$
> vmlinux:
> https://urldefense.com/v3/__https://storage.googleapis.com/syzbot-assets/a01
> bc9a0e174/vmlinux-e32cde8d.xz__;!!JmoZiZGBv3RvKRSx!_EFM31JxDI_sBC6N
> hWwWIWcja8UUVBXZYWyhK0O9vUuSsqy-ZOla4TuepNTA3X-btBmzePMIOD0C
> GeGE0kSF4M2hOwVy57mr5_9fwsZ2$
> kernel image:
> https://urldefense.com/v3/__https://storage.googleapis.com/syzbot-assets/93f
> 4dfad6909/bzImage-e32cde8d.xz__;!!JmoZiZGBv3RvKRSx!_EFM31JxDI_sBC6N
> hWwWIWcja8UUVBXZYWyhK0O9vUuSsqy-ZOla4TuepNTA3X-btBmzePMIOD0C
> GeGE0kSF4M2hOwVy57mr54HU84Yj$
> mounted in repro:
> https://urldefense.com/v3/__https://storage.googleapis.com/syzbot-assets/43
> 3ba0700154/mount_0.gz__;!!JmoZiZGBv3RvKRSx!_EFM31JxDI_sBC6NhWwWI
> Wcja8UUVBXZYWyhK0O9vUuSsqy-ZOla4TuepNTA3X-btBmzePMIOD0CGeGE0k
> SF4M2hOwVy57mr51x55siW$
> 
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by:
> mailto:syzbot+01218003be74b5e1213a@syzkaller.appspotmail.com
> 
> exFAT-fs (loop0): failed to load upcase table (idx : 0x00010000, chksum :
> 0x726052d3, utbl_chksum : 0xe619d30d)
> =====================================================
> BUG: KMSAN: uninit-value in __exfat_get_dentry_set+0x10ca/0x14d0
> fs/exfat/dir.c:804
>  __exfat_get_dentry_set+0x10ca/0x14d0 fs/exfat/dir.c:804
>  exfat_get_dentry_set+0x58/0xec0 fs/exfat/dir.c:859
>  __exfat_write_inode+0x3c1/0xe30 fs/exfat/inode.c:46
>  __exfat_truncate+0x7f3/0xbb0 fs/exfat/file.c:211
>  exfat_truncate+0xee/0x2a0 fs/exfat/file.c:257
>  exfat_write_failed fs/exfat/inode.c:421 [inline]
>  exfat_direct_IO+0x5a3/0x900 fs/exfat/inode.c:485
>  generic_file_direct_write+0x275/0x6a0 mm/filemap.c:3977
>  __generic_file_write_iter+0x242/0x460 mm/filemap.c:4141
>  exfat_file_write_iter+0x894/0xfb0 fs/exfat/file.c:598
>  do_iter_readv_writev+0x88a/0xa30
>  vfs_writev+0x56a/0x14f0 fs/read_write.c:1064
>  do_pwritev fs/read_write.c:1165 [inline]
>  __do_sys_pwritev2 fs/read_write.c:1224 [inline]
>  __se_sys_pwritev2+0x280/0x470 fs/read_write.c:1215
>  __x64_sys_pwritev2+0x11f/0x1a0 fs/read_write.c:1215
>  x64_sys_call+0x2edb/0x3ba0
> arch/x86/include/generated/asm/syscalls_64.h:329
>  do_syscall_x64 arch/x86/entry/common.c:52 [inline]
>  do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83
>  entry_SYSCALL_64_after_hwframe+0x77/0x7f
> 
> Uninit was stored to memory at:
>  memcpy_to_iter lib/iov_iter.c:65 [inline]
>  iterate_bvec include/linux/iov_iter.h:123 [inline]
>  iterate_and_advance2 include/linux/iov_iter.h:304 [inline]
>  iterate_and_advance include/linux/iov_iter.h:328 [inline]
>  _copy_to_iter+0xe53/0x2b30 lib/iov_iter.c:185
>  copy_page_to_iter+0x419/0x880 lib/iov_iter.c:362
>  shmem_file_read_iter+0xa09/0x12b0 mm/shmem.c:3167
>  do_iter_readv_writev+0x88a/0xa30
>  vfs_iter_read+0x278/0x760 fs/read_write.c:923
>  lo_read_simple drivers/block/loop.c:283 [inline]
>  do_req_filebacked drivers/block/loop.c:516 [inline]
>  loop_handle_cmd drivers/block/loop.c:1910 [inline]
>  loop_process_work+0x20fc/0x3750 drivers/block/loop.c:1945
>  loop_rootcg_workfn+0x2b/0x40 drivers/block/loop.c:1976
>  process_one_work kernel/workqueue.c:3229 [inline]
>  process_scheduled_works+0xae0/0x1c40 kernel/workqueue.c:3310
>  worker_thread+0xea7/0x14f0 kernel/workqueue.c:3391
>  kthread+0x3e2/0x540 kernel/kthread.c:389
>  ret_from_fork+0x6d/0x90 arch/x86/kernel/process.c:147
>  ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
> 
> Uninit was stored to memory at:
>  memcpy_from_iter lib/iov_iter.c:73 [inline]
>  iterate_bvec include/linux/iov_iter.h:123 [inline]
>  iterate_and_advance2 include/linux/iov_iter.h:304 [inline]
>  iterate_and_advance include/linux/iov_iter.h:328 [inline]
>  __copy_from_iter lib/iov_iter.c:249 [inline]
>  copy_page_from_iter_atomic+0x12b7/0x3100 lib/iov_iter.c:481
>  copy_folio_from_iter_atomic include/linux/uio.h:201 [inline]
>  generic_perform_write+0x8d1/0x1080 mm/filemap.c:4066
>  shmem_file_write_iter+0x2ba/0x2f0 mm/shmem.c:3221
>  do_iter_readv_writev+0x88a/0xa30
>  vfs_iter_write+0x44d/0xd40 fs/read_write.c:988
>  lo_write_bvec drivers/block/loop.c:243 [inline]
>  lo_write_simple drivers/block/loop.c:264 [inline]
>  do_req_filebacked drivers/block/loop.c:511 [inline]
>  loop_handle_cmd drivers/block/loop.c:1910 [inline]
>  loop_process_work+0x15e6/0x3750 drivers/block/loop.c:1945
>  loop_rootcg_workfn+0x2b/0x40 drivers/block/loop.c:1976
>  process_one_work kernel/workqueue.c:3229 [inline]
>  process_scheduled_works+0xae0/0x1c40 kernel/workqueue.c:3310
>  worker_thread+0xea7/0x14f0 kernel/workqueue.c:3391
>  kthread+0x3e2/0x540 kernel/kthread.c:389
>  ret_from_fork+0x6d/0x90 arch/x86/kernel/process.c:147
>  ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
> 
> Uninit was created at:
>  __alloc_pages_noprof+0x9d6/0xe70 mm/page_alloc.c:4756
>  alloc_pages_mpol_noprof+0x299/0x990 mm/mempolicy.c:2265
>  alloc_pages_noprof mm/mempolicy.c:2345 [inline]
>  folio_alloc_noprof+0x1db/0x310 mm/mempolicy.c:2352
>  filemap_alloc_folio_noprof+0xa6/0x440 mm/filemap.c:1010
>  __filemap_get_folio+0xac4/0x1550 mm/filemap.c:1952
>  block_write_begin+0x6e/0x2b0 fs/buffer.c:2226
>  exfat_write_begin+0xfb/0x400 fs/exfat/inode.c:434
>  exfat_extend_valid_size fs/exfat/file.c:553 [inline]
>  exfat_file_write_iter+0x474/0xfb0 fs/exfat/file.c:588
>  do_iter_readv_writev+0x88a/0xa30
>  vfs_writev+0x56a/0x14f0 fs/read_write.c:1064
>  do_pwritev fs/read_write.c:1165 [inline]
>  __do_sys_pwritev2 fs/read_write.c:1224 [inline]
>  __se_sys_pwritev2+0x280/0x470 fs/read_write.c:1215
>  __x64_sys_pwritev2+0x11f/0x1a0 fs/read_write.c:1215
>  x64_sys_call+0x2edb/0x3ba0
> arch/x86/include/generated/asm/syscalls_64.h:329
>  do_syscall_x64 arch/x86/entry/common.c:52 [inline]
>  do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83
>  entry_SYSCALL_64_after_hwframe+0x77/0x7f
> 
> CPU: 0 UID: 0 PID: 5188 Comm: syz-executor221 Not tainted
> 6.12.0-rc1-syzkaller-00031-ge32cde8d2bd7 #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
> Google 09/13/2024
> =====================================================
> 
> 
> ---
> This report is generated by a bot. It may contain errors.
> See
> https://urldefense.com/v3/__https://goo.gl/tpsmEJ__;!!JmoZiZGBv3RvKRSx!_E
> FM31JxDI_sBC6NhWwWIWcja8UUVBXZYWyhK0O9vUuSsqy-ZOla4TuepNTA3X-
> btBmzePMIOD0CGeGE0kSF4M2hOwVy57mr50hLBEHu$ for more information
> about syzbot.
> syzbot engineers can be reached at mailto:syzkaller@googlegroups.com.
> 
> syzbot will keep track of this issue. See:
> https://urldefense.com/v3/__https://goo.gl/tpsmEJ*status__;Iw!!JmoZiZGBv3R
> vKRSx!_EFM31JxDI_sBC6NhWwWIWcja8UUVBXZYWyhK0O9vUuSsqy-ZOla4Tu
> epNTA3X-btBmzePMIOD0CGeGE0kSF4M2hOwVy57mr55Eybub8$ 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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-exfat-do-not-update-valid_size-in-exfat_get_block-if.patch --]
[-- Type: text/x-patch; name="0001-exfat-do-not-update-valid_size-in-exfat_get_block-if.patch", Size: 2488 bytes --]

From 31f61e9fd68258588910c05dcbd50af381fe8b96 Mon Sep 17 00:00:00 2001
From: Yuezhang Mo <Yuezhang.Mo@sony.com>
Date: Mon, 14 Oct 2024 12:52:28 +0800
Subject: [PATCH] exfat: do not update ->valid_size in exfat_get_block() if map
 for direct write

Signed-off-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
---
 fs/exfat/inode.c | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/fs/exfat/inode.c b/fs/exfat/inode.c
index d338a59c27f7..6e1312f30846 100644
--- a/fs/exfat/inode.c
+++ b/fs/exfat/inode.c
@@ -261,8 +261,8 @@ static int exfat_map_cluster(struct inode *inode, unsigned int clu_offset,
 	return 0;
 }
 
-static int exfat_get_block(struct inode *inode, sector_t iblock,
-		struct buffer_head *bh_result, int create)
+static int __exfat_get_block(struct inode *inode, sector_t iblock,
+		struct buffer_head *bh_result, int create, bool dio)
 {
 	struct exfat_inode_info *ei = EXFAT_I(inode);
 	struct super_block *sb = inode->i_sb;
@@ -323,8 +323,10 @@ static int exfat_get_block(struct inode *inode, sector_t iblock,
 		/* The area has not been written, map and mark as new. */
 		set_buffer_new(bh_result);
 
-		ei->valid_size = EXFAT_BLK_TO_B(iblock + max_blocks, sb);
-		mark_inode_dirty(inode);
+		if (!dio) {
+			ei->valid_size = EXFAT_BLK_TO_B(iblock + max_blocks, sb);
+			mark_inode_dirty(inode);
+		}
 	} else {
 		valid_blks = EXFAT_B_TO_BLK(ei->valid_size, sb);
 
@@ -381,6 +383,18 @@ static int exfat_get_block(struct inode *inode, sector_t iblock,
 	return err;
 }
 
+static int exfat_get_block(struct inode *inode, sector_t iblock,
+		struct buffer_head *bh_result, int create)
+{
+	return __exfat_get_block(inode, iblock, bh_result, create, false);
+}
+
+static int exfat_get_block_for_dio(struct inode *inode, sector_t iblock,
+		struct buffer_head *bh_result, int create)
+{
+	return __exfat_get_block(inode, iblock, bh_result, create, true);
+}
+
 static int exfat_read_folio(struct file *file, struct folio *folio)
 {
 	return mpage_read_folio(folio, exfat_get_block);
@@ -479,7 +493,7 @@ static ssize_t exfat_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
 	 * Need to use the DIO_LOCKING for avoiding the race
 	 * condition of exfat_get_block() and ->truncate().
 	 */
-	ret = blockdev_direct_IO(iocb, inode, iter, exfat_get_block);
+	ret = blockdev_direct_IO(iocb, inode, iter, exfat_get_block_for_dio);
 	if (ret < 0) {
 		if (rw == WRITE && ret != -EIOCBQUEUED)
 			exfat_write_failed(mapping, size);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [syzbot] [exfat?] KMSAN: uninit-value in __exfat_get_dentry_set
  2024-10-14  6:39 ` Yuezhang.Mo
@ 2024-10-14  7:51   ` syzbot
  0 siblings, 0 replies; 17+ messages in thread
From: syzbot @ 2024-10-14  7:51 UTC (permalink / raw)
  To: linkinjeon, linux-fsdevel, linux-kernel, sj1557.seo,
	syzkaller-bugs, yuezhang.mo

Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
KMSAN: uninit-value in __exfat_get_dentry_set

loop0: detected capacity change from 0 to 256
exFAT-fs (loop0): failed to load upcase table (idx : 0x00010000, chksum : 0x726052d3, utbl_chksum : 0xe619d30d)
=====================================================
BUG: KMSAN: uninit-value in __exfat_get_dentry_set+0x10ca/0x14d0 fs/exfat/dir.c:804
 __exfat_get_dentry_set+0x10ca/0x14d0 fs/exfat/dir.c:804
 exfat_get_dentry_set+0x58/0xec0 fs/exfat/dir.c:859
 __exfat_write_inode+0x3c1/0xe30 fs/exfat/inode.c:46
 __exfat_truncate+0x7f3/0xbb0 fs/exfat/file.c:211
 exfat_truncate+0xee/0x2a0 fs/exfat/file.c:257
 exfat_write_failed fs/exfat/inode.c:435 [inline]
 exfat_direct_IO+0x5a3/0x900 fs/exfat/inode.c:499
 generic_file_direct_write+0x275/0x6a0 mm/filemap.c:3977
 __generic_file_write_iter+0x242/0x460 mm/filemap.c:4141
 exfat_file_write_iter+0x894/0xfb0 fs/exfat/file.c:598
 do_iter_readv_writev+0x88a/0xa30
 vfs_writev+0x56a/0x14f0 fs/read_write.c:1064
 do_pwritev fs/read_write.c:1165 [inline]
 __do_sys_pwritev2 fs/read_write.c:1224 [inline]
 __se_sys_pwritev2+0x280/0x470 fs/read_write.c:1215
 __x64_sys_pwritev2+0x11f/0x1a0 fs/read_write.c:1215
 x64_sys_call+0x2edb/0x3ba0 arch/x86/include/generated/asm/syscalls_64.h:329
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Uninit was stored to memory at:
 memcpy_to_iter lib/iov_iter.c:65 [inline]
 iterate_bvec include/linux/iov_iter.h:123 [inline]
 iterate_and_advance2 include/linux/iov_iter.h:304 [inline]
 iterate_and_advance include/linux/iov_iter.h:328 [inline]
 _copy_to_iter+0xe53/0x2b30 lib/iov_iter.c:185
 copy_page_to_iter+0x419/0x880 lib/iov_iter.c:362
 shmem_file_read_iter+0xa09/0x12b0 mm/shmem.c:3167
 do_iter_readv_writev+0x88a/0xa30
 vfs_iter_read+0x278/0x760 fs/read_write.c:923
 lo_read_simple drivers/block/loop.c:283 [inline]
 do_req_filebacked drivers/block/loop.c:516 [inline]
 loop_handle_cmd drivers/block/loop.c:1910 [inline]
 loop_process_work+0x20fc/0x3750 drivers/block/loop.c:1945
 loop_workfn+0x48/0x60 drivers/block/loop.c:1969
 process_one_work kernel/workqueue.c:3229 [inline]
 process_scheduled_works+0xae0/0x1c40 kernel/workqueue.c:3310
 worker_thread+0xea7/0x14f0 kernel/workqueue.c:3391
 kthread+0x3e2/0x540 kernel/kthread.c:389
 ret_from_fork+0x6d/0x90 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244

Uninit was stored to memory at:
 memcpy_from_iter lib/iov_iter.c:73 [inline]
 iterate_bvec include/linux/iov_iter.h:123 [inline]
 iterate_and_advance2 include/linux/iov_iter.h:304 [inline]
 iterate_and_advance include/linux/iov_iter.h:328 [inline]
 __copy_from_iter lib/iov_iter.c:249 [inline]
 copy_page_from_iter_atomic+0x12b7/0x3100 lib/iov_iter.c:481
 copy_folio_from_iter_atomic include/linux/uio.h:201 [inline]
 generic_perform_write+0x8d1/0x1080 mm/filemap.c:4066
 shmem_file_write_iter+0x2ba/0x2f0 mm/shmem.c:3221
 do_iter_readv_writev+0x88a/0xa30
 vfs_iter_write+0x44d/0xd40 fs/read_write.c:988
 lo_write_bvec drivers/block/loop.c:243 [inline]
 lo_write_simple drivers/block/loop.c:264 [inline]
 do_req_filebacked drivers/block/loop.c:511 [inline]
 loop_handle_cmd drivers/block/loop.c:1910 [inline]
 loop_process_work+0x15e6/0x3750 drivers/block/loop.c:1945
 loop_workfn+0x48/0x60 drivers/block/loop.c:1969
 process_one_work kernel/workqueue.c:3229 [inline]
 process_scheduled_works+0xae0/0x1c40 kernel/workqueue.c:3310
 worker_thread+0xea7/0x14f0 kernel/workqueue.c:3391
 kthread+0x3e2/0x540 kernel/kthread.c:389
 ret_from_fork+0x6d/0x90 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244

Uninit was created at:
 __alloc_pages_noprof+0x9a7/0xe00 mm/page_alloc.c:4756
 alloc_pages_mpol_noprof+0x299/0x990 mm/mempolicy.c:2265
 alloc_pages_noprof mm/mempolicy.c:2345 [inline]
 folio_alloc_noprof+0x1db/0x310 mm/mempolicy.c:2352
 filemap_alloc_folio_noprof+0xa6/0x440 mm/filemap.c:1010
 __filemap_get_folio+0xac4/0x1550 mm/filemap.c:1952
 block_write_begin+0x6e/0x2b0 fs/buffer.c:2226
 exfat_write_begin+0xfb/0x400 fs/exfat/inode.c:448
 exfat_extend_valid_size fs/exfat/file.c:553 [inline]
 exfat_file_write_iter+0x474/0xfb0 fs/exfat/file.c:588
 do_iter_readv_writev+0x88a/0xa30
 vfs_writev+0x56a/0x14f0 fs/read_write.c:1064
 do_pwritev fs/read_write.c:1165 [inline]
 __do_sys_pwritev2 fs/read_write.c:1224 [inline]
 __se_sys_pwritev2+0x280/0x470 fs/read_write.c:1215
 __x64_sys_pwritev2+0x11f/0x1a0 fs/read_write.c:1215
 x64_sys_call+0x2edb/0x3ba0 arch/x86/include/generated/asm/syscalls_64.h:329
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

CPU: 1 UID: 0 PID: 5987 Comm: syz.0.15 Not tainted 6.12.0-rc3-syzkaller-g6485cf5ea253-dirty #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
=====================================================


Tested on:

commit:         6485cf5e Merge tag 'hid-for-linus-2024101301' of git:/..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1012d85f980000
kernel config:  https://syzkaller.appspot.com/x/.config?x=5242e0e980477c72
dashboard link: https://syzkaller.appspot.com/bug?extid=01218003be74b5e1213a
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch:          https://syzkaller.appspot.com/x/patch.diff?x=154ac727980000


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [syzbot] [exfat?] KMSAN: uninit-value in __exfat_get_dentry_set
  2024-10-05 14:32 [syzbot] [exfat?] KMSAN: uninit-value in __exfat_get_dentry_set syzbot
  2024-10-12 15:38 ` Suraj Sonawane
  2024-10-14  6:39 ` Yuezhang.Mo
@ 2024-10-14  9:00 ` Yuezhang.Mo
  2024-10-14 10:33   ` syzbot
  2024-10-17  2:20 ` Yuezhang.Mo
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 17+ messages in thread
From: Yuezhang.Mo @ 2024-10-14  9:00 UTC (permalink / raw)
  To: syzbot, linkinjeon@kernel.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org, sj1557.seo@samsung.com,
	syzkaller-bugs@googlegroups.com

[-- Attachment #1: Type: text/plain, Size: 9144 bytes --]

#syz test

On Sat, Oct 5, 2024 at 8:02 PM syzbot <syzbot+01218003be74b5e1213a@syzkaller.appspotmail.com> wrote:
>
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit:    e32cde8d2bd7 Merge tag 'sched_ext-for-6.12-rc1-fixes-1'
> of..
> git tree:       upstream
> console+strace:
> https://urldefense.com/v3/__https://syzkaller.appspot.com/x/log.txt?x=16cf7d
> d0580000__;!!JmoZiZGBv3RvKRSx!_EFM31JxDI_sBC6NhWwWIWcja8UUVBXZY
> WyhK0O9vUuSsqy-ZOla4TuepNTA3X-btBmzePMIOD0CGeGE0kSF4M2hOwVy5
> 7mr5yQIbTA6$
> kernel config:
> https://urldefense.com/v3/__https://syzkaller.appspot.com/x/.config?x=b1fd45
> f2013d812f__;!!JmoZiZGBv3RvKRSx!_EFM31JxDI_sBC6NhWwWIWcja8UUVBX
> ZYWyhK0O9vUuSsqy-ZOla4TuepNTA3X-btBmzePMIOD0CGeGE0kSF4M2hOwV
> y57mr50IfSXOd$
> dashboard link:
> https://urldefense.com/v3/__https://syzkaller.appspot.com/bug?extid=012180
> 03be74b5e1213a__;!!JmoZiZGBv3RvKRSx!_EFM31JxDI_sBC6NhWwWIWcja8U
> UVBXZYWyhK0O9vUuSsqy-ZOla4TuepNTA3X-btBmzePMIOD0CGeGE0kSF4M2h
> OwVy57mr5-IoYOKx$
> compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian)
> 2.40
> syz repro:
> https://urldefense.com/v3/__https://syzkaller.appspot.com/x/repro.syz?x=11cf
> 7dd0580000__;!!JmoZiZGBv3RvKRSx!_EFM31JxDI_sBC6NhWwWIWcja8UUVB
> XZYWyhK0O9vUuSsqy-ZOla4TuepNTA3X-btBmzePMIOD0CGeGE0kSF4M2hOw
> Vy57mr58TvVCus$
> C reproducer:
> https://urldefense.com/v3/__https://syzkaller.appspot.com/x/repro.c?x=11d06
> 580580000__;!!JmoZiZGBv3RvKRSx!_EFM31JxDI_sBC6NhWwWIWcja8UUVBXZ
> YWyhK0O9vUuSsqy-ZOla4TuepNTA3X-btBmzePMIOD0CGeGE0kSF4M2hOwVy
> 57mr5w2Sgp57$
>
> Downloadable assets:
> disk image:
> https://urldefense.com/v3/__https://storage.googleapis.com/syzbot-assets/16
> d4da549bf4/disk-e32cde8d.raw.xz__;!!JmoZiZGBv3RvKRSx!_EFM31JxDI_sBC6
> NhWwWIWcja8UUVBXZYWyhK0O9vUuSsqy-ZOla4TuepNTA3X-btBmzePMIOD0
> CGeGE0kSF4M2hOwVy57mr54CRCyjy$
> vmlinux:
> https://urldefense.com/v3/__https://storage.googleapis.com/syzbot-assets/a01
> bc9a0e174/vmlinux-e32cde8d.xz__;!!JmoZiZGBv3RvKRSx!_EFM31JxDI_sBC6N
> hWwWIWcja8UUVBXZYWyhK0O9vUuSsqy-ZOla4TuepNTA3X-btBmzePMIOD0C
> GeGE0kSF4M2hOwVy57mr5_9fwsZ2$
> kernel image:
> https://urldefense.com/v3/__https://storage.googleapis.com/syzbot-assets/93f
> 4dfad6909/bzImage-e32cde8d.xz__;!!JmoZiZGBv3RvKRSx!_EFM31JxDI_sBC6N
> hWwWIWcja8UUVBXZYWyhK0O9vUuSsqy-ZOla4TuepNTA3X-btBmzePMIOD0C
> GeGE0kSF4M2hOwVy57mr54HU84Yj$
> mounted in repro:
> https://urldefense.com/v3/__https://storage.googleapis.com/syzbot-assets/43
> 3ba0700154/mount_0.gz__;!!JmoZiZGBv3RvKRSx!_EFM31JxDI_sBC6NhWwWI
> Wcja8UUVBXZYWyhK0O9vUuSsqy-ZOla4TuepNTA3X-btBmzePMIOD0CGeGE0k
> SF4M2hOwVy57mr51x55siW$
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by:
> mailto:syzbot+01218003be74b5e1213a@syzkaller.appspotmail.com
>
> exFAT-fs (loop0): failed to load upcase table (idx : 0x00010000, chksum :
> 0x726052d3, utbl_chksum : 0xe619d30d)
> =====================================================
> BUG: KMSAN: uninit-value in __exfat_get_dentry_set+0x10ca/0x14d0
> fs/exfat/dir.c:804
>  __exfat_get_dentry_set+0x10ca/0x14d0 fs/exfat/dir.c:804
>  exfat_get_dentry_set+0x58/0xec0 fs/exfat/dir.c:859
>  __exfat_write_inode+0x3c1/0xe30 fs/exfat/inode.c:46
>  __exfat_truncate+0x7f3/0xbb0 fs/exfat/file.c:211
>  exfat_truncate+0xee/0x2a0 fs/exfat/file.c:257
>  exfat_write_failed fs/exfat/inode.c:421 [inline]
>  exfat_direct_IO+0x5a3/0x900 fs/exfat/inode.c:485
>  generic_file_direct_write+0x275/0x6a0 mm/filemap.c:3977
>  __generic_file_write_iter+0x242/0x460 mm/filemap.c:4141
>  exfat_file_write_iter+0x894/0xfb0 fs/exfat/file.c:598
>  do_iter_readv_writev+0x88a/0xa30
>  vfs_writev+0x56a/0x14f0 fs/read_write.c:1064
>  do_pwritev fs/read_write.c:1165 [inline]
>  __do_sys_pwritev2 fs/read_write.c:1224 [inline]
>  __se_sys_pwritev2+0x280/0x470 fs/read_write.c:1215
>  __x64_sys_pwritev2+0x11f/0x1a0 fs/read_write.c:1215
>  x64_sys_call+0x2edb/0x3ba0
> arch/x86/include/generated/asm/syscalls_64.h:329
>  do_syscall_x64 arch/x86/entry/common.c:52 [inline]
>  do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83
>  entry_SYSCALL_64_after_hwframe+0x77/0x7f
>
> Uninit was stored to memory at:
>  memcpy_to_iter lib/iov_iter.c:65 [inline]
>  iterate_bvec include/linux/iov_iter.h:123 [inline]
>  iterate_and_advance2 include/linux/iov_iter.h:304 [inline]
>  iterate_and_advance include/linux/iov_iter.h:328 [inline]
>  _copy_to_iter+0xe53/0x2b30 lib/iov_iter.c:185
>  copy_page_to_iter+0x419/0x880 lib/iov_iter.c:362
>  shmem_file_read_iter+0xa09/0x12b0 mm/shmem.c:3167
>  do_iter_readv_writev+0x88a/0xa30
>  vfs_iter_read+0x278/0x760 fs/read_write.c:923
>  lo_read_simple drivers/block/loop.c:283 [inline]
>  do_req_filebacked drivers/block/loop.c:516 [inline]
>  loop_handle_cmd drivers/block/loop.c:1910 [inline]
>  loop_process_work+0x20fc/0x3750 drivers/block/loop.c:1945
>  loop_rootcg_workfn+0x2b/0x40 drivers/block/loop.c:1976
>  process_one_work kernel/workqueue.c:3229 [inline]
>  process_scheduled_works+0xae0/0x1c40 kernel/workqueue.c:3310
>  worker_thread+0xea7/0x14f0 kernel/workqueue.c:3391
>  kthread+0x3e2/0x540 kernel/kthread.c:389
>  ret_from_fork+0x6d/0x90 arch/x86/kernel/process.c:147
>  ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
>
> Uninit was stored to memory at:
>  memcpy_from_iter lib/iov_iter.c:73 [inline]
>  iterate_bvec include/linux/iov_iter.h:123 [inline]
>  iterate_and_advance2 include/linux/iov_iter.h:304 [inline]
>  iterate_and_advance include/linux/iov_iter.h:328 [inline]
>  __copy_from_iter lib/iov_iter.c:249 [inline]
>  copy_page_from_iter_atomic+0x12b7/0x3100 lib/iov_iter.c:481
>  copy_folio_from_iter_atomic include/linux/uio.h:201 [inline]
>  generic_perform_write+0x8d1/0x1080 mm/filemap.c:4066
>  shmem_file_write_iter+0x2ba/0x2f0 mm/shmem.c:3221
>  do_iter_readv_writev+0x88a/0xa30
>  vfs_iter_write+0x44d/0xd40 fs/read_write.c:988
>  lo_write_bvec drivers/block/loop.c:243 [inline]
>  lo_write_simple drivers/block/loop.c:264 [inline]
>  do_req_filebacked drivers/block/loop.c:511 [inline]
>  loop_handle_cmd drivers/block/loop.c:1910 [inline]
>  loop_process_work+0x15e6/0x3750 drivers/block/loop.c:1945
>  loop_rootcg_workfn+0x2b/0x40 drivers/block/loop.c:1976
>  process_one_work kernel/workqueue.c:3229 [inline]
>  process_scheduled_works+0xae0/0x1c40 kernel/workqueue.c:3310
>  worker_thread+0xea7/0x14f0 kernel/workqueue.c:3391
>  kthread+0x3e2/0x540 kernel/kthread.c:389
>  ret_from_fork+0x6d/0x90 arch/x86/kernel/process.c:147
>  ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
>
> Uninit was created at:
>  __alloc_pages_noprof+0x9d6/0xe70 mm/page_alloc.c:4756
>  alloc_pages_mpol_noprof+0x299/0x990 mm/mempolicy.c:2265
>  alloc_pages_noprof mm/mempolicy.c:2345 [inline]
>  folio_alloc_noprof+0x1db/0x310 mm/mempolicy.c:2352
>  filemap_alloc_folio_noprof+0xa6/0x440 mm/filemap.c:1010
>  __filemap_get_folio+0xac4/0x1550 mm/filemap.c:1952
>  block_write_begin+0x6e/0x2b0 fs/buffer.c:2226
>  exfat_write_begin+0xfb/0x400 fs/exfat/inode.c:434
>  exfat_extend_valid_size fs/exfat/file.c:553 [inline]
>  exfat_file_write_iter+0x474/0xfb0 fs/exfat/file.c:588
>  do_iter_readv_writev+0x88a/0xa30
>  vfs_writev+0x56a/0x14f0 fs/read_write.c:1064
>  do_pwritev fs/read_write.c:1165 [inline]
>  __do_sys_pwritev2 fs/read_write.c:1224 [inline]
>  __se_sys_pwritev2+0x280/0x470 fs/read_write.c:1215
>  __x64_sys_pwritev2+0x11f/0x1a0 fs/read_write.c:1215
>  x64_sys_call+0x2edb/0x3ba0
> arch/x86/include/generated/asm/syscalls_64.h:329
>  do_syscall_x64 arch/x86/entry/common.c:52 [inline]
>  do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83
>  entry_SYSCALL_64_after_hwframe+0x77/0x7f
>
> CPU: 0 UID: 0 PID: 5188 Comm: syz-executor221 Not tainted
> 6.12.0-rc1-syzkaller-00031-ge32cde8d2bd7 #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
> Google 09/13/2024
> =====================================================
>
>
> ---
> This report is generated by a bot. It may contain errors.
> See
> https://urldefense.com/v3/__https://goo.gl/tpsmEJ__;!!JmoZiZGBv3RvKRSx!_E
> FM31JxDI_sBC6NhWwWIWcja8UUVBXZYWyhK0O9vUuSsqy-ZOla4TuepNTA3X-
> btBmzePMIOD0CGeGE0kSF4M2hOwVy57mr50hLBEHu$ for more information
> about syzbot.
> syzbot engineers can be reached at mailto:syzkaller@googlegroups.com.
>
> syzbot will keep track of this issue. See:
> https://urldefense.com/v3/__https://goo.gl/tpsmEJ*status__;Iw!!JmoZiZGBv3R
> vKRSx!_EFM31JxDI_sBC6NhWwWIWcja8UUVBXZYWyhK0O9vUuSsqy-ZOla4Tu
> epNTA3X-btBmzePMIOD0CGeGE0kSF4M2hOwVy57mr55Eybub8$ 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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-exfat-check-shutdown-flag-before-truncate.patch --]
[-- Type: text/x-patch; name="0001-exfat-check-shutdown-flag-before-truncate.patch", Size: 707 bytes --]

From 55e7e1f223d9648b3758622a8ca7af058f7c980a Mon Sep 17 00:00:00 2001
From: Yuezhang Mo <Yuezhang.Mo@sony.com>
Date: Mon, 14 Oct 2024 16:45:47 +0800
Subject: [PATCH] exfat: check shutdown flag before truncate

Signed-off-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
---
 fs/exfat/file.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/exfat/file.c b/fs/exfat/file.c
index a25d7eb789f4..979a17919c21 100644
--- a/fs/exfat/file.c
+++ b/fs/exfat/file.c
@@ -245,6 +245,9 @@ void exfat_truncate(struct inode *inode)
 	struct exfat_inode_info *ei = EXFAT_I(inode);
 	int err;
 
+	if (unlikely(exfat_forced_shutdown(sb)))
+		return;
+
 	mutex_lock(&sbi->s_lock);
 	if (ei->start_clu == 0) {
 		/*
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [syzbot] [exfat?] KMSAN: uninit-value in __exfat_get_dentry_set
  2024-10-14  9:00 ` Yuezhang.Mo
@ 2024-10-14 10:33   ` syzbot
  0 siblings, 0 replies; 17+ messages in thread
From: syzbot @ 2024-10-14 10:33 UTC (permalink / raw)
  To: linkinjeon, linux-fsdevel, linux-kernel, sj1557.seo,
	syzkaller-bugs, yuezhang.mo

Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
KMSAN: uninit-value in __exfat_get_dentry_set

loop0: detected capacity change from 0 to 256
exFAT-fs (loop0): failed to load upcase table (idx : 0x00010000, chksum : 0x726052d3, utbl_chksum : 0xe619d30d)
=====================================================
BUG: KMSAN: uninit-value in __exfat_get_dentry_set+0x10ca/0x14d0 fs/exfat/dir.c:804
 __exfat_get_dentry_set+0x10ca/0x14d0 fs/exfat/dir.c:804
 exfat_get_dentry_set+0x58/0xec0 fs/exfat/dir.c:859
 __exfat_write_inode+0x3c1/0xe30 fs/exfat/inode.c:46
 __exfat_truncate+0x7f3/0xbb0 fs/exfat/file.c:211
 exfat_truncate+0x154/0x330 fs/exfat/file.c:260
 exfat_write_failed fs/exfat/inode.c:421 [inline]
 exfat_direct_IO+0x5a3/0x900 fs/exfat/inode.c:485
 generic_file_direct_write+0x275/0x6a0 mm/filemap.c:3977
 __generic_file_write_iter+0x242/0x460 mm/filemap.c:4141
 exfat_file_write_iter+0x894/0xfb0 fs/exfat/file.c:601
 do_iter_readv_writev+0x88a/0xa30
 vfs_writev+0x56a/0x14f0 fs/read_write.c:1064
 do_pwritev fs/read_write.c:1165 [inline]
 __do_sys_pwritev2 fs/read_write.c:1224 [inline]
 __se_sys_pwritev2+0x280/0x470 fs/read_write.c:1215
 __x64_sys_pwritev2+0x11f/0x1a0 fs/read_write.c:1215
 x64_sys_call+0x2edb/0x3ba0 arch/x86/include/generated/asm/syscalls_64.h:329
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Uninit was stored to memory at:
 memcpy_to_iter lib/iov_iter.c:65 [inline]
 iterate_bvec include/linux/iov_iter.h:123 [inline]
 iterate_and_advance2 include/linux/iov_iter.h:304 [inline]
 iterate_and_advance include/linux/iov_iter.h:328 [inline]
 _copy_to_iter+0xe53/0x2b30 lib/iov_iter.c:185
 copy_page_to_iter+0x419/0x880 lib/iov_iter.c:362
 shmem_file_read_iter+0xa09/0x12b0 mm/shmem.c:3167
 do_iter_readv_writev+0x88a/0xa30
 vfs_iter_read+0x278/0x760 fs/read_write.c:923
 lo_read_simple drivers/block/loop.c:283 [inline]
 do_req_filebacked drivers/block/loop.c:516 [inline]
 loop_handle_cmd drivers/block/loop.c:1910 [inline]
 loop_process_work+0x20fc/0x3750 drivers/block/loop.c:1945
 loop_workfn+0x48/0x60 drivers/block/loop.c:1969
 process_one_work kernel/workqueue.c:3229 [inline]
 process_scheduled_works+0xae0/0x1c40 kernel/workqueue.c:3310
 worker_thread+0xea7/0x14f0 kernel/workqueue.c:3391
 kthread+0x3e2/0x540 kernel/kthread.c:389
 ret_from_fork+0x6d/0x90 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244

Uninit was stored to memory at:
 memcpy_from_iter lib/iov_iter.c:73 [inline]
 iterate_bvec include/linux/iov_iter.h:123 [inline]
 iterate_and_advance2 include/linux/iov_iter.h:304 [inline]
 iterate_and_advance include/linux/iov_iter.h:328 [inline]
 __copy_from_iter lib/iov_iter.c:249 [inline]
 copy_page_from_iter_atomic+0x12b7/0x3100 lib/iov_iter.c:481
 copy_folio_from_iter_atomic include/linux/uio.h:201 [inline]
 generic_perform_write+0x8d1/0x1080 mm/filemap.c:4066
 shmem_file_write_iter+0x2ba/0x2f0 mm/shmem.c:3221
 do_iter_readv_writev+0x88a/0xa30
 vfs_iter_write+0x44d/0xd40 fs/read_write.c:988
 lo_write_bvec drivers/block/loop.c:243 [inline]
 lo_write_simple drivers/block/loop.c:264 [inline]
 do_req_filebacked drivers/block/loop.c:511 [inline]
 loop_handle_cmd drivers/block/loop.c:1910 [inline]
 loop_process_work+0x15e6/0x3750 drivers/block/loop.c:1945
 loop_workfn+0x48/0x60 drivers/block/loop.c:1969
 process_one_work kernel/workqueue.c:3229 [inline]
 process_scheduled_works+0xae0/0x1c40 kernel/workqueue.c:3310
 worker_thread+0xea7/0x14f0 kernel/workqueue.c:3391
 kthread+0x3e2/0x540 kernel/kthread.c:389
 ret_from_fork+0x6d/0x90 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244

Uninit was created at:
 __alloc_pages_noprof+0x9a7/0xe00 mm/page_alloc.c:4756
 alloc_pages_mpol_noprof+0x299/0x990 mm/mempolicy.c:2265
 alloc_pages_noprof mm/mempolicy.c:2345 [inline]
 folio_alloc_noprof+0x1db/0x310 mm/mempolicy.c:2352
 filemap_alloc_folio_noprof+0xa6/0x440 mm/filemap.c:1010
 __filemap_get_folio+0xac4/0x1550 mm/filemap.c:1952
 block_write_begin+0x6e/0x2b0 fs/buffer.c:2226
 exfat_write_begin+0xfb/0x400 fs/exfat/inode.c:434
 exfat_extend_valid_size fs/exfat/file.c:556 [inline]
 exfat_file_write_iter+0x474/0xfb0 fs/exfat/file.c:591
 do_iter_readv_writev+0x88a/0xa30
 vfs_writev+0x56a/0x14f0 fs/read_write.c:1064
 do_pwritev fs/read_write.c:1165 [inline]
 __do_sys_pwritev2 fs/read_write.c:1224 [inline]
 __se_sys_pwritev2+0x280/0x470 fs/read_write.c:1215
 __x64_sys_pwritev2+0x11f/0x1a0 fs/read_write.c:1215
 x64_sys_call+0x2edb/0x3ba0 arch/x86/include/generated/asm/syscalls_64.h:329
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

CPU: 0 UID: 0 PID: 6021 Comm: syz.0.15 Not tainted 6.12.0-rc3-syzkaller-g6485cf5ea253-dirty #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
=====================================================


Tested on:

commit:         6485cf5e Merge tag 'hid-for-linus-2024101301' of git:/..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=13b50030580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=5242e0e980477c72
dashboard link: https://syzkaller.appspot.com/bug?extid=01218003be74b5e1213a
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch:          https://syzkaller.appspot.com/x/patch.diff?x=1151c727980000


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [syzbot] [exfat?] KMSAN: uninit-value in __exfat_get_dentry_set
  2024-10-05 14:32 [syzbot] [exfat?] KMSAN: uninit-value in __exfat_get_dentry_set syzbot
                   ` (2 preceding siblings ...)
  2024-10-14  9:00 ` Yuezhang.Mo
@ 2024-10-17  2:20 ` Yuezhang.Mo
  2024-10-17  2:57   ` syzbot
  2024-10-17  9:49 ` Yuezhang.Mo
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 17+ messages in thread
From: Yuezhang.Mo @ 2024-10-17  2:20 UTC (permalink / raw)
  To: syzbot, linkinjeon@kernel.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org, sj1557.seo@samsung.com,
	syzkaller-bugs@googlegroups.com

[-- Attachment #1: Type: text/plain, Size: 9344 bytes --]

#syz test

On Sat, Oct 5, 2024 at 8:02 PM syzbot <syzbot+01218003be74b5e1213a@syzkaller.appspotmail.com> wrote:
>
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit:    e32cde8d2bd7 Merge tag 'sched_ext-for-6.12-rc1-fixes-1'
> of..
> git tree:       upstream
> console+strace:
> https://urldefense.com/v3/__https://syzkaller.appspot.com/x/log.txt?x=16cf7d
> d0580000__;!!JmoZiZGBv3RvKRSx!_EFM31JxDI_sBC6NhWwWIWcja8UUVBXZY
> WyhK0O9vUuSsqy-ZOla4TuepNTA3X-btBmzePMIOD0CGeGE0kSF4M2hOwVy5
> 7mr5yQIbTA6$
> kernel config:
> https://urldefense.com/v3/__https://syzkaller.appspot.com/x/.config?x=b1fd45
> f2013d812f__;!!JmoZiZGBv3RvKRSx!_EFM31JxDI_sBC6NhWwWIWcja8UUVBX
> ZYWyhK0O9vUuSsqy-ZOla4TuepNTA3X-btBmzePMIOD0CGeGE0kSF4M2hOwV
> y57mr50IfSXOd$
> dashboard link:
> https://urldefense.com/v3/__https://syzkaller.appspot.com/bug?extid=012180
> 03be74b5e1213a__;!!JmoZiZGBv3RvKRSx!_EFM31JxDI_sBC6NhWwWIWcja8U
> UVBXZYWyhK0O9vUuSsqy-ZOla4TuepNTA3X-btBmzePMIOD0CGeGE0kSF4M2h
> OwVy57mr5-IoYOKx$
> compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian)
> 2.40
> syz repro:
> https://urldefense.com/v3/__https://syzkaller.appspot.com/x/repro.syz?x=11cf
> 7dd0580000__;!!JmoZiZGBv3RvKRSx!_EFM31JxDI_sBC6NhWwWIWcja8UUVB
> XZYWyhK0O9vUuSsqy-ZOla4TuepNTA3X-btBmzePMIOD0CGeGE0kSF4M2hOw
> Vy57mr58TvVCus$
> C reproducer:
> https://urldefense.com/v3/__https://syzkaller.appspot.com/x/repro.c?x=11d06
> 580580000__;!!JmoZiZGBv3RvKRSx!_EFM31JxDI_sBC6NhWwWIWcja8UUVBXZ
> YWyhK0O9vUuSsqy-ZOla4TuepNTA3X-btBmzePMIOD0CGeGE0kSF4M2hOwVy
> 57mr5w2Sgp57$
>
> Downloadable assets:
> disk image:
> https://urldefense.com/v3/__https://storage.googleapis.com/syzbot-assets/16
> d4da549bf4/disk-e32cde8d.raw.xz__;!!JmoZiZGBv3RvKRSx!_EFM31JxDI_sBC6
> NhWwWIWcja8UUVBXZYWyhK0O9vUuSsqy-ZOla4TuepNTA3X-btBmzePMIOD0
> CGeGE0kSF4M2hOwVy57mr54CRCyjy$
> vmlinux:
> https://urldefense.com/v3/__https://storage.googleapis.com/syzbot-assets/a01
> bc9a0e174/vmlinux-e32cde8d.xz__;!!JmoZiZGBv3RvKRSx!_EFM31JxDI_sBC6N
> hWwWIWcja8UUVBXZYWyhK0O9vUuSsqy-ZOla4TuepNTA3X-btBmzePMIOD0C
> GeGE0kSF4M2hOwVy57mr5_9fwsZ2$
> kernel image:
> https://urldefense.com/v3/__https://storage.googleapis.com/syzbot-assets/93f
> 4dfad6909/bzImage-e32cde8d.xz__;!!JmoZiZGBv3RvKRSx!_EFM31JxDI_sBC6N
> hWwWIWcja8UUVBXZYWyhK0O9vUuSsqy-ZOla4TuepNTA3X-btBmzePMIOD0C
> GeGE0kSF4M2hOwVy57mr54HU84Yj$
> mounted in repro:
> https://urldefense.com/v3/__https://storage.googleapis.com/syzbot-assets/43
> 3ba0700154/mount_0.gz__;!!JmoZiZGBv3RvKRSx!_EFM31JxDI_sBC6NhWwWI
> Wcja8UUVBXZYWyhK0O9vUuSsqy-ZOla4TuepNTA3X-btBmzePMIOD0CGeGE0k
> SF4M2hOwVy57mr51x55siW$
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by:
> mailto:syzbot+01218003be74b5e1213a@syzkaller.appspotmail.com
>
> exFAT-fs (loop0): failed to load upcase table (idx : 0x00010000, chksum :
> 0x726052d3, utbl_chksum : 0xe619d30d)
> =====================================================
> BUG: KMSAN: uninit-value in __exfat_get_dentry_set+0x10ca/0x14d0
> fs/exfat/dir.c:804
>  __exfat_get_dentry_set+0x10ca/0x14d0 fs/exfat/dir.c:804
>  exfat_get_dentry_set+0x58/0xec0 fs/exfat/dir.c:859
>  __exfat_write_inode+0x3c1/0xe30 fs/exfat/inode.c:46
>  __exfat_truncate+0x7f3/0xbb0 fs/exfat/file.c:211
>  exfat_truncate+0xee/0x2a0 fs/exfat/file.c:257
>  exfat_write_failed fs/exfat/inode.c:421 [inline]
>  exfat_direct_IO+0x5a3/0x900 fs/exfat/inode.c:485
>  generic_file_direct_write+0x275/0x6a0 mm/filemap.c:3977
>  __generic_file_write_iter+0x242/0x460 mm/filemap.c:4141
>  exfat_file_write_iter+0x894/0xfb0 fs/exfat/file.c:598
>  do_iter_readv_writev+0x88a/0xa30
>  vfs_writev+0x56a/0x14f0 fs/read_write.c:1064
>  do_pwritev fs/read_write.c:1165 [inline]
>  __do_sys_pwritev2 fs/read_write.c:1224 [inline]
>  __se_sys_pwritev2+0x280/0x470 fs/read_write.c:1215
>  __x64_sys_pwritev2+0x11f/0x1a0 fs/read_write.c:1215
>  x64_sys_call+0x2edb/0x3ba0
> arch/x86/include/generated/asm/syscalls_64.h:329
>  do_syscall_x64 arch/x86/entry/common.c:52 [inline]
>  do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83
>  entry_SYSCALL_64_after_hwframe+0x77/0x7f
>
> Uninit was stored to memory at:
>  memcpy_to_iter lib/iov_iter.c:65 [inline]
>  iterate_bvec include/linux/iov_iter.h:123 [inline]
>  iterate_and_advance2 include/linux/iov_iter.h:304 [inline]
>  iterate_and_advance include/linux/iov_iter.h:328 [inline]
>  _copy_to_iter+0xe53/0x2b30 lib/iov_iter.c:185
>  copy_page_to_iter+0x419/0x880 lib/iov_iter.c:362
>  shmem_file_read_iter+0xa09/0x12b0 mm/shmem.c:3167
>  do_iter_readv_writev+0x88a/0xa30
>  vfs_iter_read+0x278/0x760 fs/read_write.c:923
>  lo_read_simple drivers/block/loop.c:283 [inline]
>  do_req_filebacked drivers/block/loop.c:516 [inline]
>  loop_handle_cmd drivers/block/loop.c:1910 [inline]
>  loop_process_work+0x20fc/0x3750 drivers/block/loop.c:1945
>  loop_rootcg_workfn+0x2b/0x40 drivers/block/loop.c:1976
>  process_one_work kernel/workqueue.c:3229 [inline]
>  process_scheduled_works+0xae0/0x1c40 kernel/workqueue.c:3310
>  worker_thread+0xea7/0x14f0 kernel/workqueue.c:3391
>  kthread+0x3e2/0x540 kernel/kthread.c:389
>  ret_from_fork+0x6d/0x90 arch/x86/kernel/process.c:147
>  ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
>
> Uninit was stored to memory at:
>  memcpy_from_iter lib/iov_iter.c:73 [inline]
>  iterate_bvec include/linux/iov_iter.h:123 [inline]
>  iterate_and_advance2 include/linux/iov_iter.h:304 [inline]
>  iterate_and_advance include/linux/iov_iter.h:328 [inline]
>  __copy_from_iter lib/iov_iter.c:249 [inline]
>  copy_page_from_iter_atomic+0x12b7/0x3100 lib/iov_iter.c:481
>  copy_folio_from_iter_atomic include/linux/uio.h:201 [inline]
>  generic_perform_write+0x8d1/0x1080 mm/filemap.c:4066
>  shmem_file_write_iter+0x2ba/0x2f0 mm/shmem.c:3221
>  do_iter_readv_writev+0x88a/0xa30
>  vfs_iter_write+0x44d/0xd40 fs/read_write.c:988
>  lo_write_bvec drivers/block/loop.c:243 [inline]
>  lo_write_simple drivers/block/loop.c:264 [inline]
>  do_req_filebacked drivers/block/loop.c:511 [inline]
>  loop_handle_cmd drivers/block/loop.c:1910 [inline]
>  loop_process_work+0x15e6/0x3750 drivers/block/loop.c:1945
>  loop_rootcg_workfn+0x2b/0x40 drivers/block/loop.c:1976
>  process_one_work kernel/workqueue.c:3229 [inline]
>  process_scheduled_works+0xae0/0x1c40 kernel/workqueue.c:3310
>  worker_thread+0xea7/0x14f0 kernel/workqueue.c:3391
>  kthread+0x3e2/0x540 kernel/kthread.c:389
>  ret_from_fork+0x6d/0x90 arch/x86/kernel/process.c:147
>  ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
>
> Uninit was created at:
>  __alloc_pages_noprof+0x9d6/0xe70 mm/page_alloc.c:4756
>  alloc_pages_mpol_noprof+0x299/0x990 mm/mempolicy.c:2265
>  alloc_pages_noprof mm/mempolicy.c:2345 [inline]
>  folio_alloc_noprof+0x1db/0x310 mm/mempolicy.c:2352
>  filemap_alloc_folio_noprof+0xa6/0x440 mm/filemap.c:1010
>  __filemap_get_folio+0xac4/0x1550 mm/filemap.c:1952
>  block_write_begin+0x6e/0x2b0 fs/buffer.c:2226
>  exfat_write_begin+0xfb/0x400 fs/exfat/inode.c:434
>  exfat_extend_valid_size fs/exfat/file.c:553 [inline]
>  exfat_file_write_iter+0x474/0xfb0 fs/exfat/file.c:588
>  do_iter_readv_writev+0x88a/0xa30
>  vfs_writev+0x56a/0x14f0 fs/read_write.c:1064
>  do_pwritev fs/read_write.c:1165 [inline]
>  __do_sys_pwritev2 fs/read_write.c:1224 [inline]
>  __se_sys_pwritev2+0x280/0x470 fs/read_write.c:1215
>  __x64_sys_pwritev2+0x11f/0x1a0 fs/read_write.c:1215
>  x64_sys_call+0x2edb/0x3ba0
> arch/x86/include/generated/asm/syscalls_64.h:329
>  do_syscall_x64 arch/x86/entry/common.c:52 [inline]
>  do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83
>  entry_SYSCALL_64_after_hwframe+0x77/0x7f
>
> CPU: 0 UID: 0 PID: 5188 Comm: syz-executor221 Not tainted
> 6.12.0-rc1-syzkaller-00031-ge32cde8d2bd7 #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
> Google 09/13/2024
> =====================================================
>
>
> ---
> This report is generated by a bot. It may contain errors.
> See
> https://urldefense.com/v3/__https://goo.gl/tpsmEJ__;!!JmoZiZGBv3RvKRSx!_E
> FM31JxDI_sBC6NhWwWIWcja8UUVBXZYWyhK0O9vUuSsqy-ZOla4TuepNTA3X-
> btBmzePMIOD0CGeGE0kSF4M2hOwVy57mr50hLBEHu$ for more information
> about syzbot.
> syzbot engineers can be reached at mailto:syzkaller@googlegroups.com.
>
> syzbot will keep track of this issue. See:
> https://urldefense.com/v3/__https://goo.gl/tpsmEJ*status__;Iw!!JmoZiZGBv3R
> vKRSx!_EFM31JxDI_sBC6NhWwWIWcja8UUVBXZYWyhK0O9vUuSsqy-ZOla4Tu
> epNTA3X-btBmzePMIOD0CGeGE0kSF4M2hOwVy57mr55Eybub8$ 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

[-- Attachment #2: 0001-exfat-check-alignment-before-extending-valid_size.patch --]
[-- Type: application/octet-stream, Size: 1436 bytes --]

From cb413b89b8c222b900b5f52700b5499567f7cbea Mon Sep 17 00:00:00 2001
From: Yuezhang Mo <Yuezhang.Mo@sony.com>
Date: Thu, 17 Oct 2024 09:25:06 +0800
Subject: [PATCH] exfat: check alignment before extending ->valid_size

Signed-off-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
---
 fs/exfat/file.c  | 6 ++++++
 fs/exfat/inode.c | 4 +++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/fs/exfat/file.c b/fs/exfat/file.c
index a25d7eb789f4..a00f3f1b2cbb 100644
--- a/fs/exfat/file.c
+++ b/fs/exfat/file.c
@@ -584,6 +584,12 @@ static ssize_t exfat_file_write_iter(struct kiocb *iocb, struct iov_iter *iter)
 	if (ret < 0)
 		goto unlock;
 
+	if ((iocb->ki_flags & IOCB_DIRECT) &&
+	    EXFAT_BLK_OFFSET(pos | ret, inode->i_sb)) {
+		ret = -EINVAL;
+		goto unlock;
+	}
+
 	if (pos > valid_size) {
 		ret = exfat_extend_valid_size(file, pos);
 		if (ret < 0 && ret != -ENOSPC) {
diff --git a/fs/exfat/inode.c b/fs/exfat/inode.c
index d338a59c27f7..dad570e3d5ef 100644
--- a/fs/exfat/inode.c
+++ b/fs/exfat/inode.c
@@ -481,8 +481,10 @@ static ssize_t exfat_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
 	 */
 	ret = blockdev_direct_IO(iocb, inode, iter, exfat_get_block);
 	if (ret < 0) {
-		if (rw == WRITE && ret != -EIOCBQUEUED)
+		if (rw == WRITE && ret != -EIOCBQUEUED) {
+			pr_err("%s(): %d: ret = %zd\n", __FUNCTION__, __LINE__, ret);
 			exfat_write_failed(mapping, size);
+		}
 
 		return ret;
 	} else
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [syzbot] [exfat?] KMSAN: uninit-value in __exfat_get_dentry_set
  2024-10-17  2:20 ` Yuezhang.Mo
@ 2024-10-17  2:57   ` syzbot
  2024-10-17  3:32     ` Yuezhang.Mo
  0 siblings, 1 reply; 17+ messages in thread
From: syzbot @ 2024-10-17  2:57 UTC (permalink / raw)
  To: linkinjeon, linux-fsdevel, linux-kernel, sj1557.seo,
	syzkaller-bugs, yuezhang.mo

Hello,

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

Reported-by: syzbot+01218003be74b5e1213a@syzkaller.appspotmail.com
Tested-by: syzbot+01218003be74b5e1213a@syzkaller.appspotmail.com

Tested on:

commit:         c964ced7 Merge tag 'for-linus' of git://git.kernel.org..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=12c43030580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=5242e0e980477c72
dashboard link: https://syzkaller.appspot.com/bug?extid=01218003be74b5e1213a
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch:          https://syzkaller.appspot.com/x/patch.diff?x=1738345f980000

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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* RE: [syzbot] [exfat?] KMSAN: uninit-value in __exfat_get_dentry_set
  2024-10-17  2:57   ` syzbot
@ 2024-10-17  3:32     ` Yuezhang.Mo
  2024-10-17  4:18       ` syzbot
  0 siblings, 1 reply; 17+ messages in thread
From: Yuezhang.Mo @ 2024-10-17  3:32 UTC (permalink / raw)
  To: syzbot, linkinjeon@kernel.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org, sj1557.seo@samsung.com,
	syzkaller-bugs@googlegroups.com

[-- Attachment #1: Type: text/plain, Size: 9344 bytes --]

#syz test

On Sat, Oct 5, 2024 at 8:02 PM syzbot <syzbot+01218003be74b5e1213a@syzkaller.appspotmail.com> wrote:
>
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit:    e32cde8d2bd7 Merge tag 'sched_ext-for-6.12-rc1-fixes-1'
> of..
> git tree:       upstream
> console+strace:
> https://urldefense.com/v3/__https://syzkaller.appspot.com/x/log.txt?x=16cf7d
> d0580000__;!!JmoZiZGBv3RvKRSx!_EFM31JxDI_sBC6NhWwWIWcja8UUVBXZY
> WyhK0O9vUuSsqy-ZOla4TuepNTA3X-btBmzePMIOD0CGeGE0kSF4M2hOwVy5
> 7mr5yQIbTA6$
> kernel config:
> https://urldefense.com/v3/__https://syzkaller.appspot.com/x/.config?x=b1fd45
> f2013d812f__;!!JmoZiZGBv3RvKRSx!_EFM31JxDI_sBC6NhWwWIWcja8UUVBX
> ZYWyhK0O9vUuSsqy-ZOla4TuepNTA3X-btBmzePMIOD0CGeGE0kSF4M2hOwV
> y57mr50IfSXOd$
> dashboard link:
> https://urldefense.com/v3/__https://syzkaller.appspot.com/bug?extid=012180
> 03be74b5e1213a__;!!JmoZiZGBv3RvKRSx!_EFM31JxDI_sBC6NhWwWIWcja8U
> UVBXZYWyhK0O9vUuSsqy-ZOla4TuepNTA3X-btBmzePMIOD0CGeGE0kSF4M2h
> OwVy57mr5-IoYOKx$
> compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian)
> 2.40
> syz repro:
> https://urldefense.com/v3/__https://syzkaller.appspot.com/x/repro.syz?x=11cf
> 7dd0580000__;!!JmoZiZGBv3RvKRSx!_EFM31JxDI_sBC6NhWwWIWcja8UUVB
> XZYWyhK0O9vUuSsqy-ZOla4TuepNTA3X-btBmzePMIOD0CGeGE0kSF4M2hOw
> Vy57mr58TvVCus$
> C reproducer:
> https://urldefense.com/v3/__https://syzkaller.appspot.com/x/repro.c?x=11d06
> 580580000__;!!JmoZiZGBv3RvKRSx!_EFM31JxDI_sBC6NhWwWIWcja8UUVBXZ
> YWyhK0O9vUuSsqy-ZOla4TuepNTA3X-btBmzePMIOD0CGeGE0kSF4M2hOwVy
> 57mr5w2Sgp57$
>
> Downloadable assets:
> disk image:
> https://urldefense.com/v3/__https://storage.googleapis.com/syzbot-assets/16
> d4da549bf4/disk-e32cde8d.raw.xz__;!!JmoZiZGBv3RvKRSx!_EFM31JxDI_sBC6
> NhWwWIWcja8UUVBXZYWyhK0O9vUuSsqy-ZOla4TuepNTA3X-btBmzePMIOD0
> CGeGE0kSF4M2hOwVy57mr54CRCyjy$
> vmlinux:
> https://urldefense.com/v3/__https://storage.googleapis.com/syzbot-assets/a01
> bc9a0e174/vmlinux-e32cde8d.xz__;!!JmoZiZGBv3RvKRSx!_EFM31JxDI_sBC6N
> hWwWIWcja8UUVBXZYWyhK0O9vUuSsqy-ZOla4TuepNTA3X-btBmzePMIOD0C
> GeGE0kSF4M2hOwVy57mr5_9fwsZ2$
> kernel image:
> https://urldefense.com/v3/__https://storage.googleapis.com/syzbot-assets/93f
> 4dfad6909/bzImage-e32cde8d.xz__;!!JmoZiZGBv3RvKRSx!_EFM31JxDI_sBC6N
> hWwWIWcja8UUVBXZYWyhK0O9vUuSsqy-ZOla4TuepNTA3X-btBmzePMIOD0C
> GeGE0kSF4M2hOwVy57mr54HU84Yj$
> mounted in repro:
> https://urldefense.com/v3/__https://storage.googleapis.com/syzbot-assets/43
> 3ba0700154/mount_0.gz__;!!JmoZiZGBv3RvKRSx!_EFM31JxDI_sBC6NhWwWI
> Wcja8UUVBXZYWyhK0O9vUuSsqy-ZOla4TuepNTA3X-btBmzePMIOD0CGeGE0k
> SF4M2hOwVy57mr51x55siW$
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by:
> mailto:syzbot+01218003be74b5e1213a@syzkaller.appspotmail.com
>
> exFAT-fs (loop0): failed to load upcase table (idx : 0x00010000, chksum :
> 0x726052d3, utbl_chksum : 0xe619d30d)
> =====================================================
> BUG: KMSAN: uninit-value in __exfat_get_dentry_set+0x10ca/0x14d0
> fs/exfat/dir.c:804
>  __exfat_get_dentry_set+0x10ca/0x14d0 fs/exfat/dir.c:804
>  exfat_get_dentry_set+0x58/0xec0 fs/exfat/dir.c:859
>  __exfat_write_inode+0x3c1/0xe30 fs/exfat/inode.c:46
>  __exfat_truncate+0x7f3/0xbb0 fs/exfat/file.c:211
>  exfat_truncate+0xee/0x2a0 fs/exfat/file.c:257
>  exfat_write_failed fs/exfat/inode.c:421 [inline]
>  exfat_direct_IO+0x5a3/0x900 fs/exfat/inode.c:485
>  generic_file_direct_write+0x275/0x6a0 mm/filemap.c:3977
>  __generic_file_write_iter+0x242/0x460 mm/filemap.c:4141
>  exfat_file_write_iter+0x894/0xfb0 fs/exfat/file.c:598
>  do_iter_readv_writev+0x88a/0xa30
>  vfs_writev+0x56a/0x14f0 fs/read_write.c:1064
>  do_pwritev fs/read_write.c:1165 [inline]
>  __do_sys_pwritev2 fs/read_write.c:1224 [inline]
>  __se_sys_pwritev2+0x280/0x470 fs/read_write.c:1215
>  __x64_sys_pwritev2+0x11f/0x1a0 fs/read_write.c:1215
>  x64_sys_call+0x2edb/0x3ba0
> arch/x86/include/generated/asm/syscalls_64.h:329
>  do_syscall_x64 arch/x86/entry/common.c:52 [inline]
>  do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83
>  entry_SYSCALL_64_after_hwframe+0x77/0x7f
>
> Uninit was stored to memory at:
>  memcpy_to_iter lib/iov_iter.c:65 [inline]
>  iterate_bvec include/linux/iov_iter.h:123 [inline]
>  iterate_and_advance2 include/linux/iov_iter.h:304 [inline]
>  iterate_and_advance include/linux/iov_iter.h:328 [inline]
>  _copy_to_iter+0xe53/0x2b30 lib/iov_iter.c:185
>  copy_page_to_iter+0x419/0x880 lib/iov_iter.c:362
>  shmem_file_read_iter+0xa09/0x12b0 mm/shmem.c:3167
>  do_iter_readv_writev+0x88a/0xa30
>  vfs_iter_read+0x278/0x760 fs/read_write.c:923
>  lo_read_simple drivers/block/loop.c:283 [inline]
>  do_req_filebacked drivers/block/loop.c:516 [inline]
>  loop_handle_cmd drivers/block/loop.c:1910 [inline]
>  loop_process_work+0x20fc/0x3750 drivers/block/loop.c:1945
>  loop_rootcg_workfn+0x2b/0x40 drivers/block/loop.c:1976
>  process_one_work kernel/workqueue.c:3229 [inline]
>  process_scheduled_works+0xae0/0x1c40 kernel/workqueue.c:3310
>  worker_thread+0xea7/0x14f0 kernel/workqueue.c:3391
>  kthread+0x3e2/0x540 kernel/kthread.c:389
>  ret_from_fork+0x6d/0x90 arch/x86/kernel/process.c:147
>  ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
>
> Uninit was stored to memory at:
>  memcpy_from_iter lib/iov_iter.c:73 [inline]
>  iterate_bvec include/linux/iov_iter.h:123 [inline]
>  iterate_and_advance2 include/linux/iov_iter.h:304 [inline]
>  iterate_and_advance include/linux/iov_iter.h:328 [inline]
>  __copy_from_iter lib/iov_iter.c:249 [inline]
>  copy_page_from_iter_atomic+0x12b7/0x3100 lib/iov_iter.c:481
>  copy_folio_from_iter_atomic include/linux/uio.h:201 [inline]
>  generic_perform_write+0x8d1/0x1080 mm/filemap.c:4066
>  shmem_file_write_iter+0x2ba/0x2f0 mm/shmem.c:3221
>  do_iter_readv_writev+0x88a/0xa30
>  vfs_iter_write+0x44d/0xd40 fs/read_write.c:988
>  lo_write_bvec drivers/block/loop.c:243 [inline]
>  lo_write_simple drivers/block/loop.c:264 [inline]
>  do_req_filebacked drivers/block/loop.c:511 [inline]
>  loop_handle_cmd drivers/block/loop.c:1910 [inline]
>  loop_process_work+0x15e6/0x3750 drivers/block/loop.c:1945
>  loop_rootcg_workfn+0x2b/0x40 drivers/block/loop.c:1976
>  process_one_work kernel/workqueue.c:3229 [inline]
>  process_scheduled_works+0xae0/0x1c40 kernel/workqueue.c:3310
>  worker_thread+0xea7/0x14f0 kernel/workqueue.c:3391
>  kthread+0x3e2/0x540 kernel/kthread.c:389
>  ret_from_fork+0x6d/0x90 arch/x86/kernel/process.c:147
>  ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
>
> Uninit was created at:
>  __alloc_pages_noprof+0x9d6/0xe70 mm/page_alloc.c:4756
>  alloc_pages_mpol_noprof+0x299/0x990 mm/mempolicy.c:2265
>  alloc_pages_noprof mm/mempolicy.c:2345 [inline]
>  folio_alloc_noprof+0x1db/0x310 mm/mempolicy.c:2352
>  filemap_alloc_folio_noprof+0xa6/0x440 mm/filemap.c:1010
>  __filemap_get_folio+0xac4/0x1550 mm/filemap.c:1952
>  block_write_begin+0x6e/0x2b0 fs/buffer.c:2226
>  exfat_write_begin+0xfb/0x400 fs/exfat/inode.c:434
>  exfat_extend_valid_size fs/exfat/file.c:553 [inline]
>  exfat_file_write_iter+0x474/0xfb0 fs/exfat/file.c:588
>  do_iter_readv_writev+0x88a/0xa30
>  vfs_writev+0x56a/0x14f0 fs/read_write.c:1064
>  do_pwritev fs/read_write.c:1165 [inline]
>  __do_sys_pwritev2 fs/read_write.c:1224 [inline]
>  __se_sys_pwritev2+0x280/0x470 fs/read_write.c:1215
>  __x64_sys_pwritev2+0x11f/0x1a0 fs/read_write.c:1215
>  x64_sys_call+0x2edb/0x3ba0
> arch/x86/include/generated/asm/syscalls_64.h:329
>  do_syscall_x64 arch/x86/entry/common.c:52 [inline]
>  do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83
>  entry_SYSCALL_64_after_hwframe+0x77/0x7f
>
> CPU: 0 UID: 0 PID: 5188 Comm: syz-executor221 Not tainted
> 6.12.0-rc1-syzkaller-00031-ge32cde8d2bd7 #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
> Google 09/13/2024
> =====================================================
>
>
> ---
> This report is generated by a bot. It may contain errors.
> See
> https://urldefense.com/v3/__https://goo.gl/tpsmEJ__;!!JmoZiZGBv3RvKRSx!_E
> FM31JxDI_sBC6NhWwWIWcja8UUVBXZYWyhK0O9vUuSsqy-ZOla4TuepNTA3X-
> btBmzePMIOD0CGeGE0kSF4M2hOwVy57mr50hLBEHu$ for more information
> about syzbot.
> syzbot engineers can be reached at mailto:syzkaller@googlegroups.com.
>
> syzbot will keep track of this issue. See:
> https://urldefense.com/v3/__https://goo.gl/tpsmEJ*status__;Iw!!JmoZiZGBv3R
> vKRSx!_EFM31JxDI_sBC6NhWwWIWcja8UUVBXZYWyhK0O9vUuSsqy-ZOla4Tu
> epNTA3X-btBmzePMIOD0CGeGE0kSF4M2hOwVy57mr55Eybub8$ 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

[-- Attachment #2: 0001-exfat-use-sync_inode_metadata-to-writeback-inode.patch --]
[-- Type: application/octet-stream, Size: 870 bytes --]

From 4070c83d7e93c8ba917dcac5eec742b47db1f150 Mon Sep 17 00:00:00 2001
From: Yuezhang Mo <Yuezhang.Mo@sony.com>
Date: Thu, 17 Oct 2024 09:48:40 +0800
Subject: [PATCH] exfat: use sync_inode_metadata() to writeback inode

Signed-off-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
---
 fs/exfat/file.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/exfat/file.c b/fs/exfat/file.c
index a00f3f1b2cbb..e0b7ff0b5fab 100644
--- a/fs/exfat/file.c
+++ b/fs/exfat/file.c
@@ -208,7 +208,8 @@ int __exfat_truncate(struct inode *inode)
 	 * __exfat_write_inode() is called for directory entry, bitmap
 	 * and FAT to be written in a same writeback.
 	 */
-	if (__exfat_write_inode(inode, inode_needs_sync(inode)))
+	mark_inode_dirty(inode);
+	if (sync_inode_metadata(inode, inode_needs_sync(inode)))
 		return -EIO;
 
 	/* cut off from the FAT chain */
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [syzbot] [exfat?] KMSAN: uninit-value in __exfat_get_dentry_set
  2024-10-17  3:32     ` Yuezhang.Mo
@ 2024-10-17  4:18       ` syzbot
  0 siblings, 0 replies; 17+ messages in thread
From: syzbot @ 2024-10-17  4:18 UTC (permalink / raw)
  To: linkinjeon, linux-fsdevel, linux-kernel, sj1557.seo,
	syzkaller-bugs, yuezhang.mo

Hello,

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

Reported-by: syzbot+01218003be74b5e1213a@syzkaller.appspotmail.com
Tested-by: syzbot+01218003be74b5e1213a@syzkaller.appspotmail.com

Tested on:

commit:         c964ced7 Merge tag 'for-linus' of git://git.kernel.org..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=15ce345f980000
kernel config:  https://syzkaller.appspot.com/x/.config?x=5242e0e980477c72
dashboard link: https://syzkaller.appspot.com/bug?extid=01218003be74b5e1213a
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch:          https://syzkaller.appspot.com/x/patch.diff?x=15ca345f980000

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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [syzbot] [exfat?] KMSAN: uninit-value in __exfat_get_dentry_set
  2024-10-05 14:32 [syzbot] [exfat?] KMSAN: uninit-value in __exfat_get_dentry_set syzbot
                   ` (3 preceding siblings ...)
  2024-10-17  2:20 ` Yuezhang.Mo
@ 2024-10-17  9:49 ` Yuezhang.Mo
  2024-10-17 10:11   ` syzbot
  2024-10-19  4:01 ` Namjae Jeon
  2024-10-29  4:17 ` Namjae Jeon
  6 siblings, 1 reply; 17+ messages in thread
From: Yuezhang.Mo @ 2024-10-17  9:49 UTC (permalink / raw)
  To: syzbot, linkinjeon@kernel.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org, sj1557.seo@samsung.com,
	syzkaller-bugs@googlegroups.com

[-- Attachment #1: Type: text/plain, Size: 9344 bytes --]

#syz test

On Sat, Oct 5, 2024 at 8:02 PM syzbot <syzbot+01218003be74b5e1213a@syzkaller.appspotmail.com> wrote:
>
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit:    e32cde8d2bd7 Merge tag 'sched_ext-for-6.12-rc1-fixes-1'
> of..
> git tree:       upstream
> console+strace:
> https://urldefense.com/v3/__https://syzkaller.appspot.com/x/log.txt?x=16cf7d
> d0580000__;!!JmoZiZGBv3RvKRSx!_EFM31JxDI_sBC6NhWwWIWcja8UUVBXZY
> WyhK0O9vUuSsqy-ZOla4TuepNTA3X-btBmzePMIOD0CGeGE0kSF4M2hOwVy5
> 7mr5yQIbTA6$
> kernel config:
> https://urldefense.com/v3/__https://syzkaller.appspot.com/x/.config?x=b1fd45
> f2013d812f__;!!JmoZiZGBv3RvKRSx!_EFM31JxDI_sBC6NhWwWIWcja8UUVBX
> ZYWyhK0O9vUuSsqy-ZOla4TuepNTA3X-btBmzePMIOD0CGeGE0kSF4M2hOwV
> y57mr50IfSXOd$
> dashboard link:
> https://urldefense.com/v3/__https://syzkaller.appspot.com/bug?extid=012180
> 03be74b5e1213a__;!!JmoZiZGBv3RvKRSx!_EFM31JxDI_sBC6NhWwWIWcja8U
> UVBXZYWyhK0O9vUuSsqy-ZOla4TuepNTA3X-btBmzePMIOD0CGeGE0kSF4M2h
> OwVy57mr5-IoYOKx$
> compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian)
> 2.40
> syz repro:
> https://urldefense.com/v3/__https://syzkaller.appspot.com/x/repro.syz?x=11cf
> 7dd0580000__;!!JmoZiZGBv3RvKRSx!_EFM31JxDI_sBC6NhWwWIWcja8UUVB
> XZYWyhK0O9vUuSsqy-ZOla4TuepNTA3X-btBmzePMIOD0CGeGE0kSF4M2hOw
> Vy57mr58TvVCus$
> C reproducer:
> https://urldefense.com/v3/__https://syzkaller.appspot.com/x/repro.c?x=11d06
> 580580000__;!!JmoZiZGBv3RvKRSx!_EFM31JxDI_sBC6NhWwWIWcja8UUVBXZ
> YWyhK0O9vUuSsqy-ZOla4TuepNTA3X-btBmzePMIOD0CGeGE0kSF4M2hOwVy
> 57mr5w2Sgp57$
>
> Downloadable assets:
> disk image:
> https://urldefense.com/v3/__https://storage.googleapis.com/syzbot-assets/16
> d4da549bf4/disk-e32cde8d.raw.xz__;!!JmoZiZGBv3RvKRSx!_EFM31JxDI_sBC6
> NhWwWIWcja8UUVBXZYWyhK0O9vUuSsqy-ZOla4TuepNTA3X-btBmzePMIOD0
> CGeGE0kSF4M2hOwVy57mr54CRCyjy$
> vmlinux:
> https://urldefense.com/v3/__https://storage.googleapis.com/syzbot-assets/a01
> bc9a0e174/vmlinux-e32cde8d.xz__;!!JmoZiZGBv3RvKRSx!_EFM31JxDI_sBC6N
> hWwWIWcja8UUVBXZYWyhK0O9vUuSsqy-ZOla4TuepNTA3X-btBmzePMIOD0C
> GeGE0kSF4M2hOwVy57mr5_9fwsZ2$
> kernel image:
> https://urldefense.com/v3/__https://storage.googleapis.com/syzbot-assets/93f
> 4dfad6909/bzImage-e32cde8d.xz__;!!JmoZiZGBv3RvKRSx!_EFM31JxDI_sBC6N
> hWwWIWcja8UUVBXZYWyhK0O9vUuSsqy-ZOla4TuepNTA3X-btBmzePMIOD0C
> GeGE0kSF4M2hOwVy57mr54HU84Yj$
> mounted in repro:
> https://urldefense.com/v3/__https://storage.googleapis.com/syzbot-assets/43
> 3ba0700154/mount_0.gz__;!!JmoZiZGBv3RvKRSx!_EFM31JxDI_sBC6NhWwWI
> Wcja8UUVBXZYWyhK0O9vUuSsqy-ZOla4TuepNTA3X-btBmzePMIOD0CGeGE0k
> SF4M2hOwVy57mr51x55siW$
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by:
> mailto:syzbot+01218003be74b5e1213a@syzkaller.appspotmail.com
>
> exFAT-fs (loop0): failed to load upcase table (idx : 0x00010000, chksum :
> 0x726052d3, utbl_chksum : 0xe619d30d)
> =====================================================
> BUG: KMSAN: uninit-value in __exfat_get_dentry_set+0x10ca/0x14d0
> fs/exfat/dir.c:804
>  __exfat_get_dentry_set+0x10ca/0x14d0 fs/exfat/dir.c:804
>  exfat_get_dentry_set+0x58/0xec0 fs/exfat/dir.c:859
>  __exfat_write_inode+0x3c1/0xe30 fs/exfat/inode.c:46
>  __exfat_truncate+0x7f3/0xbb0 fs/exfat/file.c:211
>  exfat_truncate+0xee/0x2a0 fs/exfat/file.c:257
>  exfat_write_failed fs/exfat/inode.c:421 [inline]
>  exfat_direct_IO+0x5a3/0x900 fs/exfat/inode.c:485
>  generic_file_direct_write+0x275/0x6a0 mm/filemap.c:3977
>  __generic_file_write_iter+0x242/0x460 mm/filemap.c:4141
>  exfat_file_write_iter+0x894/0xfb0 fs/exfat/file.c:598
>  do_iter_readv_writev+0x88a/0xa30
>  vfs_writev+0x56a/0x14f0 fs/read_write.c:1064
>  do_pwritev fs/read_write.c:1165 [inline]
>  __do_sys_pwritev2 fs/read_write.c:1224 [inline]
>  __se_sys_pwritev2+0x280/0x470 fs/read_write.c:1215
>  __x64_sys_pwritev2+0x11f/0x1a0 fs/read_write.c:1215
>  x64_sys_call+0x2edb/0x3ba0
> arch/x86/include/generated/asm/syscalls_64.h:329
>  do_syscall_x64 arch/x86/entry/common.c:52 [inline]
>  do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83
>  entry_SYSCALL_64_after_hwframe+0x77/0x7f
>
> Uninit was stored to memory at:
>  memcpy_to_iter lib/iov_iter.c:65 [inline]
>  iterate_bvec include/linux/iov_iter.h:123 [inline]
>  iterate_and_advance2 include/linux/iov_iter.h:304 [inline]
>  iterate_and_advance include/linux/iov_iter.h:328 [inline]
>  _copy_to_iter+0xe53/0x2b30 lib/iov_iter.c:185
>  copy_page_to_iter+0x419/0x880 lib/iov_iter.c:362
>  shmem_file_read_iter+0xa09/0x12b0 mm/shmem.c:3167
>  do_iter_readv_writev+0x88a/0xa30
>  vfs_iter_read+0x278/0x760 fs/read_write.c:923
>  lo_read_simple drivers/block/loop.c:283 [inline]
>  do_req_filebacked drivers/block/loop.c:516 [inline]
>  loop_handle_cmd drivers/block/loop.c:1910 [inline]
>  loop_process_work+0x20fc/0x3750 drivers/block/loop.c:1945
>  loop_rootcg_workfn+0x2b/0x40 drivers/block/loop.c:1976
>  process_one_work kernel/workqueue.c:3229 [inline]
>  process_scheduled_works+0xae0/0x1c40 kernel/workqueue.c:3310
>  worker_thread+0xea7/0x14f0 kernel/workqueue.c:3391
>  kthread+0x3e2/0x540 kernel/kthread.c:389
>  ret_from_fork+0x6d/0x90 arch/x86/kernel/process.c:147
>  ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
>
> Uninit was stored to memory at:
>  memcpy_from_iter lib/iov_iter.c:73 [inline]
>  iterate_bvec include/linux/iov_iter.h:123 [inline]
>  iterate_and_advance2 include/linux/iov_iter.h:304 [inline]
>  iterate_and_advance include/linux/iov_iter.h:328 [inline]
>  __copy_from_iter lib/iov_iter.c:249 [inline]
>  copy_page_from_iter_atomic+0x12b7/0x3100 lib/iov_iter.c:481
>  copy_folio_from_iter_atomic include/linux/uio.h:201 [inline]
>  generic_perform_write+0x8d1/0x1080 mm/filemap.c:4066
>  shmem_file_write_iter+0x2ba/0x2f0 mm/shmem.c:3221
>  do_iter_readv_writev+0x88a/0xa30
>  vfs_iter_write+0x44d/0xd40 fs/read_write.c:988
>  lo_write_bvec drivers/block/loop.c:243 [inline]
>  lo_write_simple drivers/block/loop.c:264 [inline]
>  do_req_filebacked drivers/block/loop.c:511 [inline]
>  loop_handle_cmd drivers/block/loop.c:1910 [inline]
>  loop_process_work+0x15e6/0x3750 drivers/block/loop.c:1945
>  loop_rootcg_workfn+0x2b/0x40 drivers/block/loop.c:1976
>  process_one_work kernel/workqueue.c:3229 [inline]
>  process_scheduled_works+0xae0/0x1c40 kernel/workqueue.c:3310
>  worker_thread+0xea7/0x14f0 kernel/workqueue.c:3391
>  kthread+0x3e2/0x540 kernel/kthread.c:389
>  ret_from_fork+0x6d/0x90 arch/x86/kernel/process.c:147
>  ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
>
> Uninit was created at:
>  __alloc_pages_noprof+0x9d6/0xe70 mm/page_alloc.c:4756
>  alloc_pages_mpol_noprof+0x299/0x990 mm/mempolicy.c:2265
>  alloc_pages_noprof mm/mempolicy.c:2345 [inline]
>  folio_alloc_noprof+0x1db/0x310 mm/mempolicy.c:2352
>  filemap_alloc_folio_noprof+0xa6/0x440 mm/filemap.c:1010
>  __filemap_get_folio+0xac4/0x1550 mm/filemap.c:1952
>  block_write_begin+0x6e/0x2b0 fs/buffer.c:2226
>  exfat_write_begin+0xfb/0x400 fs/exfat/inode.c:434
>  exfat_extend_valid_size fs/exfat/file.c:553 [inline]
>  exfat_file_write_iter+0x474/0xfb0 fs/exfat/file.c:588
>  do_iter_readv_writev+0x88a/0xa30
>  vfs_writev+0x56a/0x14f0 fs/read_write.c:1064
>  do_pwritev fs/read_write.c:1165 [inline]
>  __do_sys_pwritev2 fs/read_write.c:1224 [inline]
>  __se_sys_pwritev2+0x280/0x470 fs/read_write.c:1215
>  __x64_sys_pwritev2+0x11f/0x1a0 fs/read_write.c:1215
>  x64_sys_call+0x2edb/0x3ba0
> arch/x86/include/generated/asm/syscalls_64.h:329
>  do_syscall_x64 arch/x86/entry/common.c:52 [inline]
>  do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83
>  entry_SYSCALL_64_after_hwframe+0x77/0x7f
>
> CPU: 0 UID: 0 PID: 5188 Comm: syz-executor221 Not tainted
> 6.12.0-rc1-syzkaller-00031-ge32cde8d2bd7 #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
> Google 09/13/2024
> =====================================================
>
>
> ---
> This report is generated by a bot. It may contain errors.
> See
> https://urldefense.com/v3/__https://goo.gl/tpsmEJ__;!!JmoZiZGBv3RvKRSx!_E
> FM31JxDI_sBC6NhWwWIWcja8UUVBXZYWyhK0O9vUuSsqy-ZOla4TuepNTA3X-
> btBmzePMIOD0CGeGE0kSF4M2hOwVy57mr50hLBEHu$ for more information
> about syzbot.
> syzbot engineers can be reached at mailto:syzkaller@googlegroups.com.
>
> syzbot will keep track of this issue. See:
> https://urldefense.com/v3/__https://goo.gl/tpsmEJ*status__;Iw!!JmoZiZGBv3R
> vKRSx!_EFM31JxDI_sBC6NhWwWIWcja8UUVBXZYWyhK0O9vUuSsqy-ZOla4Tu
> epNTA3X-btBmzePMIOD0CGeGE0kSF4M2hOwVy57mr55Eybub8$ 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

[-- Attachment #2: v2-0001-exfat-use-sync_inode_metadata-to-writeback-inode.patch --]
[-- Type: application/octet-stream, Size: 3118 bytes --]

From 7a9afe3827d6f9ef47e3024c9c3cd7bfcc15858a Mon Sep 17 00:00:00 2001
From: Yuezhang Mo <Yuezhang.Mo@sony.com>
Date: Thu, 17 Oct 2024 09:48:40 +0800
Subject: [PATCH v2] exfat: use sync_inode_metadata() to writeback inode

Signed-off-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
---
 fs/exfat/exfat_fs.h |  3 +--
 fs/exfat/file.c     | 32 +++++---------------------------
 fs/exfat/inode.c    |  4 +---
 3 files changed, 7 insertions(+), 32 deletions(-)

diff --git a/fs/exfat/exfat_fs.h b/fs/exfat/exfat_fs.h
index 7b5f962f074d..fd111ecb3f50 100644
--- a/fs/exfat/exfat_fs.h
+++ b/fs/exfat/exfat_fs.h
@@ -459,8 +459,7 @@ int exfat_trim_fs(struct inode *inode, struct fstrim_range *range);
 
 /* file.c */
 extern const struct file_operations exfat_file_operations;
-int __exfat_truncate(struct inode *inode);
-void exfat_truncate(struct inode *inode);
+int exfat_truncate(struct inode *inode);
 int exfat_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
 		  struct iattr *attr);
 int exfat_getattr(struct mnt_idmap *idmap, const struct path *path,
diff --git a/fs/exfat/file.c b/fs/exfat/file.c
index a25d7eb789f4..f71ed7cc47e1 100644
--- a/fs/exfat/file.c
+++ b/fs/exfat/file.c
@@ -141,7 +141,7 @@ static int exfat_sanitize_mode(const struct exfat_sb_info *sbi,
 }
 
 /* resize the file length */
-int __exfat_truncate(struct inode *inode)
+int exfat_truncate(struct inode *inode)
 {
 	unsigned int num_clusters_new, num_clusters_phys;
 	unsigned int last_clu = EXFAT_FREE_CLUSTER;
@@ -208,7 +208,8 @@ int __exfat_truncate(struct inode *inode)
 	 * __exfat_write_inode() is called for directory entry, bitmap
 	 * and FAT to be written in a same writeback.
 	 */
-	if (__exfat_write_inode(inode, inode_needs_sync(inode)))
+	mark_inode_dirty(inode);
+	if (sync_inode_metadata(inode, inode_needs_sync(inode)))
 		return -EIO;
 
 	/* cut off from the FAT chain */
@@ -235,32 +236,9 @@ int __exfat_truncate(struct inode *inode)
 	if (exfat_free_cluster(inode, &clu))
 		return -EIO;
 
-	return 0;
-}
-
-void exfat_truncate(struct inode *inode)
-{
-	struct super_block *sb = inode->i_sb;
-	struct exfat_sb_info *sbi = EXFAT_SB(sb);
-	struct exfat_inode_info *ei = EXFAT_I(inode);
-	int err;
-
-	mutex_lock(&sbi->s_lock);
-	if (ei->start_clu == 0) {
-		/*
-		 * Empty start_clu != ~0 (not allocated)
-		 */
-		exfat_fs_error(sb, "tried to truncate zeroed cluster.");
-		goto write_size;
-	}
-
-	err = __exfat_truncate(inode);
-	if (err)
-		goto write_size;
-
 	inode->i_blocks = round_up(i_size_read(inode), sbi->cluster_size) >> 9;
-write_size:
-	mutex_unlock(&sbi->s_lock);
+
+	return 0;
 }
 
 int exfat_getattr(struct mnt_idmap *idmap, const struct path *path,
diff --git a/fs/exfat/inode.c b/fs/exfat/inode.c
index d338a59c27f7..2a0a87430cbc 100644
--- a/fs/exfat/inode.c
+++ b/fs/exfat/inode.c
@@ -679,9 +679,7 @@ void exfat_evict_inode(struct inode *inode)
 
 	if (!inode->i_nlink) {
 		i_size_write(inode, 0);
-		mutex_lock(&EXFAT_SB(inode->i_sb)->s_lock);
-		__exfat_truncate(inode);
-		mutex_unlock(&EXFAT_SB(inode->i_sb)->s_lock);
+		exfat_truncate(inode);
 	}
 
 	invalidate_inode_buffers(inode);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [syzbot] [exfat?] KMSAN: uninit-value in __exfat_get_dentry_set
  2024-10-17  9:49 ` Yuezhang.Mo
@ 2024-10-17 10:11   ` syzbot
  0 siblings, 0 replies; 17+ messages in thread
From: syzbot @ 2024-10-17 10:11 UTC (permalink / raw)
  To: linkinjeon, linux-fsdevel, linux-kernel, sj1557.seo,
	syzkaller-bugs, yuezhang.mo

Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
KMSAN: uninit-value in __exfat_get_dentry_set

loop0: detected capacity change from 0 to 256
exFAT-fs (loop0): failed to load upcase table (idx : 0x00010000, chksum : 0x726052d3, utbl_chksum : 0xe619d30d)
=====================================================
BUG: KMSAN: uninit-value in __exfat_get_dentry_set+0x10ca/0x14d0 fs/exfat/dir.c:804
 __exfat_get_dentry_set+0x10ca/0x14d0 fs/exfat/dir.c:804
 exfat_get_dentry_set+0x58/0xec0 fs/exfat/dir.c:859
 __exfat_write_inode+0x3c1/0xe30 fs/exfat/inode.c:46
 exfat_write_inode+0x15f/0x250 fs/exfat/inode.c:109
 write_inode fs/fs-writeback.c:1503 [inline]
 __writeback_single_inode+0x8da/0x1290 fs/fs-writeback.c:1723
 writeback_single_inode+0x32f/0x9c0 fs/fs-writeback.c:1779
 sync_inode_metadata+0xa4/0xe0 fs/fs-writeback.c:2849
 exfat_truncate+0x839/0xd00 fs/exfat/file.c:212
 exfat_write_failed fs/exfat/inode.c:421 [inline]
 exfat_direct_IO+0x5ae/0x910 fs/exfat/inode.c:485
 generic_file_direct_write+0x275/0x6a0 mm/filemap.c:3977
 __generic_file_write_iter+0x242/0x460 mm/filemap.c:4141
 exfat_file_write_iter+0x894/0xfb0 fs/exfat/file.c:576
 do_iter_readv_writev+0x88a/0xa30
 vfs_writev+0x56a/0x14f0 fs/read_write.c:1064
 do_pwritev fs/read_write.c:1165 [inline]
 __do_sys_pwritev2 fs/read_write.c:1224 [inline]
 __se_sys_pwritev2+0x280/0x470 fs/read_write.c:1215
 __x64_sys_pwritev2+0x11f/0x1a0 fs/read_write.c:1215
 x64_sys_call+0x2edb/0x3ba0 arch/x86/include/generated/asm/syscalls_64.h:329
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Uninit was stored to memory at:
 memcpy_to_iter lib/iov_iter.c:65 [inline]
 iterate_bvec include/linux/iov_iter.h:123 [inline]
 iterate_and_advance2 include/linux/iov_iter.h:304 [inline]
 iterate_and_advance include/linux/iov_iter.h:328 [inline]
 _copy_to_iter+0xe53/0x2b30 lib/iov_iter.c:185
 copy_page_to_iter+0x419/0x880 lib/iov_iter.c:362
 shmem_file_read_iter+0xa09/0x12b0 mm/shmem.c:3167
 do_iter_readv_writev+0x88a/0xa30
 vfs_iter_read+0x278/0x760 fs/read_write.c:923
 lo_read_simple drivers/block/loop.c:283 [inline]
 do_req_filebacked drivers/block/loop.c:516 [inline]
 loop_handle_cmd drivers/block/loop.c:1910 [inline]
 loop_process_work+0x20fc/0x3750 drivers/block/loop.c:1945
 loop_workfn+0x48/0x60 drivers/block/loop.c:1969
 process_one_work kernel/workqueue.c:3229 [inline]
 process_scheduled_works+0xae0/0x1c40 kernel/workqueue.c:3310
 worker_thread+0xea7/0x14f0 kernel/workqueue.c:3391
 kthread+0x3e2/0x540 kernel/kthread.c:389
 ret_from_fork+0x6d/0x90 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244

Uninit was stored to memory at:
 memcpy_from_iter lib/iov_iter.c:73 [inline]
 iterate_bvec include/linux/iov_iter.h:123 [inline]
 iterate_and_advance2 include/linux/iov_iter.h:304 [inline]
 iterate_and_advance include/linux/iov_iter.h:328 [inline]
 __copy_from_iter lib/iov_iter.c:249 [inline]
 copy_page_from_iter_atomic+0x12b7/0x3100 lib/iov_iter.c:481
 copy_folio_from_iter_atomic include/linux/uio.h:201 [inline]
 generic_perform_write+0x8d1/0x1080 mm/filemap.c:4066
 shmem_file_write_iter+0x2ba/0x2f0 mm/shmem.c:3221
 do_iter_readv_writev+0x88a/0xa30
 vfs_iter_write+0x44d/0xd40 fs/read_write.c:988
 lo_write_bvec drivers/block/loop.c:243 [inline]
 lo_write_simple drivers/block/loop.c:264 [inline]
 do_req_filebacked drivers/block/loop.c:511 [inline]
 loop_handle_cmd drivers/block/loop.c:1910 [inline]
 loop_process_work+0x15e6/0x3750 drivers/block/loop.c:1945
 loop_workfn+0x48/0x60 drivers/block/loop.c:1969
 process_one_work kernel/workqueue.c:3229 [inline]
 process_scheduled_works+0xae0/0x1c40 kernel/workqueue.c:3310
 worker_thread+0xea7/0x14f0 kernel/workqueue.c:3391
 kthread+0x3e2/0x540 kernel/kthread.c:389
 ret_from_fork+0x6d/0x90 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244

Uninit was created at:
 __alloc_pages_noprof+0x9a7/0xe00 mm/page_alloc.c:4756
 alloc_pages_mpol_noprof+0x299/0x990 mm/mempolicy.c:2265
 alloc_pages_noprof mm/mempolicy.c:2345 [inline]
 folio_alloc_noprof+0x1db/0x310 mm/mempolicy.c:2352
 filemap_alloc_folio_noprof+0xa6/0x440 mm/filemap.c:1010
 __filemap_get_folio+0xac4/0x1550 mm/filemap.c:1952
 block_write_begin+0x6e/0x2b0 fs/buffer.c:2226
 exfat_write_begin+0xfb/0x410 fs/exfat/inode.c:434
 exfat_extend_valid_size fs/exfat/file.c:531 [inline]
 exfat_file_write_iter+0x474/0xfb0 fs/exfat/file.c:566
 do_iter_readv_writev+0x88a/0xa30
 vfs_writev+0x56a/0x14f0 fs/read_write.c:1064
 do_pwritev fs/read_write.c:1165 [inline]
 __do_sys_pwritev2 fs/read_write.c:1224 [inline]
 __se_sys_pwritev2+0x280/0x470 fs/read_write.c:1215
 __x64_sys_pwritev2+0x11f/0x1a0 fs/read_write.c:1215
 x64_sys_call+0x2edb/0x3ba0 arch/x86/include/generated/asm/syscalls_64.h:329
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

CPU: 1 UID: 0 PID: 5994 Comm: syz.0.15 Not tainted 6.12.0-rc3-syzkaller-gc964ced77262-dirty #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
=====================================================


Tested on:

commit:         c964ced7 Merge tag 'for-linus' of git://git.kernel.org..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=16ab745f980000
kernel config:  https://syzkaller.appspot.com/x/.config?x=5242e0e980477c72
dashboard link: https://syzkaller.appspot.com/bug?extid=01218003be74b5e1213a
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch:          https://syzkaller.appspot.com/x/patch.diff?x=1615e830580000


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [syzbot] [exfat?] KMSAN: uninit-value in __exfat_get_dentry_set
  2024-10-05 14:32 [syzbot] [exfat?] KMSAN: uninit-value in __exfat_get_dentry_set syzbot
                   ` (4 preceding siblings ...)
  2024-10-17  9:49 ` Yuezhang.Mo
@ 2024-10-19  4:01 ` Namjae Jeon
  2024-10-19  5:20   ` syzbot
  2024-10-29  4:17 ` Namjae Jeon
  6 siblings, 1 reply; 17+ messages in thread
From: Namjae Jeon @ 2024-10-19  4:01 UTC (permalink / raw)
  To: syzbot; +Cc: linux-fsdevel, linux-kernel, sj1557.seo, syzkaller-bugs,
	yuezhang.mo

[-- Attachment #1: Type: text/plain, Size: 7446 bytes --]

#syz test

On Sat, Oct 5, 2024 at 11:32 PM syzbot
<syzbot+01218003be74b5e1213a@syzkaller.appspotmail.com> wrote:
>
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit:    e32cde8d2bd7 Merge tag 'sched_ext-for-6.12-rc1-fixes-1' of..
> git tree:       upstream
> console+strace: https://syzkaller.appspot.com/x/log.txt?x=16cf7dd0580000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=b1fd45f2013d812f
> dashboard link: https://syzkaller.appspot.com/bug?extid=01218003be74b5e1213a
> compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=11cf7dd0580000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=11d06580580000
>
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/16d4da549bf4/disk-e32cde8d.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/a01bc9a0e174/vmlinux-e32cde8d.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/93f4dfad6909/bzImage-e32cde8d.xz
> mounted in repro: https://storage.googleapis.com/syzbot-assets/433ba0700154/mount_0.gz
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+01218003be74b5e1213a@syzkaller.appspotmail.com
>
> exFAT-fs (loop0): failed to load upcase table (idx : 0x00010000, chksum : 0x726052d3, utbl_chksum : 0xe619d30d)
> =====================================================
> BUG: KMSAN: uninit-value in __exfat_get_dentry_set+0x10ca/0x14d0 fs/exfat/dir.c:804
>  __exfat_get_dentry_set+0x10ca/0x14d0 fs/exfat/dir.c:804
>  exfat_get_dentry_set+0x58/0xec0 fs/exfat/dir.c:859
>  __exfat_write_inode+0x3c1/0xe30 fs/exfat/inode.c:46
>  __exfat_truncate+0x7f3/0xbb0 fs/exfat/file.c:211
>  exfat_truncate+0xee/0x2a0 fs/exfat/file.c:257
>  exfat_write_failed fs/exfat/inode.c:421 [inline]
>  exfat_direct_IO+0x5a3/0x900 fs/exfat/inode.c:485
>  generic_file_direct_write+0x275/0x6a0 mm/filemap.c:3977
>  __generic_file_write_iter+0x242/0x460 mm/filemap.c:4141
>  exfat_file_write_iter+0x894/0xfb0 fs/exfat/file.c:598
>  do_iter_readv_writev+0x88a/0xa30
>  vfs_writev+0x56a/0x14f0 fs/read_write.c:1064
>  do_pwritev fs/read_write.c:1165 [inline]
>  __do_sys_pwritev2 fs/read_write.c:1224 [inline]
>  __se_sys_pwritev2+0x280/0x470 fs/read_write.c:1215
>  __x64_sys_pwritev2+0x11f/0x1a0 fs/read_write.c:1215
>  x64_sys_call+0x2edb/0x3ba0 arch/x86/include/generated/asm/syscalls_64.h:329
>  do_syscall_x64 arch/x86/entry/common.c:52 [inline]
>  do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83
>  entry_SYSCALL_64_after_hwframe+0x77/0x7f
>
> Uninit was stored to memory at:
>  memcpy_to_iter lib/iov_iter.c:65 [inline]
>  iterate_bvec include/linux/iov_iter.h:123 [inline]
>  iterate_and_advance2 include/linux/iov_iter.h:304 [inline]
>  iterate_and_advance include/linux/iov_iter.h:328 [inline]
>  _copy_to_iter+0xe53/0x2b30 lib/iov_iter.c:185
>  copy_page_to_iter+0x419/0x880 lib/iov_iter.c:362
>  shmem_file_read_iter+0xa09/0x12b0 mm/shmem.c:3167
>  do_iter_readv_writev+0x88a/0xa30
>  vfs_iter_read+0x278/0x760 fs/read_write.c:923
>  lo_read_simple drivers/block/loop.c:283 [inline]
>  do_req_filebacked drivers/block/loop.c:516 [inline]
>  loop_handle_cmd drivers/block/loop.c:1910 [inline]
>  loop_process_work+0x20fc/0x3750 drivers/block/loop.c:1945
>  loop_rootcg_workfn+0x2b/0x40 drivers/block/loop.c:1976
>  process_one_work kernel/workqueue.c:3229 [inline]
>  process_scheduled_works+0xae0/0x1c40 kernel/workqueue.c:3310
>  worker_thread+0xea7/0x14f0 kernel/workqueue.c:3391
>  kthread+0x3e2/0x540 kernel/kthread.c:389
>  ret_from_fork+0x6d/0x90 arch/x86/kernel/process.c:147
>  ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
>
> Uninit was stored to memory at:
>  memcpy_from_iter lib/iov_iter.c:73 [inline]
>  iterate_bvec include/linux/iov_iter.h:123 [inline]
>  iterate_and_advance2 include/linux/iov_iter.h:304 [inline]
>  iterate_and_advance include/linux/iov_iter.h:328 [inline]
>  __copy_from_iter lib/iov_iter.c:249 [inline]
>  copy_page_from_iter_atomic+0x12b7/0x3100 lib/iov_iter.c:481
>  copy_folio_from_iter_atomic include/linux/uio.h:201 [inline]
>  generic_perform_write+0x8d1/0x1080 mm/filemap.c:4066
>  shmem_file_write_iter+0x2ba/0x2f0 mm/shmem.c:3221
>  do_iter_readv_writev+0x88a/0xa30
>  vfs_iter_write+0x44d/0xd40 fs/read_write.c:988
>  lo_write_bvec drivers/block/loop.c:243 [inline]
>  lo_write_simple drivers/block/loop.c:264 [inline]
>  do_req_filebacked drivers/block/loop.c:511 [inline]
>  loop_handle_cmd drivers/block/loop.c:1910 [inline]
>  loop_process_work+0x15e6/0x3750 drivers/block/loop.c:1945
>  loop_rootcg_workfn+0x2b/0x40 drivers/block/loop.c:1976
>  process_one_work kernel/workqueue.c:3229 [inline]
>  process_scheduled_works+0xae0/0x1c40 kernel/workqueue.c:3310
>  worker_thread+0xea7/0x14f0 kernel/workqueue.c:3391
>  kthread+0x3e2/0x540 kernel/kthread.c:389
>  ret_from_fork+0x6d/0x90 arch/x86/kernel/process.c:147
>  ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
>
> Uninit was created at:
>  __alloc_pages_noprof+0x9d6/0xe70 mm/page_alloc.c:4756
>  alloc_pages_mpol_noprof+0x299/0x990 mm/mempolicy.c:2265
>  alloc_pages_noprof mm/mempolicy.c:2345 [inline]
>  folio_alloc_noprof+0x1db/0x310 mm/mempolicy.c:2352
>  filemap_alloc_folio_noprof+0xa6/0x440 mm/filemap.c:1010
>  __filemap_get_folio+0xac4/0x1550 mm/filemap.c:1952
>  block_write_begin+0x6e/0x2b0 fs/buffer.c:2226
>  exfat_write_begin+0xfb/0x400 fs/exfat/inode.c:434
>  exfat_extend_valid_size fs/exfat/file.c:553 [inline]
>  exfat_file_write_iter+0x474/0xfb0 fs/exfat/file.c:588
>  do_iter_readv_writev+0x88a/0xa30
>  vfs_writev+0x56a/0x14f0 fs/read_write.c:1064
>  do_pwritev fs/read_write.c:1165 [inline]
>  __do_sys_pwritev2 fs/read_write.c:1224 [inline]
>  __se_sys_pwritev2+0x280/0x470 fs/read_write.c:1215
>  __x64_sys_pwritev2+0x11f/0x1a0 fs/read_write.c:1215
>  x64_sys_call+0x2edb/0x3ba0 arch/x86/include/generated/asm/syscalls_64.h:329
>  do_syscall_x64 arch/x86/entry/common.c:52 [inline]
>  do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83
>  entry_SYSCALL_64_after_hwframe+0x77/0x7f
>
> CPU: 0 UID: 0 PID: 5188 Comm: syz-executor221 Not tainted 6.12.0-rc1-syzkaller-00031-ge32cde8d2bd7 #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/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 syzkaller@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

[-- Attachment #2: 0001-exfat-fix-uninit-value-use-in-__exfat_get_dentry_set.patch --]
[-- Type: text/x-patch, Size: 1104 bytes --]

From 01dcf95edf0263c7f29caa7a0477ab1b8c4c7ca7 Mon Sep 17 00:00:00 2001
From: Namjae Jeon <linkinjeon@kernel.org>
Date: Sat, 19 Oct 2024 12:59:05 +0900
Subject: [PATCH] exfat: fix uninit-value use in __exfat_get_dentry_set

Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
---
 fs/exfat/dir.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/fs/exfat/dir.c b/fs/exfat/dir.c
index 7446bf09a04a..8ee3c99e2666 100644
--- a/fs/exfat/dir.c
+++ b/fs/exfat/dir.c
@@ -741,9 +741,15 @@ static bool exfat_validate_entry(unsigned int type,
 struct exfat_dentry *exfat_get_dentry_cached(
 	struct exfat_entry_set_cache *es, int num)
 {
-	int off = es->start_off + num * DENTRY_SIZE;
-	struct buffer_head *bh = es->bh[EXFAT_B_TO_BLK(off, es->sb)];
-	char *p = bh->b_data + EXFAT_BLK_OFFSET(off, es->sb);
+	struct buffer_head *bh;
+	int off;
+	char *p;
+
+	if (check_add_overflow(es->start_off, num * DENTRY_SIZE, &off))
+		return NULL;
+
+	bh = es->bh[EXFAT_B_TO_BLK(off, es->sb)];
+	p = bh->b_data + EXFAT_BLK_OFFSET(off, es->sb);
 
 	return (struct exfat_dentry *)p;
 }
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [syzbot] [exfat?] KMSAN: uninit-value in __exfat_get_dentry_set
  2024-10-19  4:01 ` Namjae Jeon
@ 2024-10-19  5:20   ` syzbot
  0 siblings, 0 replies; 17+ messages in thread
From: syzbot @ 2024-10-19  5:20 UTC (permalink / raw)
  To: linkinjeon, linux-fsdevel, linux-kernel, sj1557.seo,
	syzkaller-bugs, yuezhang.mo

Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
KMSAN: uninit-value in __exfat_get_dentry_set

loop0: detected capacity change from 0 to 256
exFAT-fs (loop0): failed to load upcase table (idx : 0x00010000, chksum : 0x726052d3, utbl_chksum : 0xe619d30d)
=====================================================
BUG: KMSAN: uninit-value in __exfat_get_dentry_set+0x10ca/0x1500 fs/exfat/dir.c:810
 __exfat_get_dentry_set+0x10ca/0x1500 fs/exfat/dir.c:810
 exfat_get_dentry_set+0x57/0xf60 fs/exfat/dir.c:865
 __exfat_write_inode+0x3c1/0xe30 fs/exfat/inode.c:46
 __exfat_truncate+0x7f3/0xbb0 fs/exfat/file.c:211
 exfat_truncate+0xee/0x2a0 fs/exfat/file.c:257
 exfat_write_failed fs/exfat/inode.c:421 [inline]
 exfat_direct_IO+0x5a3/0x900 fs/exfat/inode.c:485
 generic_file_direct_write+0x275/0x6a0 mm/filemap.c:3977
 __generic_file_write_iter+0x242/0x460 mm/filemap.c:4141
 exfat_file_write_iter+0x894/0xfb0 fs/exfat/file.c:598
 do_iter_readv_writev+0x88a/0xa30
 vfs_writev+0x56a/0x14f0 fs/read_write.c:1064
 do_pwritev fs/read_write.c:1165 [inline]
 __do_sys_pwritev2 fs/read_write.c:1224 [inline]
 __se_sys_pwritev2+0x280/0x470 fs/read_write.c:1215
 __x64_sys_pwritev2+0x11f/0x1a0 fs/read_write.c:1215
 x64_sys_call+0x2edb/0x3ba0 arch/x86/include/generated/asm/syscalls_64.h:329
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Uninit was stored to memory at:
 memcpy_to_iter lib/iov_iter.c:65 [inline]
 iterate_bvec include/linux/iov_iter.h:123 [inline]
 iterate_and_advance2 include/linux/iov_iter.h:304 [inline]
 iterate_and_advance include/linux/iov_iter.h:328 [inline]
 _copy_to_iter+0xe53/0x2b30 lib/iov_iter.c:185
 copy_page_to_iter+0x419/0x880 lib/iov_iter.c:362
 shmem_file_read_iter+0xa09/0x12b0 mm/shmem.c:3162
 do_iter_readv_writev+0x88a/0xa30
 vfs_iter_read+0x278/0x760 fs/read_write.c:923
 lo_read_simple drivers/block/loop.c:283 [inline]
 do_req_filebacked drivers/block/loop.c:516 [inline]
 loop_handle_cmd drivers/block/loop.c:1910 [inline]
 loop_process_work+0x20fc/0x3750 drivers/block/loop.c:1945
 loop_workfn+0x48/0x60 drivers/block/loop.c:1969
 process_one_work kernel/workqueue.c:3229 [inline]
 process_scheduled_works+0xae0/0x1c40 kernel/workqueue.c:3310
 worker_thread+0xea7/0x14f0 kernel/workqueue.c:3391
 kthread+0x3e2/0x540 kernel/kthread.c:389
 ret_from_fork+0x6d/0x90 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244

Uninit was stored to memory at:
 memcpy_from_iter lib/iov_iter.c:73 [inline]
 iterate_bvec include/linux/iov_iter.h:123 [inline]
 iterate_and_advance2 include/linux/iov_iter.h:304 [inline]
 iterate_and_advance include/linux/iov_iter.h:328 [inline]
 __copy_from_iter lib/iov_iter.c:249 [inline]
 copy_page_from_iter_atomic+0x12b7/0x3100 lib/iov_iter.c:481
 copy_folio_from_iter_atomic include/linux/uio.h:201 [inline]
 generic_perform_write+0x8d1/0x1080 mm/filemap.c:4066
 shmem_file_write_iter+0x2ba/0x2f0 mm/shmem.c:3216
 do_iter_readv_writev+0x88a/0xa30
 vfs_iter_write+0x44d/0xd40 fs/read_write.c:988
 lo_write_bvec drivers/block/loop.c:243 [inline]
 lo_write_simple drivers/block/loop.c:264 [inline]
 do_req_filebacked drivers/block/loop.c:511 [inline]
 loop_handle_cmd drivers/block/loop.c:1910 [inline]
 loop_process_work+0x15e6/0x3750 drivers/block/loop.c:1945
 loop_workfn+0x48/0x60 drivers/block/loop.c:1969
 process_one_work kernel/workqueue.c:3229 [inline]
 process_scheduled_works+0xae0/0x1c40 kernel/workqueue.c:3310
 worker_thread+0xea7/0x14f0 kernel/workqueue.c:3391
 kthread+0x3e2/0x540 kernel/kthread.c:389
 ret_from_fork+0x6d/0x90 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244

Uninit was created at:
 __alloc_pages_noprof+0x9a7/0xe00 mm/page_alloc.c:4756
 alloc_pages_mpol_noprof+0x299/0x990 mm/mempolicy.c:2265
 alloc_pages_noprof mm/mempolicy.c:2345 [inline]
 folio_alloc_noprof+0x1db/0x310 mm/mempolicy.c:2352
 filemap_alloc_folio_noprof+0xa6/0x440 mm/filemap.c:1010
 __filemap_get_folio+0xac4/0x1550 mm/filemap.c:1952
 block_write_begin+0x6e/0x2b0 fs/buffer.c:2226
 exfat_write_begin+0xfb/0x400 fs/exfat/inode.c:434
 exfat_extend_valid_size fs/exfat/file.c:553 [inline]
 exfat_file_write_iter+0x474/0xfb0 fs/exfat/file.c:588
 do_iter_readv_writev+0x88a/0xa30
 vfs_writev+0x56a/0x14f0 fs/read_write.c:1064
 do_pwritev fs/read_write.c:1165 [inline]
 __do_sys_pwritev2 fs/read_write.c:1224 [inline]
 __se_sys_pwritev2+0x280/0x470 fs/read_write.c:1215
 __x64_sys_pwritev2+0x11f/0x1a0 fs/read_write.c:1215
 x64_sys_call+0x2edb/0x3ba0 arch/x86/include/generated/asm/syscalls_64.h:329
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

CPU: 1 UID: 0 PID: 6003 Comm: syz.0.15 Not tainted 6.12.0-rc3-syzkaller-g3d5ad2d4eca3-dirty #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
=====================================================


Tested on:

commit:         3d5ad2d4 Merge tag 'bpf-fixes' of git://git.kernel.org..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=16155240580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=5242e0e980477c72
dashboard link: https://syzkaller.appspot.com/bug?extid=01218003be74b5e1213a
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch:          https://syzkaller.appspot.com/x/patch.diff?x=142fbc5f980000


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [syzbot] [exfat?] KMSAN: uninit-value in __exfat_get_dentry_set
  2024-10-05 14:32 [syzbot] [exfat?] KMSAN: uninit-value in __exfat_get_dentry_set syzbot
                   ` (5 preceding siblings ...)
  2024-10-19  4:01 ` Namjae Jeon
@ 2024-10-29  4:17 ` Namjae Jeon
  2024-10-29  9:28   ` syzbot
  6 siblings, 1 reply; 17+ messages in thread
From: Namjae Jeon @ 2024-10-29  4:17 UTC (permalink / raw)
  To: syzbot; +Cc: linux-fsdevel, linux-kernel, sj1557.seo, syzkaller-bugs,
	yuezhang.mo

[-- Attachment #1: Type: text/plain, Size: 7446 bytes --]

#syz test

On Sat, Oct 5, 2024 at 11:32 PM syzbot
<syzbot+01218003be74b5e1213a@syzkaller.appspotmail.com> wrote:
>
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit:    e32cde8d2bd7 Merge tag 'sched_ext-for-6.12-rc1-fixes-1' of..
> git tree:       upstream
> console+strace: https://syzkaller.appspot.com/x/log.txt?x=16cf7dd0580000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=b1fd45f2013d812f
> dashboard link: https://syzkaller.appspot.com/bug?extid=01218003be74b5e1213a
> compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=11cf7dd0580000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=11d06580580000
>
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/16d4da549bf4/disk-e32cde8d.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/a01bc9a0e174/vmlinux-e32cde8d.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/93f4dfad6909/bzImage-e32cde8d.xz
> mounted in repro: https://storage.googleapis.com/syzbot-assets/433ba0700154/mount_0.gz
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+01218003be74b5e1213a@syzkaller.appspotmail.com
>
> exFAT-fs (loop0): failed to load upcase table (idx : 0x00010000, chksum : 0x726052d3, utbl_chksum : 0xe619d30d)
> =====================================================
> BUG: KMSAN: uninit-value in __exfat_get_dentry_set+0x10ca/0x14d0 fs/exfat/dir.c:804
>  __exfat_get_dentry_set+0x10ca/0x14d0 fs/exfat/dir.c:804
>  exfat_get_dentry_set+0x58/0xec0 fs/exfat/dir.c:859
>  __exfat_write_inode+0x3c1/0xe30 fs/exfat/inode.c:46
>  __exfat_truncate+0x7f3/0xbb0 fs/exfat/file.c:211
>  exfat_truncate+0xee/0x2a0 fs/exfat/file.c:257
>  exfat_write_failed fs/exfat/inode.c:421 [inline]
>  exfat_direct_IO+0x5a3/0x900 fs/exfat/inode.c:485
>  generic_file_direct_write+0x275/0x6a0 mm/filemap.c:3977
>  __generic_file_write_iter+0x242/0x460 mm/filemap.c:4141
>  exfat_file_write_iter+0x894/0xfb0 fs/exfat/file.c:598
>  do_iter_readv_writev+0x88a/0xa30
>  vfs_writev+0x56a/0x14f0 fs/read_write.c:1064
>  do_pwritev fs/read_write.c:1165 [inline]
>  __do_sys_pwritev2 fs/read_write.c:1224 [inline]
>  __se_sys_pwritev2+0x280/0x470 fs/read_write.c:1215
>  __x64_sys_pwritev2+0x11f/0x1a0 fs/read_write.c:1215
>  x64_sys_call+0x2edb/0x3ba0 arch/x86/include/generated/asm/syscalls_64.h:329
>  do_syscall_x64 arch/x86/entry/common.c:52 [inline]
>  do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83
>  entry_SYSCALL_64_after_hwframe+0x77/0x7f
>
> Uninit was stored to memory at:
>  memcpy_to_iter lib/iov_iter.c:65 [inline]
>  iterate_bvec include/linux/iov_iter.h:123 [inline]
>  iterate_and_advance2 include/linux/iov_iter.h:304 [inline]
>  iterate_and_advance include/linux/iov_iter.h:328 [inline]
>  _copy_to_iter+0xe53/0x2b30 lib/iov_iter.c:185
>  copy_page_to_iter+0x419/0x880 lib/iov_iter.c:362
>  shmem_file_read_iter+0xa09/0x12b0 mm/shmem.c:3167
>  do_iter_readv_writev+0x88a/0xa30
>  vfs_iter_read+0x278/0x760 fs/read_write.c:923
>  lo_read_simple drivers/block/loop.c:283 [inline]
>  do_req_filebacked drivers/block/loop.c:516 [inline]
>  loop_handle_cmd drivers/block/loop.c:1910 [inline]
>  loop_process_work+0x20fc/0x3750 drivers/block/loop.c:1945
>  loop_rootcg_workfn+0x2b/0x40 drivers/block/loop.c:1976
>  process_one_work kernel/workqueue.c:3229 [inline]
>  process_scheduled_works+0xae0/0x1c40 kernel/workqueue.c:3310
>  worker_thread+0xea7/0x14f0 kernel/workqueue.c:3391
>  kthread+0x3e2/0x540 kernel/kthread.c:389
>  ret_from_fork+0x6d/0x90 arch/x86/kernel/process.c:147
>  ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
>
> Uninit was stored to memory at:
>  memcpy_from_iter lib/iov_iter.c:73 [inline]
>  iterate_bvec include/linux/iov_iter.h:123 [inline]
>  iterate_and_advance2 include/linux/iov_iter.h:304 [inline]
>  iterate_and_advance include/linux/iov_iter.h:328 [inline]
>  __copy_from_iter lib/iov_iter.c:249 [inline]
>  copy_page_from_iter_atomic+0x12b7/0x3100 lib/iov_iter.c:481
>  copy_folio_from_iter_atomic include/linux/uio.h:201 [inline]
>  generic_perform_write+0x8d1/0x1080 mm/filemap.c:4066
>  shmem_file_write_iter+0x2ba/0x2f0 mm/shmem.c:3221
>  do_iter_readv_writev+0x88a/0xa30
>  vfs_iter_write+0x44d/0xd40 fs/read_write.c:988
>  lo_write_bvec drivers/block/loop.c:243 [inline]
>  lo_write_simple drivers/block/loop.c:264 [inline]
>  do_req_filebacked drivers/block/loop.c:511 [inline]
>  loop_handle_cmd drivers/block/loop.c:1910 [inline]
>  loop_process_work+0x15e6/0x3750 drivers/block/loop.c:1945
>  loop_rootcg_workfn+0x2b/0x40 drivers/block/loop.c:1976
>  process_one_work kernel/workqueue.c:3229 [inline]
>  process_scheduled_works+0xae0/0x1c40 kernel/workqueue.c:3310
>  worker_thread+0xea7/0x14f0 kernel/workqueue.c:3391
>  kthread+0x3e2/0x540 kernel/kthread.c:389
>  ret_from_fork+0x6d/0x90 arch/x86/kernel/process.c:147
>  ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
>
> Uninit was created at:
>  __alloc_pages_noprof+0x9d6/0xe70 mm/page_alloc.c:4756
>  alloc_pages_mpol_noprof+0x299/0x990 mm/mempolicy.c:2265
>  alloc_pages_noprof mm/mempolicy.c:2345 [inline]
>  folio_alloc_noprof+0x1db/0x310 mm/mempolicy.c:2352
>  filemap_alloc_folio_noprof+0xa6/0x440 mm/filemap.c:1010
>  __filemap_get_folio+0xac4/0x1550 mm/filemap.c:1952
>  block_write_begin+0x6e/0x2b0 fs/buffer.c:2226
>  exfat_write_begin+0xfb/0x400 fs/exfat/inode.c:434
>  exfat_extend_valid_size fs/exfat/file.c:553 [inline]
>  exfat_file_write_iter+0x474/0xfb0 fs/exfat/file.c:588
>  do_iter_readv_writev+0x88a/0xa30
>  vfs_writev+0x56a/0x14f0 fs/read_write.c:1064
>  do_pwritev fs/read_write.c:1165 [inline]
>  __do_sys_pwritev2 fs/read_write.c:1224 [inline]
>  __se_sys_pwritev2+0x280/0x470 fs/read_write.c:1215
>  __x64_sys_pwritev2+0x11f/0x1a0 fs/read_write.c:1215
>  x64_sys_call+0x2edb/0x3ba0 arch/x86/include/generated/asm/syscalls_64.h:329
>  do_syscall_x64 arch/x86/entry/common.c:52 [inline]
>  do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83
>  entry_SYSCALL_64_after_hwframe+0x77/0x7f
>
> CPU: 0 UID: 0 PID: 5188 Comm: syz-executor221 Not tainted 6.12.0-rc1-syzkaller-00031-ge32cde8d2bd7 #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/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 syzkaller@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

[-- Attachment #2: 0001-exfat-fix-uninit-value-in-__exfat_get_dentry_set.patch --]
[-- Type: application/x-patch, Size: 1168 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [syzbot] [exfat?] KMSAN: uninit-value in __exfat_get_dentry_set
  2024-10-29  4:17 ` Namjae Jeon
@ 2024-10-29  9:28   ` syzbot
  0 siblings, 0 replies; 17+ messages in thread
From: syzbot @ 2024-10-29  9:28 UTC (permalink / raw)
  To: linkinjeon, linux-fsdevel, linux-kernel, sj1557.seo,
	syzkaller-bugs, yuezhang.mo

Hello,

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

Reported-by: syzbot+01218003be74b5e1213a@syzkaller.appspotmail.com
Tested-by: syzbot+01218003be74b5e1213a@syzkaller.appspotmail.com

Tested on:

commit:         e42b1a9a Merge tag 'spi-fix-v6.12-rc5' of git://git.ke..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=142ec687980000
kernel config:  https://syzkaller.appspot.com/x/.config?x=8c11ea7cf15419ce
dashboard link: https://syzkaller.appspot.com/bug?extid=01218003be74b5e1213a
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch:          https://syzkaller.appspot.com/x/patch.diff?x=16bbef57980000

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

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2024-10-29  9:28 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-05 14:32 [syzbot] [exfat?] KMSAN: uninit-value in __exfat_get_dentry_set syzbot
2024-10-12 15:38 ` Suraj Sonawane
2024-10-12 18:23   ` syzbot
2024-10-14  6:39 ` Yuezhang.Mo
2024-10-14  7:51   ` syzbot
2024-10-14  9:00 ` Yuezhang.Mo
2024-10-14 10:33   ` syzbot
2024-10-17  2:20 ` Yuezhang.Mo
2024-10-17  2:57   ` syzbot
2024-10-17  3:32     ` Yuezhang.Mo
2024-10-17  4:18       ` syzbot
2024-10-17  9:49 ` Yuezhang.Mo
2024-10-17 10:11   ` syzbot
2024-10-19  4:01 ` Namjae Jeon
2024-10-19  5:20   ` syzbot
2024-10-29  4:17 ` Namjae Jeon
2024-10-29  9:28   ` syzbot

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