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 704E9194A6C for ; Wed, 29 Apr 2026 19:49:16 +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=1777492156; cv=none; b=Od3nMFpED6/1Y6UGIq7/31psXTaWDSqHDkx7SVrlsKrvAkY2u9duyalSZH9BlLVkLgkHoCFjWe9G61VCQfg/IdI8viklng6BjQRDwmyQA7MdFWjaqUkfL9iQiY3PJl5HAH4SHnPW/a7xEpD8uJRx0zChwZXCQlWgJDAa/+iwDws= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777492156; c=relaxed/simple; bh=y1wbdciAzW8aLYWUxr9iXRGpR8aj/UGg1WwypU8pDuY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BPVXjiIsva63XcY5bBxbqKr2DATEOrysa0WungSmpT9J1hogZp7j7kf+YaNpP/CL/80twdeATTWhoKT1gZ0y0TAKHrC6OtnsiYYbNttUWfOsyMeL9yCe+wynwBB+je5HemSe5abW2IcMsgqG5Xu5qbzwHr1ubKMcK47OxHtx8cQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FXQ0sKEq; 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="FXQ0sKEq" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7517CC2BCB4; Wed, 29 Apr 2026 19:49:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777492156; bh=y1wbdciAzW8aLYWUxr9iXRGpR8aj/UGg1WwypU8pDuY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FXQ0sKEql6+kL/9p+VhlHpr4WNevyZP2Fbf0HDVEkPWswBSy824qiAD2lXBuuZkKi WS/ajo8BnqORv1WN/+JCbhTB/I+s46/ia+LBo/jjPLgqR5uWy3tU5yRA0X1vVsOzdo p3r9W8WgS571lrN5iHhdWD8x2uongNHF24jQjkRmnpycBPAcKjSIKsRTGp8XnFZepc lnh1XaTbZCzCJuHK1CpxNndewetV3ypOWQw4hJ5+lF2dvP638PcsJR+ItyS+yMXvsr fC0zfCQGjdf20VMxLre079X7Jrxmb8Z0QZ7wSGnXOSfctqj7oROD1cGORyPmbH9QlI SnsAXjBn/IO5g== 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 2/3] strak: use commit window in ambiguous checks Date: Wed, 29 Apr 2026 15:49:12 -0400 Message-ID: <20260429194913.232186-2-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260427104014.25683-3-jorge.marques@analog.com> References: <20260427104014.25683-1-jorge.marques@analog.com> <20260427104014.25683-3-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:15PM +0200, Jorge Marques wrote: > Strak would fail to report a vulnerabilities from a commit in a topic > branch that got merged after the version with the fix was released. For > example, commit 0c3 was created before 4f3, with 4f3 first at 6.11 and > 0c3 first at 6.12, strack reports commit 0c3 not vulnerable by cve > fixed-by 4f3. Because it would compare 6.11 < 6.12 and assume commit A > is newer than release tag 6.11. s/strack/strak/. Diagnosis is correct; I reproduced the false negative on master and confirmed the fix works for the cover-letter cases: $ time strak bbf3c7ff9dfa45be51500d23a1276991a7cd8c6e ... is vulnerable to CVE-2024-43884 ... is vulnerable to CVE-2024-46823 ... NOT vulnerable to CVE-2024-26600 (fix in v6.8 history) ... NOT vulnerable to CVE-2024-50084 (vuln introduced after base) real 0m0.76s Few comments on the implementation: > +/// Find the previous stable (non-rc) release tag before the given base tag. > +/// v6.11-rc2 -> v6.10 > +/// v6.11 -> v6.11 The second example is wrong: $ git describe --abbrev=0 --match='v[0-9]*' --exclude='*-rc*' v6.11~1 v6.10 It always walks back at least one stable. This is harmless because the caller takes an early return for stable-tag inputs before calling previous_stable_tag(), but please update the doc comment (and the matching paragraph in the cover letter that states "v6.11 -> v6.11"). > + let rev_list_output = run_command( > + "git", > + &["rev-list", &rev_list_range], > + Some(&kernel_tree_str), > + ) > + .unwrap_or_default(); Please don't swallow this. cve_utils::run_command returns Err on any non-zero exit, and unwrap_or_default() turns that into an empty HashSet, which then makes do_is_ancestor()'s ambiguous branch silently return "fix not in ancestry" -> false-vulnerable. Either propagate the error (it's already a Result-returning fn) or at minimum log it loudly: let rev_list_output = run_command(...)?; // preferred // or if you really want to be lenient: let rev_list_output = run_command(...).unwrap_or_else(|e| { error!("rev-list failed: {e}"); String::new() }); > + let describe_output = run_command( > + "git", > + &["describe", "--always", git_sha], > + Some(&kernel_tree_str), > + )?; > + > + // "v6.11-rc2-8-gbbf3c7ff9dfa" -> base tag "v6.11-rc2" > + let base_tag = if let Some(pos) = describe_output.rfind("-g") { Two related concerns here: 1. --always falls back to a bare abbreviated SHA when no tag is reachable. Linux mainline always has a reachable tag so this is theoretical, but the no-"-g" early-return path then treats a bare SHA as if it were a stable tag (empty ancestor_set), which causes exactly the kind of false negative this patch is trying to fix. Either drop --always (let it fail loudly on tag-less commits), or reject outputs that don't start with 'v'. 2. rfind("-g") matches anywhere in the string. Mainline tags don't contain "-g", but a defensive pattern would be: if let Some(rest) = describe_output.strip_prefix('v') && let Some((tag, _abbrev)) = rest.rsplit_once("-g") && tag.rsplit_once('-').is_some_and(|(_, n)| n.parse::().is_ok()) { ... } Or document the assumption with a /// comment. > + } else { > + let base_tag_version = describe_output > + .strip_prefix('v') > + .unwrap_or(&describe_output) > + .to_string(); > + // No ambiguiety when the commit is a stable tag. s/ambiguiety/ambiguity/ (also at line ~127 in the diff). This early return is the source of the patch-3 regression I describe in the 3/3 reply: it produces an empty ancestor_set, which patch 3's new same-major branch then treats as authoritative. Easiest fix is to *always* run the rev-list (using describe_output itself as the base tag here), so that ancestor_set is correct regardless of input form. > + let prev_stable = previous_stable_tag(kernel_tree, &base_tag)?; Bounded-window assumption (one stable release back) deserves a one-line note in the commit message that explicitly calls out the failure mode: a topic-branch commit that took >2 stable releases to merge will be treated as if its base tag were prev_stable, missing fixes that landed in the skipped window. Cover letter mentions extending N if needed - worth restating in this patch's commit message so it isn't lost. > +/// Wrapper for is_ancestor() so we can get some debugging output easier. > -fn do_is_ancestor(first: &Kernel, second: &Kernel) -> bool { > +fn do_is_ancestor(first: &Kernel, second: &Kernel, ctx: &AncestryWindow) -> bool { The `&first.git_id()[..12.min(first.git_id().len())]` pattern shows up in three new debug! calls; consider a small helper like `short_sha(s: &str) -> &str` to keep the call sites tidy. With the rev-list error path tightened up and the early-return reworked so ancestor_set is built unconditionally, this patch is in good shape. -- Thanks, Sasha