* [syzbot] [ntfs3?] INFO: trying to register non-static key in mark_as_free_ex
@ 2024-09-04 1:15 syzbot
2024-09-04 2:28 ` Edward Adam Davis
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: syzbot @ 2024-09-04 1:15 UTC (permalink / raw)
To: almaz.alexandrovich, linux-kernel, ntfs3, syzkaller-bugs
Hello,
syzbot found the following issue on:
HEAD commit: 431c1646e1f8 Linux 6.11-rc6
git tree: upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=10f3370b980000
kernel config: https://syzkaller.appspot.com/x/.config?x=660f6eb11f9c7dc5
dashboard link: https://syzkaller.appspot.com/bug?extid=3bfd2cc059ab93efcdb4
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=16b809eb980000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1495c40d980000
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/8f73ff24e19d/disk-431c1646.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/a9cc8629dafc/vmlinux-431c1646.xz
kernel image: https://storage.googleapis.com/syzbot-assets/01c91ce5203b/bzImage-431c1646.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/9687e33b346d/mount_0.gz
The issue was bisected to:
commit 110b24eb1a749bea3440f3ca2ff890a26179050a
Author: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Date: Wed Apr 17 07:33:06 2024 +0000
fs/ntfs3: Taking DOS names into account during link counting
bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=13aefeb7980000
final oops: https://syzkaller.appspot.com/x/report.txt?x=106efeb7980000
console output: https://syzkaller.appspot.com/x/log.txt?x=17aefeb7980000
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+3bfd2cc059ab93efcdb4@syzkaller.appspotmail.com
Fixes: 110b24eb1a74 ("fs/ntfs3: Taking DOS names into account during link counting")
loop0: detected capacity change from 0 to 8192
ntfs3: loop0: Different NTFS sector size (4096) and media sector size (512).
INFO: trying to register non-static key.
The code is fine but needs lockdep annotation, or maybe
you didn't initialize this object before use?
turning off the locking correctness validator.
CPU: 0 UID: 0 PID: 5231 Comm: syz-executor253 Not tainted 6.11.0-rc6-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:93 [inline]
dump_stack_lvl+0x241/0x360 lib/dump_stack.c:119
assign_lock_key+0x238/0x270 kernel/locking/lockdep.c:975
register_lock_class+0x1cf/0x980 kernel/locking/lockdep.c:1288
__lock_acquire+0xf0/0x2040 kernel/locking/lockdep.c:5019
lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5759
down_write_nested+0xa2/0x220 kernel/locking/rwsem.c:1695
mark_as_free_ex+0x3e/0x390 fs/ntfs3/fsntfs.c:2484
run_unpack+0x7f3/0xda0 fs/ntfs3/run.c:1019
run_unpack_ex+0x14b/0x7f0 fs/ntfs3/run.c:1060
ni_delete_all+0x2d9/0x9a0 fs/ntfs3/frecord.c:1610
ni_clear+0x28e/0x4b0 fs/ntfs3/frecord.c:106
evict+0x534/0x950 fs/inode.c:704
ntfs_loadlog_and_replay+0x2e8/0x4f0 fs/ntfs3/fsntfs.c:326
ntfs_fill_super+0x2c38/0x4730 fs/ntfs3/super.c:1280
get_tree_bdev+0x3f9/0x570 fs/super.c:1635
vfs_get_tree+0x92/0x2b0 fs/super.c:1800
do_new_mount+0x2be/0xb40 fs/namespace.c:3472
do_mount fs/namespace.c:3812 [inline]
__do_sys_mount fs/namespace.c:4020 [inline]
__se_sys_mount+0x2d6/0x3c0 fs/namespace.c:3997
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f3f008c4daa
Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 5e 04 00 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffda8f23918 EFLAGS: 00000286 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007ffda8f23930 RCX: 00007f3f008c4daa
RDX: 0000000020020b80 RSI: 0000000020020bc0 RDI: 00007ffda8f23930
RBP: 0000000000000004 R08: 00007ffda8f23970 R09: 0000000000020b83
R10: 0000000000000000 R11: 0000000000000286 R12: 0000000000000000
R13: 00007ffda8f23970 R14: 0000000000000003 R15: 0000000000400000
</TASK>
Oops: general protection fault, probably for non-canonical address 0xdffffc0000000002: 0000 [#1] PREEMPT SMP KASAN NOPTI
KASAN: null-ptr-deref in range [0x0000000000000010-0x0000000000000017]
CPU: 1 UID: 0 PID: 5231 Comm: syz-executor253 Not tainted 6.11.0-rc6-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
RIP: 0010:wnd_is_used+0x58/0x520 fs/ntfs3/bitmap.c:928
Code: 48 c1 e8 03 80 3c 18 00 74 08 4c 89 ff e8 a0 11 13 ff 49 8b 1f 48 8d 6b 14 48 89 e8 48 c1 e8 03 48 b9 00 00 00 00 00 fc ff df <0f> b6 04 08 84 c0 0f 85 7b 04 00 00 0f b6 6d 00 4c 8d 75 03 bf 3d
RSP: 0018:ffffc90009257288 EFLAGS: 00010213
RAX: 0000000000000002 RBX: 0000000000000000 RCX: dffffc0000000000
RDX: 0000000000000000 RSI: 0000000000000002 RDI: ffff88802ebf41f8
RBP: 0000000000000014 R08: ffff88802ebf420f R09: 1ffff11005d7e841
R10: dffffc0000000000 R11: ffffed1005d7e842 R12: 0000000000000003
R13: 0000000000000002 R14: 0000000000000002 R15: ffff88802ebf41f8
FS: 000055556c297380(0000) GS:ffff8880b8900000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f20b8995ed8 CR3: 000000007757a000 CR4: 0000000000350ef0
Call Trace:
<TASK>
mark_as_free_ex+0x53/0x390 fs/ntfs3/fsntfs.c:2485
run_unpack+0x7f3/0xda0 fs/ntfs3/run.c:1019
run_unpack_ex+0x14b/0x7f0 fs/ntfs3/run.c:1060
ni_delete_all+0x2d9/0x9a0 fs/ntfs3/frecord.c:1610
ni_clear+0x28e/0x4b0 fs/ntfs3/frecord.c:106
evict+0x534/0x950 fs/inode.c:704
ntfs_loadlog_and_replay+0x2e8/0x4f0 fs/ntfs3/fsntfs.c:326
ntfs_fill_super+0x2c38/0x4730 fs/ntfs3/super.c:1280
get_tree_bdev+0x3f9/0x570 fs/super.c:1635
vfs_get_tree+0x92/0x2b0 fs/super.c:1800
do_new_mount+0x2be/0xb40 fs/namespace.c:3472
do_mount fs/namespace.c:3812 [inline]
__do_sys_mount fs/namespace.c:4020 [inline]
__se_sys_mount+0x2d6/0x3c0 fs/namespace.c:3997
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f3f008c4daa
Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 5e 04 00 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffda8f23918 EFLAGS: 00000286 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007ffda8f23930 RCX: 00007f3f008c4daa
RDX: 0000000020020b80 RSI: 0000000020020bc0 RDI: 00007ffda8f23930
RBP: 0000000000000004 R08: 00007ffda8f23970 R09: 0000000000020b83
R10: 0000000000000000 R11: 0000000000000286 R12: 0000000000000000
R13: 00007ffda8f23970 R14: 0000000000000003 R15: 0000000000400000
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:wnd_is_used+0x58/0x520 fs/ntfs3/bitmap.c:928
Code: 48 c1 e8 03 80 3c 18 00 74 08 4c 89 ff e8 a0 11 13 ff 49 8b 1f 48 8d 6b 14 48 89 e8 48 c1 e8 03 48 b9 00 00 00 00 00 fc ff df <0f> b6 04 08 84 c0 0f 85 7b 04 00 00 0f b6 6d 00 4c 8d 75 03 bf 3d
RSP: 0018:ffffc90009257288 EFLAGS: 00010213
RAX: 0000000000000002 RBX: 0000000000000000 RCX: dffffc0000000000
RDX: 0000000000000000 RSI: 0000000000000002 RDI: ffff88802ebf41f8
RBP: 0000000000000014 R08: ffff88802ebf420f R09: 1ffff11005d7e841
R10: dffffc0000000000 R11: ffffed1005d7e842 R12: 0000000000000003
R13: 0000000000000002 R14: 0000000000000002 R15: ffff88802ebf41f8
FS: 000055556c297380(0000) GS:ffff8880b8900000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f20b8995ed8 CR3: 000000007757a000 CR4: 0000000000350ef0
----------------
Code disassembly (best guess):
0: 48 c1 e8 03 shr $0x3,%rax
4: 80 3c 18 00 cmpb $0x0,(%rax,%rbx,1)
8: 74 08 je 0x12
a: 4c 89 ff mov %r15,%rdi
d: e8 a0 11 13 ff call 0xff1311b2
12: 49 8b 1f mov (%r15),%rbx
15: 48 8d 6b 14 lea 0x14(%rbx),%rbp
19: 48 89 e8 mov %rbp,%rax
1c: 48 c1 e8 03 shr $0x3,%rax
20: 48 b9 00 00 00 00 00 movabs $0xdffffc0000000000,%rcx
27: fc ff df
* 2a: 0f b6 04 08 movzbl (%rax,%rcx,1),%eax <-- trapping instruction
2e: 84 c0 test %al,%al
30: 0f 85 7b 04 00 00 jne 0x4b1
36: 0f b6 6d 00 movzbl 0x0(%rbp),%ebp
3a: 4c 8d 75 03 lea 0x3(%rbp),%r14
3e: bf .byte 0xbf
3f: 3d .byte 0x3d
---
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.
For information about bisection process see: https://goo.gl/tpsmEJ#bisection
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] 10+ messages in thread
* Re: [syzbot] [ntfs3?] INFO: trying to register non-static key in mark_as_free_ex
2024-09-04 1:15 [syzbot] [ntfs3?] INFO: trying to register non-static key in mark_as_free_ex syzbot
@ 2024-09-04 2:28 ` Edward Adam Davis
2024-09-04 2:55 ` syzbot
2024-09-07 1:42 ` [PATCH] fs/ntfs3: Move condition bitmap.sb to before run_unpack Edward Adam Davis
2024-09-09 15:13 ` [syzbot] possible fix (linux-ntfs3) syzbot
2 siblings, 1 reply; 10+ messages in thread
From: Edward Adam Davis @ 2024-09-04 2:28 UTC (permalink / raw)
To: syzbot+3bfd2cc059ab93efcdb4
Cc: almaz.alexandrovich, linux-kernel, ntfs3, syzkaller-bugs
Before call this path, sbi->used.bitmap.sb has not been initialized in ntfs_fill_super.
#syz test
diff --git a/fs/ntfs3/run.c b/fs/ntfs3/run.c
index cb8cf0161177..8970101147c7 100644
--- a/fs/ntfs3/run.c
+++ b/fs/ntfs3/run.c
@@ -1057,11 +1057,14 @@ int run_unpack_ex(struct runs_tree *run, struct ntfs_sb_info *sbi, CLST ino,
bool ok;
struct wnd_bitmap *wnd;
+ if (!sbi->used.bitmap.sb)
+ return -EINVAL;
+
ret = run_unpack(run, sbi, ino, svcn, evcn, vcn, run_buf, run_buf_size);
if (ret <= 0)
return ret;
- if (!sbi->used.bitmap.sb || !run || run == RUN_DEALLOCATE)
+ if (!run || run == RUN_DEALLOCATE)
return ret;
if (ino == MFT_REC_BADCLUST)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [syzbot] [ntfs3?] INFO: trying to register non-static key in mark_as_free_ex
2024-09-04 2:28 ` Edward Adam Davis
@ 2024-09-04 2:55 ` syzbot
0 siblings, 0 replies; 10+ messages in thread
From: syzbot @ 2024-09-04 2:55 UTC (permalink / raw)
To: almaz.alexandrovich, eadavis, linux-kernel, ntfs3, syzkaller-bugs
Hello,
syzbot has tested the proposed patch and the reproducer did not trigger any issue:
Reported-by: syzbot+3bfd2cc059ab93efcdb4@syzkaller.appspotmail.com
Tested-by: syzbot+3bfd2cc059ab93efcdb4@syzkaller.appspotmail.com
Tested on:
commit: 88fac175 Merge tag 'fuse-fixes-6.11-rc7' of git://git...
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1587c0b3980000
kernel config: https://syzkaller.appspot.com/x/.config?x=660f6eb11f9c7dc5
dashboard link: https://syzkaller.appspot.com/bug?extid=3bfd2cc059ab93efcdb4
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=1277c88b980000
Note: testing is done by a robot and is best-effort only.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] fs/ntfs3: Move condition bitmap.sb to before run_unpack
2024-09-04 1:15 [syzbot] [ntfs3?] INFO: trying to register non-static key in mark_as_free_ex syzbot
2024-09-04 2:28 ` Edward Adam Davis
@ 2024-09-07 1:42 ` Edward Adam Davis
2024-09-09 15:13 ` [syzbot] possible fix (linux-ntfs3) syzbot
2 siblings, 0 replies; 10+ messages in thread
From: Edward Adam Davis @ 2024-09-07 1:42 UTC (permalink / raw)
To: syzbot+3bfd2cc059ab93efcdb4
Cc: almaz.alexandrovich, linux-kernel, ntfs3, syzkaller-bugs
[Syzbot reported]
ntfs3: loop0: Different NTFS sector size (4096) and media sector size (512).
INFO: trying to register non-static key.
The code is fine but needs lockdep annotation, or maybe
you didn't initialize this object before use?
turning off the locking correctness validator.
CPU: 0 UID: 0 PID: 5231 Comm: syz-executor253 Not tainted 6.11.0-rc6-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:93 [inline]
dump_stack_lvl+0x241/0x360 lib/dump_stack.c:119
assign_lock_key+0x238/0x270 kernel/locking/lockdep.c:975
register_lock_class+0x1cf/0x980 kernel/locking/lockdep.c:1288
__lock_acquire+0xf0/0x2040 kernel/locking/lockdep.c:5019
lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5759
down_write_nested+0xa2/0x220 kernel/locking/rwsem.c:1695
mark_as_free_ex+0x3e/0x390 fs/ntfs3/fsntfs.c:2484
run_unpack+0x7f3/0xda0 fs/ntfs3/run.c:1019
run_unpack_ex+0x14b/0x7f0 fs/ntfs3/run.c:1060
ni_delete_all+0x2d9/0x9a0 fs/ntfs3/frecord.c:1610
ni_clear+0x28e/0x4b0 fs/ntfs3/frecord.c:106
evict+0x534/0x950 fs/inode.c:704
ntfs_loadlog_and_replay+0x2e8/0x4f0 fs/ntfs3/fsntfs.c:326
ntfs_fill_super+0x2c38/0x4730 fs/ntfs3/super.c:1280
get_tree_bdev+0x3f9/0x570 fs/super.c:1635
vfs_get_tree+0x92/0x2b0 fs/super.c:1800
do_new_mount+0x2be/0xb40 fs/namespace.c:3472
do_mount fs/namespace.c:3812 [inline]
__do_sys_mount fs/namespace.c:4020 [inline]
__se_sys_mount+0x2d6/0x3c0 fs/namespace.c:3997
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
[Analysis]
Before call this path, sbi->used.bitmap.sb has not been initialized in
ntfs_fill_super.
Reported-and-tested-by: syzbot+3bfd2cc059ab93efcdb4@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=3bfd2cc059ab93efcdb4
Signed-off-by: Edward Adam Davis <eadavis@qq.com>
---
fs/ntfs3/run.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/fs/ntfs3/run.c b/fs/ntfs3/run.c
index cb8cf0161177..8970101147c7 100644
--- a/fs/ntfs3/run.c
+++ b/fs/ntfs3/run.c
@@ -1057,11 +1057,14 @@ int run_unpack_ex(struct runs_tree *run, struct ntfs_sb_info *sbi, CLST ino,
bool ok;
struct wnd_bitmap *wnd;
+ if (!sbi->used.bitmap.sb)
+ return -EINVAL;
+
ret = run_unpack(run, sbi, ino, svcn, evcn, vcn, run_buf, run_buf_size);
if (ret <= 0)
return ret;
- if (!sbi->used.bitmap.sb || !run || run == RUN_DEALLOCATE)
+ if (!run || run == RUN_DEALLOCATE)
return ret;
if (ino == MFT_REC_BADCLUST)
--
2.43.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [syzbot] possible fix (linux-ntfs3)
2024-09-04 1:15 [syzbot] [ntfs3?] INFO: trying to register non-static key in mark_as_free_ex syzbot
2024-09-04 2:28 ` Edward Adam Davis
2024-09-07 1:42 ` [PATCH] fs/ntfs3: Move condition bitmap.sb to before run_unpack Edward Adam Davis
@ 2024-09-09 15:13 ` syzbot
2 siblings, 0 replies; 10+ messages in thread
From: syzbot @ 2024-09-09 15:13 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: possible fix (linux-ntfs3)
Author: almaz.alexandrovich@paragon-software.com
#syz test: https://github.com/Paragon-Software-Group/linux-ntfs3.git master
diff --git a/fs/ntfs3/frecord.c b/fs/ntfs3/frecord.c
index 7d4e54161291..41c7ffad2790 100644
--- a/fs/ntfs3/frecord.c
+++ b/fs/ntfs3/frecord.c
@@ -102,7 +102,9 @@ void ni_clear(struct ntfs_inode *ni)
{
struct rb_node *node;
- if (!ni->vfs_inode.i_nlink && ni->mi.mrec && is_rec_inuse(ni->mi.mrec))
+ if (!ni->vfs_inode.i_nlink && ni->mi.mrec &&
+ is_rec_inuse(ni->mi.mrec) &&
+ !(ni->mi.sbi->flags & NTFS_FLAGS_LOG_REPLAYING))
ni_delete_all(ni);
al_destroy(ni);
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [syzbot] possible fix (linux-ntfs3)
2024-09-01 20:28 [syzbot] [ntfs3?] KMSAN: uninit-value in ntfs_read_bh syzbot
@ 2024-09-10 7:14 ` syzbot
0 siblings, 0 replies; 10+ messages in thread
From: syzbot @ 2024-09-10 7:14 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: possible fix (linux-ntfs3)
Author: almaz.alexandrovich@paragon-software.com
Not sure about all indexes on volume must have the same index_block_size.
#syz test: https://github.com/Paragon-Software-Group/linux-ntfs3.git master
diff --git a/fs/ntfs3/index.c b/fs/ntfs3/index.c
index 9089c58a005c..63fbb8ba6e1b 100644
--- a/fs/ntfs3/index.c
+++ b/fs/ntfs3/index.c
@@ -892,7 +892,9 @@ int indx_init(struct ntfs_index *indx, struct ntfs_sb_info *sbi,
indx->idx2vbn_bits = __ffs(root->index_block_clst);
t32 = le32_to_cpu(root->index_block_size);
- indx->index_bits = blksize_bits(t32);
+ if (t32 != sbi->index_size)
+ goto out;
+ indx->index_bits = sbi->index_bits;
/* Check index record size. */
if (t32 < sbi->cluster_size) {
diff --git a/fs/ntfs3/ntfs_fs.h b/fs/ntfs3/ntfs_fs.h
index 3dd6215316e4..73d72fa8ab65 100644
--- a/fs/ntfs3/ntfs_fs.h
+++ b/fs/ntfs3/ntfs_fs.h
@@ -222,8 +222,9 @@ struct ntfs_sb_info {
u32 record_size;
u32 index_size;
- u8 cluster_bits;
- u8 record_bits;
+ u8 cluster_bits; // log2(cluster_size)
+ u8 record_bits; // log2(record_size)
+ u8 index_bits; // log2(index_size)
u64 maxbytes; // Maximum size for normal files.
u64 maxbytes_sparse; // Maximum size for sparse file.
diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c
index 128d49512f5d..f96641b80869 100644
--- a/fs/ntfs3/super.c
+++ b/fs/ntfs3/super.c
@@ -993,6 +993,7 @@ static int ntfs_init_from_boot(struct super_block *sb, u32 sector_size,
sbi->index_size);
goto out;
}
+ sbi->index_bits = blksize_bits(sbi->index_size);
sbi->volume.size = sectors * boot_sector_size;
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [syzbot] possible fix (linux-ntfs3)
2024-08-16 13:07 [syzbot] [ntfs3?] kernel panic: stack is corrupted in vprintk_emit syzbot
2024-09-02 12:27 ` [syzbot] possible fix (linux-ntfs3) syzbot
@ 2024-09-10 7:08 ` syzbot
1 sibling, 0 replies; 10+ messages in thread
From: syzbot @ 2024-09-10 7:08 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: possible fix (linux-ntfs3)
Author: almaz.alexandrovich@paragon-software.com
#syz test: https://github.com/Paragon-Software-Group/linux-ntfs3.git master
diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c
index 128d49512f5d..4a2062e481a4 100644
--- a/fs/ntfs3/super.c
+++ b/fs/ntfs3/super.c
@@ -124,10 +124,15 @@ void ntfs_inode_printk(struct inode *inode, const char *fmt, ...)
struct dentry *de = d_find_alias(inode);
if (de) {
+ int len;
spin_lock(&de->d_lock);
- snprintf(name, sizeof(s_name_buf), " \"%s\"",
- de->d_name.name);
+ len = snprintf(name, sizeof(s_name_buf), " \"%s\"",
+ de->d_name.name);
spin_unlock(&de->d_lock);
+ if (len <= 0)
+ name[0] = 0;
+ else if (len >= sizeof(s_name_buf))
+ name[sizeof(s_name_buf) - 1] = 0;
} else {
name[0] = 0;
}
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [syzbot] possible fix (linux-ntfs3)
2022-10-01 13:47 [syzbot] possible deadlock in mi_read syzbot
@ 2024-09-02 13:17 ` syzbot
0 siblings, 0 replies; 10+ messages in thread
From: syzbot @ 2024-09-02 13:17 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: possible fix (linux-ntfs3)
Author: almaz.alexandrovich@paragon-software.com
#syz test: https://github.com/Paragon-Software-Group/linux-ntfs3.git master
diff --git a/fs/ntfs3/namei.c b/fs/ntfs3/namei.c
index fc720ad9c57a..aa7e9d70e32e 100644
--- a/fs/ntfs3/namei.c
+++ b/fs/ntfs3/namei.c
@@ -81,7 +81,7 @@ static struct dentry *ntfs_lookup(struct inode *dir, struct dentry *dentry,
if (err < 0)
inode = ERR_PTR(err);
else {
- ni_lock(ni);
+ ni_lock_dir(ni);
inode = dir_search_u(dir, uni, NULL);
ni_unlock(ni);
}
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [syzbot] possible fix (linux-ntfs3)
2024-07-13 6:10 [syzbot] [ntfs3?] general protection fault in run_is_mapped_full syzbot
@ 2024-09-02 13:00 ` syzbot
0 siblings, 0 replies; 10+ messages in thread
From: syzbot @ 2024-09-02 13:00 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: possible fix (linux-ntfs3)
Author: almaz.alexandrovich@paragon-software.com
#syz test: https://github.com/Paragon-Software-Group/linux-ntfs3.git master
diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c
index 1963a8928360..ab2abd323859 100644
--- a/fs/ntfs3/inode.c
+++ b/fs/ntfs3/inode.c
@@ -1679,7 +1679,10 @@ int ntfs_create_inode(struct mnt_idmap *idmap, struct inode *dir,
attr = ni_find_attr(ni, NULL, NULL, ATTR_EA, NULL, 0, NULL, NULL);
if (attr && attr->non_res) {
/* Delete ATTR_EA, if non-resident. */
- attr_set_size(ni, ATTR_EA, NULL, 0, NULL, 0, NULL, false, NULL);
+ struct runs_tree run;
+ run_init(&run);
+ attr_set_size(ni, ATTR_EA, NULL, 0, &run, 0, NULL, false, NULL);
+ run_close(&run);
}
if (rp_inserted)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [syzbot] possible fix (linux-ntfs3)
2024-08-16 13:07 [syzbot] [ntfs3?] kernel panic: stack is corrupted in vprintk_emit syzbot
@ 2024-09-02 12:27 ` syzbot
2024-09-10 7:08 ` syzbot
1 sibling, 0 replies; 10+ messages in thread
From: syzbot @ 2024-09-02 12:27 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: possible fix (linux-ntfs3)
Author: almaz.alexandrovich@paragon-software.com
#syz test: https://github.com/Paragon-Software-Group/linux-ntfs3.git master
diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c
index 128d49512f5d..c08bbacc0030 100644
--- a/fs/ntfs3/super.c
+++ b/fs/ntfs3/super.c
@@ -125,8 +125,9 @@ void ntfs_inode_printk(struct inode *inode, const
char *fmt, ...)
if (de) {
spin_lock(&de->d_lock);
- snprintf(name, sizeof(s_name_buf), " \"%s\"",
- de->d_name.name);
+ if (snprintf(name, sizeof(s_name_buf), " \"%s\"",
+ de->d_name.name) >= sizeof(s_name_buf))
+ name[sizeof(s_name_buf) - 1] = 0;
spin_unlock(&de->d_lock);
} else {
name[0] = 0;
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2024-09-10 7:14 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-04 1:15 [syzbot] [ntfs3?] INFO: trying to register non-static key in mark_as_free_ex syzbot
2024-09-04 2:28 ` Edward Adam Davis
2024-09-04 2:55 ` syzbot
2024-09-07 1:42 ` [PATCH] fs/ntfs3: Move condition bitmap.sb to before run_unpack Edward Adam Davis
2024-09-09 15:13 ` [syzbot] possible fix (linux-ntfs3) syzbot
-- strict thread matches above, loose matches on Subject: below --
2024-09-01 20:28 [syzbot] [ntfs3?] KMSAN: uninit-value in ntfs_read_bh syzbot
2024-09-10 7:14 ` [syzbot] possible fix (linux-ntfs3) syzbot
2024-08-16 13:07 [syzbot] [ntfs3?] kernel panic: stack is corrupted in vprintk_emit syzbot
2024-09-02 12:27 ` [syzbot] possible fix (linux-ntfs3) syzbot
2024-09-10 7:08 ` syzbot
2024-07-13 6:10 [syzbot] [ntfs3?] general protection fault in run_is_mapped_full syzbot
2024-09-02 13:00 ` [syzbot] possible fix (linux-ntfs3) syzbot
2022-10-01 13:47 [syzbot] possible deadlock in mi_read syzbot
2024-09-02 13:17 ` [syzbot] possible fix (linux-ntfs3) syzbot
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®