Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restrict kernel patches search space #68

Open
vmezzela opened this issue Jan 23, 2025 · 0 comments
Open

Restrict kernel patches search space #68

vmezzela opened this issue Jan 23, 2025 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@vmezzela
Copy link
Collaborator

There's a corner case where is_kernel_patched() in GitHelper can mistakenly grab a commit that does not concern any patch.
The false-positive commit will result in a codestream being reported as not affected, while it actually is because the actual patch is not backported for the codestream in question.

Using git log --grep=CVE-{cve} -- patches.suse instead of git log --grep=CVE-{cve} would filter out those commits unrelated to patches.

The following code would solve the problem:

@@ -343,7 +344,10 @@ class GitHelper(Config):
         ret = subprocess.check_output(["/usr/bin/git", "-C", self.kern_src, "log",
                                        f"--grep=CVE-{cve}",
                                        f"--tags=*rpm-{kernel}",
-                                       "--pretty=oneline"])
+                                       "--pretty=oneline",
+                                       "--",
+                                       "patches.suse"])

But it slows down a lot the execution of git log because Git doesn't store which files are changed in each commit.

What we could do instead, is to keep git log as it is, and filter out commits unrelated to patches.suse only aftewards.

A cve that tigger this issue is 2024-36979.

@fgyanz fgyanz added the bug Something isn't working label Jan 23, 2025
@fgyanz fgyanz self-assigned this Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants