Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2F771194A6C for ; Wed, 29 Apr 2026 19:49:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777492157; cv=none; b=KPArJxftR6LrHtT0p0CnQ5/P0qCX5/NReVszOlIMgTlXFYZgf9b8nOnkwFq8y4X9YJIU5+uIVWfDfEwA+jvyNDQ14QHrn0lzMGaNiF7lN0oaqXUcFSXiWeLKIe/VlE7T8gCSq1eo4M7GhFYDUi0XAwHBL2bPkUmgKdKMKodHdio= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777492157; c=relaxed/simple; bh=YC/drkPepx/SNE8iSVIPZr7TeeiBDZ6Qf+T3euGFoWA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XpWSaYYPPetBrXu11ZQ5MeEwmFQkayaKKuTPbfMUz9lf7QAeYaPiW5BwRauHh/czH7EiRb/sFF0V7yiRFIOx/2Xltnz+XYBv/Dfknauze7BsQUAXyv1HV0ubgMp9TqKA/2P5YU9gmd6F+JgPGAdEZPkrNxx+e6dYv90FSJGBEGM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=aU0u2Boh; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="aU0u2Boh" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65855C19425; Wed, 29 Apr 2026 19:49:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777492157; bh=YC/drkPepx/SNE8iSVIPZr7TeeiBDZ6Qf+T3euGFoWA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aU0u2Bohhq1HY/o668zIhn303GUbhJbQmnv/DZz2vkNTxUVOZ7ggA3st72KsU7jMB B14ZCS3MuRvKE7HeSIchi7VKuG1jUl/X3aIhZvrGcAQ3DlHb1CkF66Vu4R+fkpmV8V 1GgGstlU/TU7lhm7aM50hnwUvRxl+ilRfoOkyst7khS0QdkMNBmexnFjn0QjNZE40C fJui3thUnLZZLE2spAjZlUfRYoL4M1k7nrA63H87soGdxF1B1gmkuzpjNy//dUedZu J5Q0VS/LYL9QQOwzV3KBmGdZXG2jHCbEG5RmFeWPGocda8DoDCNZBuvdAS3AZCVOKt 6w/EqPKmS3JSA== From: Sasha Levin To: Jorge Marques Cc: gregkh@linuxfoundation.org, philip.molloy@analog.com, philip@philipmolloy.com, gastmaier@gmail.com, linux-cve-announce@vger.kernel.org Subject: Re: [PATCH 3/3] strak: use hash set to compare in the same major Date: Wed, 29 Apr 2026 15:49:13 -0400 Message-ID: <20260429194913.232186-3-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260427104014.25683-4-jorge.marques@analog.com> References: <20260427104014.25683-1-jorge.marques@analog.com> <20260427104014.25683-4-jorge.marques@analog.com> Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit On Mon, Apr 27, 2026 at 12:37:16PM +0200, Jorge Marques wrote: > Subject: [PATCH 3/3] strack: use hash set to compare in the same major s/strack/strak/ in the subject. > Since strak fast-path is fix.released() < commit.released() && > fix.released() < commit.base_tag(), we can use the cached hashset > for the ancestor check. Commit message describes patch 2/3's gate, not what this patch changes. The correctness side, though, has a regression: > + if first.version_major_match(second) { > + if first.version() == second.version() { > + let in_ancestry = ctx.ancestor_set.contains(&first.git_id()); > + debug!( > + " [ancestor set] same version {}, sha {} in ancestry: {}", > + first.version(), > + &first.git_id()[..12.min(first.git_id().len())], > + in_ancestry > + ); > + return in_ancestry; > + } When the strak input is a stable tag (e.g. `v6.12`), `git describe` returns just `v6.12` with no `-g`, so build_ancestry_context() takes its early-return path (patch 2 main.rs:124-131) and produces an EMPTY ancestor_set. This branch then unconditionally returns false for any fix whose released version equals the test_kernel's version - i.e. for any fix that landed in the queried mainline release. The OLD code at this point was: if first.version_major_match(second) && first < second { return true; } where `first < second` for equal version strings falls into Kernel::compare()'s git_sort_ids() path - slow, but correct. With patch 3 we replace that with a HashSet lookup against an empty set. Please also add a test along the lines of: #[test] fn cve_fix_in_same_major_release() { Command::new(cargo::cargo_bin!("strak")) .arg("v6.12") .assert() .success() .stdout(predicate::str::contains("is vulnerable to CVE-2024-46869").not()); } A regression of this size with no failing test is exactly what the test-first patch in 1/3 was supposed to prevent. Worth covering it. > + if first < second { > + debug!(" [fast path] major match, {} < {}", first.version(), second.version()); > + return true; > + } > + return false; Note: this changes behaviour even on populated ancestor_sets where versions differ but git_sort_ids would disagree with the version ordering. In practice version-major-match implies version-string ordering matches commit ordering, so this should be fine, but worth mentioning in the commit message. -- Thanks, Sasha