public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [syzbot] [ocfs2?] KMSAN: uninit-value in from_kuid (2)
@ 2024-09-20 15:21 syzbot
  2024-09-21  2:40 ` Edward Adam Davis
  2024-09-22  1:52 ` Edward Adam Davis
  0 siblings, 2 replies; 5+ messages in thread
From: syzbot @ 2024-09-20 15:21 UTC (permalink / raw)
  To: jlbec, joseph.qi, linux-kernel, mark, ocfs2-devel, syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    2004cef11ea0 Merge tag 'sched-core-2024-09-19' of git://gi..
git tree:       upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=1737fb00580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=ea86c03799707382
dashboard link: https://syzkaller.appspot.com/bug?extid=6c55f725d1bdc8c52058
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=16ad1607980000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=10b7fb00580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/712bb1e6270f/disk-2004cef1.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/4c85f46e8c8b/vmlinux-2004cef1.xz
kernel image: https://storage.googleapis.com/syzbot-assets/9e811c6cc65b/bzImage-2004cef1.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/2a5b0a53fa65/mount_0.gz

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

ocfs2: Mounting device (7,0) on (node local, slot 0) with ordered data mode.
=====================================================
BUG: KMSAN: uninit-value in map_id_up_base kernel/user_namespace.c:355 [inline]
BUG: KMSAN: uninit-value in map_id_up kernel/user_namespace.c:385 [inline]
BUG: KMSAN: uninit-value in from_kuid+0x41e/0x990 kernel/user_namespace.c:433
 map_id_up_base kernel/user_namespace.c:355 [inline]
 map_id_up kernel/user_namespace.c:385 [inline]
 from_kuid+0x41e/0x990 kernel/user_namespace.c:433
 ocfs2_setattr+0x254/0x3140 fs/ocfs2/file.c:1133
 notify_change+0x1a8e/0x1b80 fs/attr.c:503
 do_truncate fs/open.c:65 [inline]
 do_ftruncate+0x8c1/0xbf0 fs/open.c:181
 do_sys_ftruncate fs/open.c:199 [inline]
 __do_sys_ftruncate fs/open.c:207 [inline]
 __se_sys_ftruncate fs/open.c:205 [inline]
 __x64_sys_ftruncate+0x133/0x280 fs/open.c:205
 x64_sys_call+0x9e4/0x3ba0 arch/x86/include/generated/asm/syscalls_64.h:78
 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

Local variable newattrs.i created at:
 do_truncate fs/open.c:43 [inline]
 do_ftruncate+0x600/0xbf0 fs/open.c:181
 do_sys_ftruncate fs/open.c:199 [inline]
 __do_sys_ftruncate fs/open.c:207 [inline]
 __se_sys_ftruncate fs/open.c:205 [inline]
 __x64_sys_ftruncate+0x133/0x280 fs/open.c:205

CPU: 0 UID: 0 PID: 5177 Comm: syz-executor217 Not tainted 6.11.0-syzkaller-07337-g2004cef11ea0 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/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] 5+ messages in thread

* Re: [syzbot] [ocfs2?] KMSAN: uninit-value in from_kuid (2)
  2024-09-20 15:21 [syzbot] [ocfs2?] KMSAN: uninit-value in from_kuid (2) syzbot
@ 2024-09-21  2:40 ` Edward Adam Davis
  2024-09-21  4:32   ` syzbot
  2024-09-22  1:52 ` Edward Adam Davis
  1 sibling, 1 reply; 5+ messages in thread
From: Edward Adam Davis @ 2024-09-21  2:40 UTC (permalink / raw)
  To: syzbot+6c55f725d1bdc8c52058
  Cc: jlbec, joseph.qi, linux-kernel, mark, ocfs2-devel, syzkaller-bugs

use inode's uid and gid to replace attr

#syz test

diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index ccc57038a977..d4be183bf149 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -1129,8 +1129,8 @@ int ocfs2_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
 			    (unsigned long long)OCFS2_I(inode)->ip_blkno,
 			    dentry->d_name.len, dentry->d_name.name,
 			    attr->ia_valid, attr->ia_mode,
-			    from_kuid(&init_user_ns, attr->ia_uid),
-			    from_kgid(&init_user_ns, attr->ia_gid));
+			    from_kuid(&init_user_ns, inode->i_uid),
+			    from_kgid(&init_user_ns, inode->i_gid));
 
 	/* ensuring we don't even attempt to truncate a symlink */
 	if (S_ISLNK(inode->i_mode))


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

* Re: [syzbot] [ocfs2?] KMSAN: uninit-value in from_kuid (2)
  2024-09-21  2:40 ` Edward Adam Davis
@ 2024-09-21  4:32   ` syzbot
  0 siblings, 0 replies; 5+ messages in thread
From: syzbot @ 2024-09-21  4:32 UTC (permalink / raw)
  To: eadavis, jlbec, joseph.qi, linux-kernel, mark, ocfs2-devel,
	syzkaller-bugs

Hello,

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

Reported-by: syzbot+6c55f725d1bdc8c52058@syzkaller.appspotmail.com
Tested-by: syzbot+6c55f725d1bdc8c52058@syzkaller.appspotmail.com

Tested on:

commit:         1868f9d0 Merge tag 'for-linux-6.12-ofs1' of git://git...
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1152ee9f980000
kernel config:  https://syzkaller.appspot.com/x/.config?x=acaa65be5f19fc5a
dashboard link: https://syzkaller.appspot.com/bug?extid=6c55f725d1bdc8c52058
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch:          https://syzkaller.appspot.com/x/patch.diff?x=136b7607980000

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

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

* Re: [syzbot] [ocfs2?] KMSAN: uninit-value in from_kuid (2)
  2024-09-20 15:21 [syzbot] [ocfs2?] KMSAN: uninit-value in from_kuid (2) syzbot
  2024-09-21  2:40 ` Edward Adam Davis
@ 2024-09-22  1:52 ` Edward Adam Davis
  2024-09-22  2:13   ` syzbot
  1 sibling, 1 reply; 5+ messages in thread
From: Edward Adam Davis @ 2024-09-22  1:52 UTC (permalink / raw)
  To: syzbot+6c55f725d1bdc8c52058
  Cc: jlbec, joseph.qi, linux-kernel, mark, ocfs2-devel, syzkaller-bugs

use vfsuid and vfsgid to replace

#syz test

diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index ccc57038a977..beb4f241bdeb 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -1129,8 +1129,8 @@ int ocfs2_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
 			    (unsigned long long)OCFS2_I(inode)->ip_blkno,
 			    dentry->d_name.len, dentry->d_name.name,
 			    attr->ia_valid, attr->ia_mode,
-			    from_kuid(&init_user_ns, attr->ia_uid),
-			    from_kgid(&init_user_ns, attr->ia_gid));
+			    from_kuid(&init_user_ns, attr->ia_vfsuid),
+			    from_kgid(&init_user_ns, attr->ia_vfsgid));
 
 	/* ensuring we don't even attempt to truncate a symlink */
 	if (S_ISLNK(inode->i_mode))


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

* Re: [syzbot] [ocfs2?] KMSAN: uninit-value in from_kuid (2)
  2024-09-22  1:52 ` Edward Adam Davis
@ 2024-09-22  2:13   ` syzbot
  0 siblings, 0 replies; 5+ messages in thread
From: syzbot @ 2024-09-22  2:13 UTC (permalink / raw)
  To: eadavis, jlbec, joseph.qi, linux-kernel, mark, ocfs2-devel,
	syzkaller-bugs

Hello,

syzbot tried to test the proposed patch but the build/boot failed:

fs/ocfs2/file.c:1133:33: error: passing 'vfsuid_t' to parameter of incompatible type 'kuid_t'
fs/ocfs2/file.c:1134:33: error: passing 'vfsgid_t' to parameter of incompatible type 'kgid_t'


Tested on:

commit:         88264981 Merge tag 'sched_ext-for-6.12' of git://git.k..
git tree:       upstream
kernel config:  https://syzkaller.appspot.com/x/.config?x=ea86c03799707382
dashboard link: https://syzkaller.appspot.com/bug?extid=6c55f725d1bdc8c52058
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch:          https://syzkaller.appspot.com/x/patch.diff?x=17113080580000


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

end of thread, other threads:[~2024-09-22  2:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-20 15:21 [syzbot] [ocfs2?] KMSAN: uninit-value in from_kuid (2) syzbot
2024-09-21  2:40 ` Edward Adam Davis
2024-09-21  4:32   ` syzbot
2024-09-22  1:52 ` Edward Adam Davis
2024-09-22  2:13   ` syzbot

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