public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [syzbot] [fs?] KMSAN: uninit-value in full_proxy_unlocked_ioctl
@ 2025-02-02 13:28 syzbot
  2025-02-03  1:54 ` Edward Adam Davis
  2025-02-03  3:27 ` [PATCH] debugfs: add fsd's methods initialization Edward Adam Davis
  0 siblings, 2 replies; 7+ messages in thread
From: syzbot @ 2025-02-02 13:28 UTC (permalink / raw)
  To: dakr, gregkh, linux-fsdevel, linux-kernel, rafael, syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    b4b0881156fb Merge tag 'docs-6.14-2' of git://git.lwn.net/..
git tree:       upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=12a04518580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=7d0bb5e08cf54aa2
dashboard link: https://syzkaller.appspot.com/bug?extid=8928e473a91452caca2f
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=150776b0580000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=16aaab64580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/4dbe3cd3dcb8/disk-b4b08811.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/592d90859f86/vmlinux-b4b08811.xz
kernel image: https://storage.googleapis.com/syzbot-assets/4cfde2b63c7f/bzImage-b4b08811.xz

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

=====================================================
BUG: KMSAN: uninit-value in full_proxy_unlocked_ioctl+0xed/0x3a0 fs/debugfs/file.c:399
 full_proxy_unlocked_ioctl+0xed/0x3a0 fs/debugfs/file.c:399
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:906 [inline]
 __se_sys_ioctl+0x246/0x440 fs/ioctl.c:892
 __x64_sys_ioctl+0x96/0xe0 fs/ioctl.c:892
 x64_sys_call+0x19f0/0x3c30 arch/x86/include/generated/asm/syscalls_64.h:17
 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:
 __debugfs_file_get+0xe59/0xef0 fs/debugfs/file.c:120
 full_proxy_open_regular+0x67/0xa00 fs/debugfs/file.c:447
 do_dentry_open+0x1bdd/0x26b0 fs/open.c:955
 vfs_open+0x53/0x5b0 fs/open.c:1085
 do_open fs/namei.c:3830 [inline]
 path_openat+0x56a1/0x6250 fs/namei.c:3989
 do_filp_open+0x268/0x600 fs/namei.c:4016
 do_sys_openat2+0x1bf/0x2f0 fs/open.c:1427
 do_sys_open fs/open.c:1442 [inline]
 __do_sys_openat fs/open.c:1458 [inline]
 __se_sys_openat fs/open.c:1453 [inline]
 __x64_sys_openat+0x2a1/0x310 fs/open.c:1453
 x64_sys_call+0x36f5/0x3c30 arch/x86/include/generated/asm/syscalls_64.h:258
 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:
 __debugfs_file_get+0xdff/0xef0 fs/debugfs/file.c:118
 full_proxy_open_regular+0x67/0xa00 fs/debugfs/file.c:447
 do_dentry_open+0x1bdd/0x26b0 fs/open.c:955
 vfs_open+0x53/0x5b0 fs/open.c:1085
 do_open fs/namei.c:3830 [inline]
 path_openat+0x56a1/0x6250 fs/namei.c:3989
 do_filp_open+0x268/0x600 fs/namei.c:4016
 do_sys_openat2+0x1bf/0x2f0 fs/open.c:1427
 do_sys_open fs/open.c:1442 [inline]
 __do_sys_openat fs/open.c:1458 [inline]
 __se_sys_openat fs/open.c:1453 [inline]
 __x64_sys_openat+0x2a1/0x310 fs/open.c:1453
 x64_sys_call+0x36f5/0x3c30 arch/x86/include/generated/asm/syscalls_64.h:258
 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 created at:
 slab_post_alloc_hook mm/slub.c:4121 [inline]
 slab_alloc_node mm/slub.c:4164 [inline]
 __kmalloc_cache_noprof+0x8e3/0xdf0 mm/slub.c:4320
 kmalloc_noprof include/linux/slab.h:901 [inline]
 __debugfs_file_get+0x31d/0xef0 fs/debugfs/file.c:101
 full_proxy_open_regular+0x67/0xa00 fs/debugfs/file.c:447
 do_dentry_open+0x1bdd/0x26b0 fs/open.c:955
 vfs_open+0x53/0x5b0 fs/open.c:1085
 do_open fs/namei.c:3830 [inline]
 path_openat+0x56a1/0x6250 fs/namei.c:3989
 do_filp_open+0x268/0x600 fs/namei.c:4016
 do_sys_openat2+0x1bf/0x2f0 fs/open.c:1427
 do_sys_open fs/open.c:1442 [inline]
 __do_sys_openat fs/open.c:1458 [inline]
 __se_sys_openat fs/open.c:1453 [inline]
 __x64_sys_openat+0x2a1/0x310 fs/open.c:1453
 x64_sys_call+0x36f5/0x3c30 arch/x86/include/generated/asm/syscalls_64.h:258
 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: 5781 Comm: syz-executor325 Not tainted 6.13.0-syzkaller-09585-gb4b0881156fb #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/27/2024
=====================================================


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at 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] 7+ messages in thread

* Re: [syzbot] [fs?] KMSAN: uninit-value in full_proxy_unlocked_ioctl
  2025-02-02 13:28 [syzbot] [fs?] KMSAN: uninit-value in full_proxy_unlocked_ioctl syzbot
@ 2025-02-03  1:54 ` Edward Adam Davis
  2025-02-03  2:57   ` syzbot
  2025-02-03  3:27 ` [PATCH] debugfs: add fsd's methods initialization Edward Adam Davis
  1 sibling, 1 reply; 7+ messages in thread
From: Edward Adam Davis @ 2025-02-03  1:54 UTC (permalink / raw)
  To: syzbot+8928e473a91452caca2f; +Cc: linux-kernel, syzkaller-bugs

#syz test

diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
index e33cc77699cd..5fbefce2b372 100644
--- a/fs/debugfs/file.c
+++ b/fs/debugfs/file.c
@@ -102,6 +102,7 @@ static int __debugfs_file_get(struct dentry *dentry, enum dbgfs_get_mode mode)
 		if (!fsd)
 			return -ENOMEM;
 
+		fsd->methods = 0;
 		if (mode == DBGFS_GET_SHORT) {
 			const struct debugfs_short_fops *ops;
 			ops = fsd->short_fops = DEBUGFS_I(inode)->short_fops;


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

* Re: [syzbot] [fs?] KMSAN: uninit-value in full_proxy_unlocked_ioctl
  2025-02-03  1:54 ` Edward Adam Davis
@ 2025-02-03  2:57   ` syzbot
  0 siblings, 0 replies; 7+ messages in thread
From: syzbot @ 2025-02-03  2:57 UTC (permalink / raw)
  To: eadavis, linux-kernel, syzkaller-bugs

Hello,

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

Reported-by: syzbot+8928e473a91452caca2f@syzkaller.appspotmail.com
Tested-by: syzbot+8928e473a91452caca2f@syzkaller.appspotmail.com

Tested on:

commit:         2014c95a Linux 6.14-rc1
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=16fd2eb0580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=aa4f01a8a3baec54
dashboard link: https://syzkaller.appspot.com/bug?extid=8928e473a91452caca2f
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch:          https://syzkaller.appspot.com/x/patch.diff?x=1710ed18580000

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

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

* [PATCH] debugfs: add fsd's methods initialization
  2025-02-02 13:28 [syzbot] [fs?] KMSAN: uninit-value in full_proxy_unlocked_ioctl syzbot
  2025-02-03  1:54 ` Edward Adam Davis
@ 2025-02-03  3:27 ` Edward Adam Davis
  2025-02-03  8:14   ` Greg KH
  1 sibling, 1 reply; 7+ messages in thread
From: Edward Adam Davis @ 2025-02-03  3:27 UTC (permalink / raw)
  To: syzbot+8928e473a91452caca2f
  Cc: dakr, gregkh, linux-fsdevel, linux-kernel, rafael, syzkaller-bugs

syzbot reported a uninit-value in full_proxy_unlocked_ioctl. [1]

The newly created fsd does not initialize methods, and increases the
initialization of methods for fsd.

[1]
BUG: KMSAN: uninit-value in full_proxy_unlocked_ioctl+0xed/0x3a0 fs/debugfs/file.c:399
 full_proxy_unlocked_ioctl+0xed/0x3a0 fs/debugfs/file.c:399
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:906 [inline]
 __se_sys_ioctl+0x246/0x440 fs/ioctl.c:892
 __x64_sys_ioctl+0x96/0xe0 fs/ioctl.c:892
 x64_sys_call+0x19f0/0x3c30 arch/x86/include/generated/asm/syscalls_64.h:17
 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

Fixes: 41a0ecc0997c ("debugfs: get rid of dynamically allocation proxy_ops")
Reported-by: syzbot+8928e473a91452caca2f@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=8928e473a91452caca2f
Tested-by: syzbot+8928e473a91452caca2f@syzkaller.appspotmail.com
Signed-off-by: Edward Adam Davis <eadavis@qq.com>
---
 fs/debugfs/file.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
index e33cc77699cd..5fbefce2b372 100644
--- a/fs/debugfs/file.c
+++ b/fs/debugfs/file.c
@@ -102,6 +102,7 @@ static int __debugfs_file_get(struct dentry *dentry, enum dbgfs_get_mode mode)
 		if (!fsd)
 			return -ENOMEM;
 
+		fsd->methods = 0;
 		if (mode == DBGFS_GET_SHORT) {
 			const struct debugfs_short_fops *ops;
 			ops = fsd->short_fops = DEBUGFS_I(inode)->short_fops;
-- 
2.43.0


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

* Re: [PATCH] debugfs: add fsd's methods initialization
  2025-02-03  3:27 ` [PATCH] debugfs: add fsd's methods initialization Edward Adam Davis
@ 2025-02-03  8:14   ` Greg KH
  2025-02-03 11:05     ` Edward Adam Davis
  0 siblings, 1 reply; 7+ messages in thread
From: Greg KH @ 2025-02-03  8:14 UTC (permalink / raw)
  To: Edward Adam Davis
  Cc: syzbot+8928e473a91452caca2f, dakr, linux-fsdevel, linux-kernel,
	rafael, syzkaller-bugs

On Mon, Feb 03, 2025 at 11:27:56AM +0800, Edward Adam Davis wrote:
> syzbot reported a uninit-value in full_proxy_unlocked_ioctl. [1]
> 
> The newly created fsd does not initialize methods, and increases the
> initialization of methods for fsd.
> 
> [1]
> BUG: KMSAN: uninit-value in full_proxy_unlocked_ioctl+0xed/0x3a0 fs/debugfs/file.c:399
>  full_proxy_unlocked_ioctl+0xed/0x3a0 fs/debugfs/file.c:399
>  vfs_ioctl fs/ioctl.c:51 [inline]
>  __do_sys_ioctl fs/ioctl.c:906 [inline]
>  __se_sys_ioctl+0x246/0x440 fs/ioctl.c:892
>  __x64_sys_ioctl+0x96/0xe0 fs/ioctl.c:892
>  x64_sys_call+0x19f0/0x3c30 arch/x86/include/generated/asm/syscalls_64.h:17
>  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
> 
> Fixes: 41a0ecc0997c ("debugfs: get rid of dynamically allocation proxy_ops")
> Reported-by: syzbot+8928e473a91452caca2f@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=8928e473a91452caca2f
> Tested-by: syzbot+8928e473a91452caca2f@syzkaller.appspotmail.com
> Signed-off-by: Edward Adam Davis <eadavis@qq.com>
> ---
>  fs/debugfs/file.c | 1 +
>  1 file changed, 1 insertion(+)

Is this still an issue on 6.14-rc1, specifically after commit
57b314752ec0 ("debugfs: Fix the missing initializations in
__debugfs_file_get()")?

thanks,

greg k-h

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

* Re: [PATCH] debugfs: add fsd's methods initialization
  2025-02-03  8:14   ` Greg KH
@ 2025-02-03 11:05     ` Edward Adam Davis
  2025-02-03 11:27       ` Greg KH
  0 siblings, 1 reply; 7+ messages in thread
From: Edward Adam Davis @ 2025-02-03 11:05 UTC (permalink / raw)
  To: gregkh
  Cc: dakr, eadavis, linux-fsdevel, linux-kernel, rafael,
	syzbot+8928e473a91452caca2f, syzkaller-bugs

On Mon, 3 Feb 2025 09:14:51 +0100, Greg KH wrote:
> On Mon, Feb 03, 2025 at 11:27:56AM +0800, Edward Adam Davis wrote:
> > syzbot reported a uninit-value in full_proxy_unlocked_ioctl. [1]
> >
> > The newly created fsd does not initialize methods, and increases the
> > initialization of methods for fsd.
> >
> > [1]
> > BUG: KMSAN: uninit-value in full_proxy_unlocked_ioctl+0xed/0x3a0 fs/debugfs/file.c:399
> >  full_proxy_unlocked_ioctl+0xed/0x3a0 fs/debugfs/file.c:399
> >  vfs_ioctl fs/ioctl.c:51 [inline]
> >  __do_sys_ioctl fs/ioctl.c:906 [inline]
> >  __se_sys_ioctl+0x246/0x440 fs/ioctl.c:892
> >  __x64_sys_ioctl+0x96/0xe0 fs/ioctl.c:892
> >  x64_sys_call+0x19f0/0x3c30 arch/x86/include/generated/asm/syscalls_64.h:17
> >  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
> >
> > Fixes: 41a0ecc0997c ("debugfs: get rid of dynamically allocation proxy_ops")
> > Reported-by: syzbot+8928e473a91452caca2f@syzkaller.appspotmail.com
> > Closes: https://syzkaller.appspot.com/bug?extid=8928e473a91452caca2f
> > Tested-by: syzbot+8928e473a91452caca2f@syzkaller.appspotmail.com
> > Signed-off-by: Edward Adam Davis <eadavis@qq.com>
> > ---
> >  fs/debugfs/file.c | 1 +
> >  1 file changed, 1 insertion(+)
> 
> Is this still an issue on 6.14-rc1, specifically after commit
> 57b314752ec0 ("debugfs: Fix the missing initializations in
> __debugfs_file_get()")?
No.

Edward


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

* Re: [PATCH] debugfs: add fsd's methods initialization
  2025-02-03 11:05     ` Edward Adam Davis
@ 2025-02-03 11:27       ` Greg KH
  0 siblings, 0 replies; 7+ messages in thread
From: Greg KH @ 2025-02-03 11:27 UTC (permalink / raw)
  To: Edward Adam Davis
  Cc: dakr, linux-fsdevel, linux-kernel, rafael,
	syzbot+8928e473a91452caca2f, syzkaller-bugs

On Mon, Feb 03, 2025 at 07:05:32PM +0800, Edward Adam Davis wrote:
> On Mon, 3 Feb 2025 09:14:51 +0100, Greg KH wrote:
> > On Mon, Feb 03, 2025 at 11:27:56AM +0800, Edward Adam Davis wrote:
> > > syzbot reported a uninit-value in full_proxy_unlocked_ioctl. [1]
> > >
> > > The newly created fsd does not initialize methods, and increases the
> > > initialization of methods for fsd.
> > >
> > > [1]
> > > BUG: KMSAN: uninit-value in full_proxy_unlocked_ioctl+0xed/0x3a0 fs/debugfs/file.c:399
> > >  full_proxy_unlocked_ioctl+0xed/0x3a0 fs/debugfs/file.c:399
> > >  vfs_ioctl fs/ioctl.c:51 [inline]
> > >  __do_sys_ioctl fs/ioctl.c:906 [inline]
> > >  __se_sys_ioctl+0x246/0x440 fs/ioctl.c:892
> > >  __x64_sys_ioctl+0x96/0xe0 fs/ioctl.c:892
> > >  x64_sys_call+0x19f0/0x3c30 arch/x86/include/generated/asm/syscalls_64.h:17
> > >  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
> > >
> > > Fixes: 41a0ecc0997c ("debugfs: get rid of dynamically allocation proxy_ops")
> > > Reported-by: syzbot+8928e473a91452caca2f@syzkaller.appspotmail.com
> > > Closes: https://syzkaller.appspot.com/bug?extid=8928e473a91452caca2f
> > > Tested-by: syzbot+8928e473a91452caca2f@syzkaller.appspotmail.com
> > > Signed-off-by: Edward Adam Davis <eadavis@qq.com>
> > > ---
> > >  fs/debugfs/file.c | 1 +
> > >  1 file changed, 1 insertion(+)
> > 
> > Is this still an issue on 6.14-rc1, specifically after commit
> > 57b314752ec0 ("debugfs: Fix the missing initializations in
> > __debugfs_file_get()")?
> No.

Great, I'll forget about it then :)

thanks!

greg k-h

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

end of thread, other threads:[~2025-02-03 11:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-02 13:28 [syzbot] [fs?] KMSAN: uninit-value in full_proxy_unlocked_ioctl syzbot
2025-02-03  1:54 ` Edward Adam Davis
2025-02-03  2:57   ` syzbot
2025-02-03  3:27 ` [PATCH] debugfs: add fsd's methods initialization Edward Adam Davis
2025-02-03  8:14   ` Greg KH
2025-02-03 11:05     ` Edward Adam Davis
2025-02-03 11:27       ` Greg KH

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