mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [syzbot] [ntfs3?] KMSAN: uninit-value in ni_seek_data_or_hole
@ 2026-05-26  2:48 syzbot
  2026-05-26  6:35 ` Edward Adam Davis
  2026-05-26  8:08 ` [PATCH] fs/ntfs3: prevent potential lcn remains uninitialized Edward Adam Davis
  0 siblings, 2 replies; 5+ messages in thread
From: syzbot @ 2026-05-26  2:48 UTC (permalink / raw)
  To: almaz.alexandrovich, linux-kernel, ntfs3, syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    cca95436be15 Merge tag 'phy-fixes-7.1' of git://git.kernel..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=10e36d6a580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=91978e795dcd971b
dashboard link: https://syzkaller.appspot.com/bug?extid=c2cfe997245202e46f10
compiler:       Debian clang version 21.1.8 (++20251221033036+2078da43e25a-1~exp1~20251221153213.50), Debian LLD 21.1.8
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=147dad96580000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=140c2cec580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/fb3ceeccf5bc/disk-cca95436.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/af588c0672f1/vmlinux-cca95436.xz
kernel image: https://storage.googleapis.com/syzbot-assets/beac806b38fd/bzImage-cca95436.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/7ca9c62c48ea/mount_0.gz

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

ntfs3(loop0): Mark volume as dirty due to NTFS errors
ntfs3(loop0): ino=1a, mi_enum_attr
ntfs3(loop0): ino=1a, mi_enum_attr
ntfs3(loop0): Failed to initialize $Extend/$Reparse.
=====================================================
BUG: KMSAN: uninit-value in ni_seek_data_or_hole+0x24f/0x5f0 fs/ntfs3/frecord.c:2862
 ni_seek_data_or_hole+0x24f/0x5f0 fs/ntfs3/frecord.c:2862
 ntfs_llseek+0x22a/0x4a0 fs/ntfs3/file.c:1530
 vfs_llseek fs/read_write.c:391 [inline]
 ksys_lseek fs/read_write.c:404 [inline]
 __do_sys_lseek fs/read_write.c:414 [inline]
 __se_sys_lseek fs/read_write.c:412 [inline]
 __x64_sys_lseek+0x29d/0x460 fs/read_write.c:412
 x64_sys_call+0x3004/0x3ea0 arch/x86/include/generated/asm/syscalls_64.h:9
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0x134/0xf80 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Uninit was stored to memory at:
 ni_seek_data_or_hole+0x248/0x5f0 fs/ntfs3/frecord.c:2862
 ntfs_llseek+0x22a/0x4a0 fs/ntfs3/file.c:1530
 vfs_llseek fs/read_write.c:391 [inline]
 ksys_lseek fs/read_write.c:404 [inline]
 __do_sys_lseek fs/read_write.c:414 [inline]
 __se_sys_lseek fs/read_write.c:412 [inline]
 __x64_sys_lseek+0x29d/0x460 fs/read_write.c:412
 x64_sys_call+0x3004/0x3ea0 arch/x86/include/generated/asm/syscalls_64.h:9
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0x134/0xf80 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Local variable lcn created at:
 ni_seek_data_or_hole+0x72/0x5f0 fs/ntfs3/frecord.c:2851
 ntfs_llseek+0x22a/0x4a0 fs/ntfs3/file.c:1530

CPU: 0 UID: 0 PID: 5901 Comm: syz.0.17 Not tainted syzkaller #0 PREEMPT(full) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/18/2026
=====================================================


---
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] [ntfs3?] KMSAN: uninit-value in ni_seek_data_or_hole
  2026-05-26  2:48 [syzbot] [ntfs3?] KMSAN: uninit-value in ni_seek_data_or_hole syzbot
@ 2026-05-26  6:35 ` Edward Adam Davis
  2026-05-26  7:35   ` syzbot
  2026-05-26  8:08 ` [PATCH] fs/ntfs3: prevent potential lcn remains uninitialized Edward Adam Davis
  1 sibling, 1 reply; 5+ messages in thread
From: Edward Adam Davis @ 2026-05-26  6:35 UTC (permalink / raw)
  To: syzbot+c2cfe997245202e46f10; +Cc: linux-kernel, syzkaller-bugs

#syz test

diff --git a/fs/ntfs3/frecord.c b/fs/ntfs3/frecord.c
index 7b035da63c12..d511b6a75ae8 100644
--- a/fs/ntfs3/frecord.c
+++ b/fs/ntfs3/frecord.c
@@ -2859,6 +2859,11 @@ loff_t ni_seek_data_or_hole(struct ntfs_inode *ni, loff_t offset, bool data)
 			return err;
 		}
 
+		if (!clen) {
+			/* Corrupted file. */
+			return -EINVAL;
+		}
+
 		if (lcn == RESIDENT_LCN) {
 			/* clen - resident size in bytes. clen == ni->vfs_inode.i_size */
 			if (offset >= clen) {
@@ -2909,10 +2914,6 @@ loff_t ni_seek_data_or_hole(struct ntfs_inode *ni, loff_t offset, bool data)
 			}
 		}
 
-		if (!clen) {
-			/* Corrupted file. */
-			return -EINVAL;
-		}
 	}
 }
 


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

* Re: [syzbot] [ntfs3?] KMSAN: uninit-value in ni_seek_data_or_hole
  2026-05-26  6:35 ` Edward Adam Davis
@ 2026-05-26  7:35   ` syzbot
  0 siblings, 0 replies; 5+ messages in thread
From: syzbot @ 2026-05-26  7:35 UTC (permalink / raw)
  To: eadavis, linux-kernel, syzkaller-bugs

Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
lost connection to test machine



Tested on:

commit:         e8c2f9fd Merge tag 'for-7.1/hpfs-fixes' of git://git.k..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=103f5aa6580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=91978e795dcd971b
dashboard link: https://syzkaller.appspot.com/bug?extid=c2cfe997245202e46f10
compiler:       Debian clang version 21.1.8 (++20251221033036+2078da43e25a-1~exp1~20251221153213.50), Debian LLD 21.1.8
patch:          https://syzkaller.appspot.com/x/patch.diff?x=10119aec580000


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

* [PATCH] fs/ntfs3: prevent potential lcn remains uninitialized
  2026-05-26  2:48 [syzbot] [ntfs3?] KMSAN: uninit-value in ni_seek_data_or_hole syzbot
  2026-05-26  6:35 ` Edward Adam Davis
@ 2026-05-26  8:08 ` Edward Adam Davis
  2026-06-10 10:43   ` Konstantin Komarov
  1 sibling, 1 reply; 5+ messages in thread
From: Edward Adam Davis @ 2026-05-26  8:08 UTC (permalink / raw)
  To: syzbot+c2cfe997245202e46f10
  Cc: almaz.alexandrovich, linux-kernel, ntfs3, syzkaller-bugs

The target VCN being sought was not found within runs[0], causing
run_lookup() to return false. This causes run_lookup_entry() to return
false, which in turn results in a len value of 0, and the new parameter
passed to attr_data_get_block() is NULL. Collectively, these factors
ultimately cause attr_data_get_block_locked() to exit prematurely without
initializing lcn, thereby triggering [1].

To prevent [1], the clen check within ni_seek_data_or_hole() has been
moved to occur before the lcn check.

[1]
BUG: KMSAN: uninit-value in ni_seek_data_or_hole+0x24f/0x5f0 fs/ntfs3/frecord.c:2862
 ni_seek_data_or_hole+0x24f/0x5f0 fs/ntfs3/frecord.c:2862
 ntfs_llseek+0x22a/0x4a0 fs/ntfs3/file.c:1530
 vfs_llseek fs/read_write.c:391 [inline]

Fixes: c61326967728 ("fs/ntfs3: implement llseek SEEK_DATA/SEEK_HOLE by scanning data runs")
Reported-by: syzbot+c2cfe997245202e46f10@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=c2cfe997245202e46f10
Signed-off-by: Edward Adam Davis <eadavis@qq.com>
---
 fs/ntfs3/frecord.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/fs/ntfs3/frecord.c b/fs/ntfs3/frecord.c
index 7b035da63c12..d511b6a75ae8 100644
--- a/fs/ntfs3/frecord.c
+++ b/fs/ntfs3/frecord.c
@@ -2859,6 +2859,11 @@ loff_t ni_seek_data_or_hole(struct ntfs_inode *ni, loff_t offset, bool data)
 			return err;
 		}
 
+		if (!clen) {
+			/* Corrupted file. */
+			return -EINVAL;
+		}
+
 		if (lcn == RESIDENT_LCN) {
 			/* clen - resident size in bytes. clen == ni->vfs_inode.i_size */
 			if (offset >= clen) {
@@ -2909,10 +2914,6 @@ loff_t ni_seek_data_or_hole(struct ntfs_inode *ni, loff_t offset, bool data)
 			}
 		}
 
-		if (!clen) {
-			/* Corrupted file. */
-			return -EINVAL;
-		}
 	}
 }
 
-- 
2.43.0


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

* Re: [PATCH] fs/ntfs3: prevent potential lcn remains uninitialized
  2026-05-26  8:08 ` [PATCH] fs/ntfs3: prevent potential lcn remains uninitialized Edward Adam Davis
@ 2026-06-10 10:43   ` Konstantin Komarov
  0 siblings, 0 replies; 5+ messages in thread
From: Konstantin Komarov @ 2026-06-10 10:43 UTC (permalink / raw)
  To: Edward Adam Davis, syzbot+c2cfe997245202e46f10
  Cc: linux-kernel, ntfs3, syzkaller-bugs

On 5/26/26 10:08, Edward Adam Davis wrote:

> The target VCN being sought was not found within runs[0], causing
> run_lookup() to return false. This causes run_lookup_entry() to return
> false, which in turn results in a len value of 0, and the new parameter
> passed to attr_data_get_block() is NULL. Collectively, these factors
> ultimately cause attr_data_get_block_locked() to exit prematurely without
> initializing lcn, thereby triggering [1].
>
> To prevent [1], the clen check within ni_seek_data_or_hole() has been
> moved to occur before the lcn check.
>
> [1]
> BUG: KMSAN: uninit-value in ni_seek_data_or_hole+0x24f/0x5f0 fs/ntfs3/frecord.c:2862
>   ni_seek_data_or_hole+0x24f/0x5f0 fs/ntfs3/frecord.c:2862
>   ntfs_llseek+0x22a/0x4a0 fs/ntfs3/file.c:1530
>   vfs_llseek fs/read_write.c:391 [inline]
>
> Fixes: c61326967728 ("fs/ntfs3: implement llseek SEEK_DATA/SEEK_HOLE by scanning data runs")
> Reported-by: syzbot+c2cfe997245202e46f10@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=c2cfe997245202e46f10
> Signed-off-by: Edward Adam Davis <eadavis@qq.com>
> ---
>   fs/ntfs3/frecord.c | 9 +++++----
>   1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/fs/ntfs3/frecord.c b/fs/ntfs3/frecord.c
> index 7b035da63c12..d511b6a75ae8 100644
> --- a/fs/ntfs3/frecord.c
> +++ b/fs/ntfs3/frecord.c
> @@ -2859,6 +2859,11 @@ loff_t ni_seek_data_or_hole(struct ntfs_inode *ni, loff_t offset, bool data)
>   			return err;
>   		}
>   
> +		if (!clen) {
> +			/* Corrupted file. */
> +			return -EINVAL;
> +		}
> +
>   		if (lcn == RESIDENT_LCN) {
>   			/* clen - resident size in bytes. clen == ni->vfs_inode.i_size */
>   			if (offset >= clen) {
> @@ -2909,10 +2914,6 @@ loff_t ni_seek_data_or_hole(struct ntfs_inode *ni, loff_t offset, bool data)
>   			}
>   		}
>   
> -		if (!clen) {
> -			/* Corrupted file. */
> -			return -EINVAL;
> -		}
>   	}
>   }
>   

Hello,

The patch was applied, thank you.

Regards,
Konstantin


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

end of thread, other threads:[~2026-06-10 10:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-26  2:48 [syzbot] [ntfs3?] KMSAN: uninit-value in ni_seek_data_or_hole syzbot
2026-05-26  6:35 ` Edward Adam Davis
2026-05-26  7:35   ` syzbot
2026-05-26  8:08 ` [PATCH] fs/ntfs3: prevent potential lcn remains uninitialized Edward Adam Davis
2026-06-10 10:43   ` Konstantin Komarov

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

all inboxes | Powered by JetHome®