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: <20240710001244.2707-1-rbrasga@uci.edu>
Date: Wed, 10 Jul 2024 00:12:44 +0000
From: Remington Brasga <rbrasga@....edu>
To: Dave Kleikamp <shaggy@...nel.org>,
	Manas Ghandat <ghandatmanas@...il.com>,
	Juntong Deng <juntong.deng@...look.com>,
	Andrew Kanner <andrew.kanner@...il.com>,
	Osama Muhammad <osmtendev@...il.com>,
	Shuah Khan <skhan@...uxfoundation.org>
Cc: jfs-discussion@...ts.sourceforge.net,
	linux-kernel@...r.kernel.org,
	linux-kernel-mentees@...ts.linuxfoundation.org,
	syzbot+e38d703eeb410b17b473@...kaller.appspotmail.com,
	Remington Brasga <rbrasga@....edu>
Subject: [PATCH] jfs: UBSAN: shift-out-of-bounds in dbFindBits

Fix issue with UBSAN throwing shift-out-of-bounds warning.

Reported-by: syzbot+e38d703eeb410b17b473@...kaller.appspotmail.com
Signed-off-by: Remington Brasga <rbrasga@....edu>
---
When nb = 32, `mask = mask >> nb` or shorthand `mask >>= nb` throws
shift-out-of-bounds warning.
`mask = (mask >> nb)` removes that warning. 

Link to the syzbot bug report: https://lore.kernel.org/all/0000000000006fc563061cbc7f9c@google.com/T/

 fs/jfs/jfs_dmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c
index cb3cda1390ad..636aae946e84 100644
--- a/fs/jfs/jfs_dmap.c
+++ b/fs/jfs/jfs_dmap.c
@@ -3020,7 +3020,7 @@ static int dbFindBits(u32 word, int l2nb)
 
 	/* scan the word for nb free bits at nb alignments.
 	 */
-	for (bitno = 0; mask != 0; bitno += nb, mask >>= nb) {
+	for (bitno = 0; mask != 0; bitno += nb, mask = (mask >> nb)) {
 		if ((mask & word) == mask)
 			break;
 	}
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ