linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [syzbot] [reiserfs?] KASAN: slab-out-of-bounds Read in search_by_key (2)
       [not found] <0000000000002d868805ec92cbf0@google.com>
@ 2023-12-25 20:28 ` syzbot
  2023-12-26  7:16   ` [PATCH] reiserfs: fix uninit-value in comp_keys Edward Adam Davis
  0 siblings, 1 reply; 3+ messages in thread
From: syzbot @ 2023-12-25 20:28 UTC (permalink / raw)
  To: akpm, axboe, bvanassche, linux-fsdevel, linux-kernel,
	reiserfs-devel, song, syzkaller-bugs, yi.zhang

syzbot has found a reproducer for the following issue on:

HEAD commit:    861deac3b092 Linux 6.7-rc7
git tree:       upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=121f1609e80000
kernel config:  https://syzkaller.appspot.com/x/.config?x=e0c7078a6b901aa3
dashboard link: https://syzkaller.appspot.com/bug?extid=b3b14fb9f8a14c5d0267
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=10557e81e80000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=14206fd6e80000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/0ea60ee8ed32/disk-861deac3.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/6d69fdc33021/vmlinux-861deac3.xz
kernel image: https://storage.googleapis.com/syzbot-assets/f0158750d452/bzImage-861deac3.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/445a7c3f980d/mount_0.gz

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

REISERFS (device loop0): Created .reiserfs_priv - reserved for xattr storage.
=====================================================
BUG: KMSAN: uninit-value in comp_keys fs/reiserfs/stree.c:83 [inline]
BUG: KMSAN: uninit-value in bin_search fs/reiserfs/stree.c:173 [inline]
BUG: KMSAN: uninit-value in search_by_key+0x3293/0x6780 fs/reiserfs/stree.c:770
 comp_keys fs/reiserfs/stree.c:83 [inline]
 bin_search fs/reiserfs/stree.c:173 [inline]
 search_by_key+0x3293/0x6780 fs/reiserfs/stree.c:770
 reiserfs_delete_solid_item+0x4ec/0xe90 fs/reiserfs/stree.c:1419
 remove_save_link+0x2ed/0x420 fs/reiserfs/super.c:540
 reiserfs_truncate_file+0xd00/0x1b70 fs/reiserfs/inode.c:2314
 reiserfs_setattr+0x1b79/0x1ee0 fs/reiserfs/inode.c:3388
 notify_change+0x19fd/0x1af0 fs/attr.c:499
 do_truncate+0x22a/0x2a0 fs/open.c:66
 do_sys_ftruncate+0x81c/0xb30 fs/open.c:194
 __do_sys_ftruncate fs/open.c:205 [inline]
 __se_sys_ftruncate fs/open.c:203 [inline]
 __x64_sys_ftruncate+0x71/0xa0 fs/open.c:203
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0x44/0x110 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x63/0x6b

Local variable cpu_key created at:
 reiserfs_delete_solid_item+0xbf/0xe90 fs/reiserfs/stree.c:1410
 remove_save_link+0x2ed/0x420 fs/reiserfs/super.c:540

CPU: 0 PID: 5006 Comm: syz-executor429 Not tainted 6.7.0-rc7-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023
=====================================================


---
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.

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

* [PATCH] reiserfs: fix uninit-value in comp_keys
  2023-12-25 20:28 ` [syzbot] [reiserfs?] KASAN: slab-out-of-bounds Read in search_by_key (2) syzbot
@ 2023-12-26  7:16   ` Edward Adam Davis
  2023-12-28 10:57     ` Christian Brauner
  0 siblings, 1 reply; 3+ messages in thread
From: Edward Adam Davis @ 2023-12-26  7:16 UTC (permalink / raw)
  To: syzbot+b3b14fb9f8a14c5d0267
  Cc: akpm, axboe, bvanassche, linux-fsdevel, linux-kernel,
	reiserfs-devel, song, syzkaller-bugs, yi.zhang

The cpu_key was not initialized in reiserfs_delete_solid_item(), which triggered
this issue.

Reported-and-tested-by: syzbot+b3b14fb9f8a14c5d0267@syzkaller.appspotmail.com
Signed-off-by: Edward Adam Davis <eadavis@qq.com>
---
 fs/reiserfs/stree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c
index 2138ee7d271d..5faf702f8d15 100644
--- a/fs/reiserfs/stree.c
+++ b/fs/reiserfs/stree.c
@@ -1407,7 +1407,7 @@ void reiserfs_delete_solid_item(struct reiserfs_transaction_handle *th,
 	INITIALIZE_PATH(path);
 	int item_len = 0;
 	int tb_init = 0;
-	struct cpu_key cpu_key;
+	struct cpu_key cpu_key = {};
 	int retval;
 	int quota_cut_bytes = 0;
 
-- 
2.43.0


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

* Re: [PATCH] reiserfs: fix uninit-value in comp_keys
  2023-12-26  7:16   ` [PATCH] reiserfs: fix uninit-value in comp_keys Edward Adam Davis
@ 2023-12-28 10:57     ` Christian Brauner
  0 siblings, 0 replies; 3+ messages in thread
From: Christian Brauner @ 2023-12-28 10:57 UTC (permalink / raw)
  To: syzbot+b3b14fb9f8a14c5d0267, Edward Adam Davis
  Cc: Christian Brauner, akpm, axboe, bvanassche, linux-fsdevel,
	linux-kernel, reiserfs-devel, song, syzkaller-bugs, yi.zhang

On Tue, 26 Dec 2023 15:16:09 +0800, Edward Adam Davis wrote:
> The cpu_key was not initialized in reiserfs_delete_solid_item(), which triggered
> this issue.
> 
> 

Applied to the vfs.misc branch of the vfs/vfs.git tree.
Patches in the vfs.misc branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.misc

[1/1] reiserfs: fix uninit-value in comp_keys
      https://git.kernel.org/vfs/vfs/c/dd8f87f21dc3

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

end of thread, other threads:[~2023-12-28 10:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <0000000000002d868805ec92cbf0@google.com>
2023-12-25 20:28 ` [syzbot] [reiserfs?] KASAN: slab-out-of-bounds Read in search_by_key (2) syzbot
2023-12-26  7:16   ` [PATCH] reiserfs: fix uninit-value in comp_keys Edward Adam Davis
2023-12-28 10:57     ` Christian Brauner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).