public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [syzbot] [ocfs2?] KMSAN: uninit-value in ocfs2_file_read_iter
@ 2024-10-28  8:29 syzbot
  2024-10-29 11:16 ` [syzbot] " syzbot
  2024-10-29 12:15 ` syzbot
  0 siblings, 2 replies; 3+ messages in thread
From: syzbot @ 2024-10-28  8:29 UTC (permalink / raw)
  To: jlbec, joseph.qi, linux-kernel, mark, ocfs2-devel, syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    c2ee9f594da8 KVM: selftests: Fix build on on non-x86 archi..
git tree:       upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=16057c30580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=f0a45c444eedcbdb
dashboard link: https://syzkaller.appspot.com/bug?extid=a73e253cca4f0230a5a5
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=11677640580000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=12035287980000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/f80f18f107d8/disk-c2ee9f59.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/64d58c958a32/vmlinux-c2ee9f59.xz
kernel image: https://storage.googleapis.com/syzbot-assets/7c33b64644e2/bzImage-c2ee9f59.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/36ce847202f8/mount_0.gz

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

=====================================================
BUG: KMSAN: uninit-value in ocfs2_file_read_iter+0x9a4/0xf80 fs/ocfs2/file.c:2584
 ocfs2_file_read_iter+0x9a4/0xf80 fs/ocfs2/file.c:2584
 io_iter_do_read io_uring/rw.c:771 [inline]
 __io_read+0x8d2/0x20f0 io_uring/rw.c:865
 io_read+0x3e/0xf0 io_uring/rw.c:943
 io_issue_sqe+0x429/0x22c0 io_uring/io_uring.c:1739
 io_wq_submit_work+0xaf9/0xdc0 io_uring/io_uring.c:1848
 io_worker_handle_work+0xd11/0x2110 io_uring/io-wq.c:601
 io_wq_worker+0x447/0x1410 io_uring/io-wq.c:655
 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+0x1bf/0x1e0 mm/mempolicy.c:2345
 alloc_slab_page mm/slub.c:2412 [inline]
 allocate_slab+0x33a/0x1250 mm/slub.c:2578
 new_slab mm/slub.c:2631 [inline]
 ___slab_alloc+0x12ef/0x35e0 mm/slub.c:3818
 __kmem_cache_alloc_bulk mm/slub.c:4895 [inline]
 kmem_cache_alloc_bulk_noprof+0x486/0x1330 mm/slub.c:4967
 __io_alloc_req_refill+0x84/0x560 io_uring/io_uring.c:969
 io_alloc_req io_uring/io_uring.h:406 [inline]
 io_submit_sqes+0x172f/0x2f30 io_uring/io_uring.c:2313
 __do_sys_io_uring_enter io_uring/io_uring.c:3343 [inline]
 __se_sys_io_uring_enter+0x406/0x41c0 io_uring/io_uring.c:3279
 __x64_sys_io_uring_enter+0x11f/0x1a0 io_uring/io_uring.c:3279
 x64_sys_call+0x2b54/0x3ba0 arch/x86/include/generated/asm/syscalls_64.h:427
 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: iou-wrk-5184 Not tainted 6.12.0-rc4-syzkaller-00047-gc2ee9f594da8 #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] 3+ messages in thread

* Re: [syzbot] Re: KMSAN: uninit-value in ocfs2_file_read_iter
  2024-10-28  8:29 [syzbot] [ocfs2?] KMSAN: uninit-value in ocfs2_file_read_iter syzbot
@ 2024-10-29 11:16 ` syzbot
  2024-10-29 12:15 ` syzbot
  1 sibling, 0 replies; 3+ messages in thread
From: syzbot @ 2024-10-29 11:16 UTC (permalink / raw)
  To: linux-kernel, syzkaller-bugs

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.

***

Subject: Re: KMSAN: uninit-value in ocfs2_file_read_iter
Author: dmantipov@yandex.ru

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

diff --git a/fs/ocfs2/aops.h b/fs/ocfs2/aops.h
index 45db1781ea73..1d1b4b7edba0 100644
--- a/fs/ocfs2/aops.h
+++ b/fs/ocfs2/aops.h
@@ -70,6 +70,8 @@ enum ocfs2_iocb_lock_bits {
  	OCFS2_IOCB_NUM_LOCKS
  };

+#define ocfs2_iocb_init_rw_locked(iocb) \
+	(iocb->private = NULL)
  #define ocfs2_iocb_clear_rw_locked(iocb) \
  	clear_bit(OCFS2_IOCB_RW_LOCK, (unsigned long *)&iocb->private)
  #define ocfs2_iocb_rw_locked_level(iocb) \
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 58887456e3c5..1e37176ac405 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -2390,6 +2390,8 @@ static ssize_t ocfs2_file_write_iter(struct kiocb *iocb,
  	} else
  		inode_lock(inode);

+	ocfs2_iocb_init_rw_locked(iocb);
+
  	/*
  	 * Concurrent O_DIRECT writes are allowed with
  	 * mount_option "coherency=buffered".
@@ -2536,6 +2538,8 @@ static ssize_t ocfs2_file_read_iter(struct kiocb *iocb,
  	if (!direct_io && nowait)
  		return -EOPNOTSUPP;

+	ocfs2_iocb_init_rw_locked(iocb);
+
  	/*
  	 * buffered reads protect themselves in ->read_folio().  O_DIRECT reads
  	 * need locks to protect pending reads from racing with truncate.

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

* Re: [syzbot] Re: KMSAN: uninit-value in ocfs2_file_read_iter
  2024-10-28  8:29 [syzbot] [ocfs2?] KMSAN: uninit-value in ocfs2_file_read_iter syzbot
  2024-10-29 11:16 ` [syzbot] " syzbot
@ 2024-10-29 12:15 ` syzbot
  1 sibling, 0 replies; 3+ messages in thread
From: syzbot @ 2024-10-29 12:15 UTC (permalink / raw)
  To: linux-kernel, syzkaller-bugs

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.

***

Subject: Re: KMSAN: uninit-value in ocfs2_file_read_iter
Author: dmantipov@yandex.ru

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

diff --git a/fs/ocfs2/aops.h b/fs/ocfs2/aops.h
index 45db1781ea73..1d1b4b7edba0 100644
--- a/fs/ocfs2/aops.h
+++ b/fs/ocfs2/aops.h
@@ -70,6 +70,8 @@ enum ocfs2_iocb_lock_bits {
 	OCFS2_IOCB_NUM_LOCKS
 };
 
+#define ocfs2_iocb_init_rw_locked(iocb) \
+	(iocb->private = NULL)
 #define ocfs2_iocb_clear_rw_locked(iocb) \
 	clear_bit(OCFS2_IOCB_RW_LOCK, (unsigned long *)&iocb->private)
 #define ocfs2_iocb_rw_locked_level(iocb) \
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 58887456e3c5..1e37176ac405 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -2390,6 +2390,8 @@ static ssize_t ocfs2_file_write_iter(struct kiocb *iocb,
 	} else
 		inode_lock(inode);
 
+	ocfs2_iocb_init_rw_locked(iocb);
+
 	/*
 	 * Concurrent O_DIRECT writes are allowed with
 	 * mount_option "coherency=buffered".
@@ -2536,6 +2538,8 @@ static ssize_t ocfs2_file_read_iter(struct kiocb *iocb,
 	if (!direct_io && nowait)
 		return -EOPNOTSUPP;
 
+	ocfs2_iocb_init_rw_locked(iocb);
+
 	/*
 	 * buffered reads protect themselves in ->read_folio().  O_DIRECT reads
 	 * need locks to protect pending reads from racing with truncate.

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

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

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-28  8:29 [syzbot] [ocfs2?] KMSAN: uninit-value in ocfs2_file_read_iter syzbot
2024-10-29 11:16 ` [syzbot] " syzbot
2024-10-29 12:15 ` syzbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox