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-next>] [day] [month] [year] [list]
Message-ID: <VI1P193MB0752266E3E55B2D918F8E43799C4A@VI1P193MB0752.EURP193.PROD.OUTLOOK.COM>
Date:   Tue,  3 Oct 2023 18:49:22 +0800
From:   Juntong Deng <juntong.deng@...look.com>
To:     shaggy@...nel.org, cuigaosheng1@...wei.com
Cc:     jfs-discussion@...ts.sourceforge.net, linux-kernel@...r.kernel.org,
        linux-kernel-mentees@...ts.linuxfoundation.org,
        syzbot+76a072c2f8a60280bd70@...kaller.appspotmail.com
Subject: [PATCH] fs/jfs: Add checking for out-of-bounds index in binary search in xtSearch

There is currently no out-of-bounds check for the index in a binary
search, which may cause errors.

The following is related bug reported by Syzbot:

UBSAN: array-index-out-of-bounds in fs/jfs/jfs_xtree.c:360:4
index 18 is out of range for type 'xad_t [18]'

Checking if the index exceeds the size of the xad array can solve
this bug.

Reported-by: syzbot+76a072c2f8a60280bd70@...kaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=76a072c2f8a60280bd70
Signed-off-by: Juntong Deng <juntong.deng@...look.com>
---
 fs/jfs/jfs_xtree.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/jfs/jfs_xtree.c b/fs/jfs/jfs_xtree.c
index 2d304cee884c..6b55bb1e4089 100644
--- a/fs/jfs/jfs_xtree.c
+++ b/fs/jfs/jfs_xtree.c
@@ -356,6 +356,8 @@ static int xtSearch(struct inode *ip, s64 xoff,	s64 *nextp,
 		 */
 		for (base = XTENTRYSTART; lim; lim >>= 1) {
 			index = base + (lim >> 1);
+			if (index >= XTROOTMAXSLOT)
+				break;
 
 			XT_CMP(cmp, xoff, &p->xad[index], t64);
 			if (cmp == 0) {
-- 
2.39.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ