Skip to content

feat(checker): add lvm2 checker for Alma Linux support#5674

Open
Noshadi-sec wants to merge 2 commits intoossf:mainfrom
Noshadi-sec:feat/add-lvm2-checker
Open

feat(checker): add lvm2 checker for Alma Linux support#5674
Noshadi-sec wants to merge 2 commits intoossf:mainfrom
Noshadi-sec:feat/add-lvm2-checker

Conversation

@Noshadi-sec
Copy link
Copy Markdown

Summary

Adds a new CVE checker for lvm2 (Linux Logical Volume Manager 2),
a base OS package in Alma Linux 8/9 not currently covered by cve-bin-tool.

Motivation

Identified while investigating Alma Linux base package coverage as
requested in #2761. lvm2 has several known CVEs:

Changes

  • Added cve_bin_tool/checkers/lvm2.py with CONTAINS, FILENAME, VERSION patterns
  • Added filename pattern test entry in test/test_checkers.py

Closes #2761

Adds CVE checker for lvm2 (Linux Logical Volume Manager 2),
a base OS package in Alma Linux 8/9 not previously covered.

Known CVEs: CVE-2020-8991, CVE-2010-2526

Closes ossf#2761
Copilot AI review requested due to automatic review settings March 31, 2026 21:17
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new binary checker for the lvm2 package to improve Alma Linux 8/9 base package coverage, plus a minimal unit test entry to validate filename-based detection.

Changes:

  • Introduced a new Lvm2Checker with CONTAINS_PATTERNS, FILENAME_PATTERNS, VERSION_PATTERNS, and VENDOR_PRODUCT.
  • Added a test/test_checkers.py parametrized entry for lvm2 filename detection.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
cve_bin_tool/checkers/lvm2.py New checker implementation for detecting lvm2 and extracting versions.
test/test_checkers.py Adds a filename-detection test case for the new checker.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +21 to +27
r"lvm",
r"lvdisplay",
r"vgdisplay",
r"pvdisplay",
r"lvchange",
r"vgchange",
r"lvmconfig",
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checker.get_versions() uses re.match() against the full path passed in by VersionScanner (e.g. "/usr/sbin/lvm"), so patterns like r"lvm" / r"lvdisplay" won’t match at runtime unless the path happens to start with those strings. Consider updating these filename regexes to allow optional leading directories (e.g., match the basename with (?:^|.*/)), and ideally anchor to the end so you don’t accidentally match unrelated files that merely start with the same prefix.

Suggested change
r"lvm",
r"lvdisplay",
r"vgdisplay",
r"pvdisplay",
r"lvchange",
r"vgchange",
r"lvmconfig",
r"(?:^|.*/)lvm$",
r"(?:^|.*/)lvdisplay$",
r"(?:^|.*/)vgdisplay$",
r"(?:^|.*/)pvdisplay$",
r"(?:^|.*/)lvchange$",
r"(?:^|.*/)vgchange$",
r"(?:^|.*/)lvmconfig$",

Copilot uses AI. Check for mistakes.
("libnss", "libnss.so.1.0", ["nss"]),
("libtiff", "libtiff.so.1.0", ["tiff"]),
("lighttpd", "lighttpd", ["lighttpd"]),
("lvm2", "lvm", ["lvm2"]),
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This filename-based test currently uses just "lvm", but extracted package contents are typically scanned with paths (e.g. usr/sbin/lvm). Once the checker’s FILENAME_PATTERNS are updated to handle paths, it would be good to add/adjust this test case to include a representative path segment so the test matches real scanner inputs.

Suggested change
("lvm2", "lvm", ["lvm2"]),
("lvm2", "usr/sbin/lvm", ["lvm2"]),

Copilot uses AI. Check for mistakes.
@ffontaine
Copy link
Copy Markdown
Collaborator

Thanks for this PR, redhat:lvm2 must be added to VENDOR_PRODUCT to detect CVE-2020-8991. Moreover, "real" binary test data must be added: https://github.com/ossf/cve-bin-tool/blob/main/doc/test/README.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add new checker requests for Alma Linux packages not already covered

3 participants