lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tencent_9BD933289E991B764BEB1B58256ABA02BB08@qq.com>
Date: Sun, 22 Dec 2024 22:16:06 +0800
From: Edward Adam Davis <eadavis@...com>
To: viro@...iv.linux.org.uk
Cc: devel@...ts.orangefs.org,
	eadavis@...com,
	hubcap@...ibond.com,
	linux-kernel@...r.kernel.org,
	martin@...ibond.com,
	syzbot+fc519d7875f2d9186c1f@...kaller.appspotmail.com,
	syzkaller-bugs@...glegroups.com
Subject: [PATCH V2] orangefs: fix a oob in orangefs_debug_write

syzbot report a slab-out-of-bounds Read in orangefs_debug_write. [1]

When the count value is greater than ORANGEFS_MAX_DEBUG_STRING_LEN + 1 in
orangefs_debug_write(), it is set to ORANGEFS_MAX_DEBUG_STRING_LEN + 1.
The allocated buf length is ORANGEFS_MAX_DEBUG_STRING_LEN, and the length
of the data copied to the buf is ORANGEFS_MAX_DEBUG_STRING_LEN, which causes
strlen() to be out of bounds.

Update the threshold of count to prevent this issue.

[1]
BUG: KASAN: slab-out-of-bounds in strlen+0x93/0xa0 lib/string.c:413
Read of size 1 at addr ffff88814d695800 by task syz-executor153/5822

CPU: 0 UID: 0 PID: 5822 Comm: syz-executor153 Not tainted 6.13.0-rc3-syzkaller-00026-g59dbb9d81adf #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/25/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:94 [inline]
 dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120
 print_address_description mm/kasan/report.c:378 [inline]
 print_report+0xc3/0x620 mm/kasan/report.c:489
 kasan_report+0xd9/0x110 mm/kasan/report.c:602
 strlen+0x93/0xa0 lib/string.c:413
 kstrdup+0x29/0xb0 mm/util.c:81
 debug_string_to_mask+0x82/0x570 fs/orangefs/orangefs-debugfs.c:836
 orangefs_debug_write+0x22e/0x780 fs/orangefs/orangefs-debugfs.c:423
 full_proxy_write+0xfb/0x1b0 fs/debugfs/file.c:356
 vfs_write+0x24c/0x1150 fs/read_write.c:677
 ksys_write+0x12b/0x250 fs/read_write.c:731
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Reported-by: syzbot+fc519d7875f2d9186c1f@...kaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=fc519d7875f2d9186c1f
Signed-off-by: Edward Adam Davis <eadavis@...com>
---
V1 -> V2: Update the threshold of count

 fs/orangefs/orangefs-debugfs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/orangefs/orangefs-debugfs.c b/fs/orangefs/orangefs-debugfs.c
index 1b508f543384..fa41db088488 100644
--- a/fs/orangefs/orangefs-debugfs.c
+++ b/fs/orangefs/orangefs-debugfs.c
@@ -393,9 +393,9 @@ static ssize_t orangefs_debug_write(struct file *file,
 	 * Thwart users who try to jamb a ridiculous number
 	 * of bytes into the debug file...
 	 */
-	if (count > ORANGEFS_MAX_DEBUG_STRING_LEN + 1) {
+	if (count > ORANGEFS_MAX_DEBUG_STRING_LEN) {
 		silly = count;
-		count = ORANGEFS_MAX_DEBUG_STRING_LEN + 1;
+		count = ORANGEFS_MAX_DEBUG_STRING_LEN;
 	}
 
 	buf = kzalloc(ORANGEFS_MAX_DEBUG_STRING_LEN, GFP_KERNEL);
-- 
2.47.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ