From nobody Sat Feb 7 13:41:31 2026 Received: from mail-ed1-f53.google.com (mail-ed1-f53.google.com [209.85.208.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 569E1B657 for ; Tue, 20 Aug 2024 01:22:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724116949; cv=none; b=aCI8XVg66RALv6i5qghA09JNFzeeib9dFCfzbxVaxyULhOqNrUi6fIeMpgPWoy3UCdue+3GaJyZfJ1o/wYUt76bA6pUYWgN58DlwFsCdO/ZDsRIHs8vZHSB51Z/b2z+2M0oYIfbcajzO3z7xBtlZzp8lLyyAcbu93AjHIUpSL3U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724116949; c=relaxed/simple; bh=nnbDVBr+zqffuUc5l4B6rJDkZdmLgcVx+nBpY84gAhA=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=CTsyP9BBtjoHI/GL6LJzVkBcwzwRL6DYxDn74PggSNDzHVAiEDltK8MUF4l8dD3Lkza1wFT039Y97TgucD5qe7exHKf3xnpF1/xLN8l9Hm3OQc/HLsqWBISo6SQT+iYmifvuq5cCViFAjnXKpThomQtAdijX58z+cBnZXf+4P4o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=gwAJEiPu; arc=none smtp.client-ip=209.85.208.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gwAJEiPu" Received: by mail-ed1-f53.google.com with SMTP id 4fb4d7f45d1cf-5bebd3b7c22so6754040a12.0 for ; Mon, 19 Aug 2024 18:22:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724116946; x=1724721746; darn=vger.kernel.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=2mUATixxdq33VSvfaBNqqUsP8DZlp66vJtGsDHyEY9Y=; b=gwAJEiPuoi3pOlSe2stizGQF1METKZwyEmcg/cIwSV6Ho2OGhYglMKzzcSIisjehkj fZK31nDkmbuTwDJguXkfkOL9VWV0MYVYlr0awnljbA5a65iZ2n2FSv5RqZ+BTpEJP+kc /drOJKoLTz4+C/rFqopkIhsYv1p9XhtJkqluNBh/bbSnWpxRFG/Rt1cmooPSoCQOSQvO wQY47IghrcAj2GYmbS7sVJHMQ0dozQFq97uBVf5QiSrYq12MTLaWB59+I+IcOl/Gtl1T Jk3SDBKLVM3AfCbn0KY6uYe1AGv+wEORJLHDSEVjWReXSwbqxkVnoOsHgpV547Lu519g o9xQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724116946; x=1724721746; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=2mUATixxdq33VSvfaBNqqUsP8DZlp66vJtGsDHyEY9Y=; b=cbC17GdJf4GkM0KM9sRZebT0Qi62vrFOG9UoKXuTM5mqiBzY6OtIJNrE6nogFMKQiX fp8pqgB18+onzjXgGFLZdrZ8a62GmE/9OlV5PYrwT23FhM9t1OUbGA83P3ucnuVMKFXb bsLQdEwPhrsXFecKwJxqLnmPb3GmD6lWj8/JNnltOFbUpji7g+KSNQ3fhDFZXso+lz65 dS9OT6jjV/sG0lru9VvNAc5cxVIviFEEJixx+bUDwqC8M6XaaCPL5kAeYJ1MIIQ6dn+x gCfW3+5qHRl4F3WcvvtCb+Bjq7QQBvIc+de6YhrMSH+t3OSes/295Nw8b0/5I7lMAfif lBww== X-Forwarded-Encrypted: i=1; AJvYcCVu88Lr1eohTmPO2/aIzNxQlEnD9Q0Yd7PNW1W/mH8vGjJDha3E9NcUJJBXFv7InsZTitUPXMkp/MlhBr0uTS/gP/xJrPRhYg/crUdF X-Gm-Message-State: AOJu0YyO909eIYpdN+URvKc0vs6n0eO/cTLOx8Lx3muvTNN6X27CjuXb 8r8F3F95Xmdjo9udM5pGwppNtJ8LZT0SPbJ517ICNg0kZZ+N5VW1f5DKEQ== X-Google-Smtp-Source: AGHT+IEBTOKoW9zicq24+Fr5+Y8S2974Ig1rcqM5vCHBuaLcrRnuEqm8ucueWKsvneiaAk4RYuPixA== X-Received: by 2002:a05:6402:3805:b0:5be:db8a:7f58 with SMTP id 4fb4d7f45d1cf-5bf0ac5d461mr1116106a12.19.1724116946154; Mon, 19 Aug 2024 18:22:26 -0700 (PDT) Received: from hostname ([2a02:c7c:6696:8300:44d8:63fa:6beb:ff38]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5bebbbe5a74sm6164618a12.16.2024.08.19.18.22.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2024 18:22:25 -0700 (PDT) Date: Tue, 20 Aug 2024 02:22:09 +0100 From: qasdev To: mark@fasheh.com, jlbec@evilplan.org, joseph.qi@linux.alibaba.com Cc: ocfs2-devel@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v2] ocfs2: Fix shift-out-of-bounds UBSAN bug in ocfs2_verify_volume() Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This patch addresses a shift-out-of-bounds error in the ocfs2_verify_volume() function, identified by UBSAN. The bug was triggered by an invalid s_clustersize_bits value (e.g., 1548), which caused the expression "1 << le32_to_cpu(di->id2.i_super.s_clustersize_bits)" to exceed the limits of a 32-bit integer, leading to an out-of-bounds shift. Reported-by: syzbot Closes: https://syzkaller.appspot.com/bug?extid=3Df3fff775402751ebb471 Tested-by: syzbot Signed-off-by: Qasim Ijaz Reviewed-by: Joseph Qi --- fs/ocfs2/super.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index afee70125ae3..b704983b2112 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c @@ -2357,8 +2357,8 @@ static int ocfs2_verify_volume(struct ocfs2_dinode *d= i, (unsigned long long)bh->b_blocknr); } else if (le32_to_cpu(di->id2.i_super.s_clustersize_bits) < 12 || le32_to_cpu(di->id2.i_super.s_clustersize_bits) > 20) { - mlog(ML_ERROR, "bad cluster size found: %u\n", - 1 << le32_to_cpu(di->id2.i_super.s_clustersize_bits)); + mlog(ML_ERROR, "bad cluster size bit found: %u\n", + le32_to_cpu(di->id2.i_super.s_clustersize_bits)); } else if (!le64_to_cpu(di->id2.i_super.s_root_blkno)) { mlog(ML_ERROR, "bad root_blkno: 0\n"); } else if (!le64_to_cpu(di->id2.i_super.s_system_dir_blkno)) { --=20 2.30.2