Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Signed-off-by: Denis Efremov <[email protected]>
  • Loading branch information
evdenis committed Jul 14, 2021
1 parent 8e67a20 commit fd0d4d5
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
58 changes: 58 additions & 0 deletions cvehound/cve/CVE-2017-12188.cocci
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/// Files: arch/x86/kvm/mmu.c arch/x86/kvm/mmu/mmu.c arch/x86/include/asm/kvm_host.h
/// Fix: 829ee279aed43faa5cb1e4d65c0cad52f2426c53
/// Fixes: 6bb69c9b69c315200ddc2bc79aee14c0184cf5b2

virtual detect

@last_nonleaf_level@
@@

struct kvm_mmu {
...
* u8 last_nonleaf_level;
...
};

@fix exists@
@@

kvm_init_shadow_ept_mmu(...)
{
...
* update_last_nonleaf_level(...);
...
}

@err_kvm_init_shadow_ept_mmu depends on last_nonleaf_level && !fix exists@
position p;
@@

* kvm_init_shadow_ept_mmu@p(...)
{
...
}

@err_is_last_gpte@
identifier mmu, level, gpte;
position p;
@@

is_last_gpte(struct kvm_mmu *mmu, unsigned level, unsigned gpte)
{
...
* gpte |=@p level - PT_PAGE_TABLE_LEVEL - 1;
gpte &= level - mmu->last_nonleaf_level;
...
}

@script:python depends on detect@
p << err_kvm_init_shadow_ept_mmu.p;
@@
coccilib.report.print_report(p[0], 'ERROR: CVE-2017-12188')
@script:python depends on detect@
p << err_is_last_gpte.p;
@@
coccilib.report.print_report(p[0], 'ERROR: CVE-2017-12188')
1 change: 1 addition & 0 deletions tests/test_00_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def test_cves_metadata_cwe(hound):
('CVE-2019-15924', "wrong fixes tag, create_workqueue also can return NULL"),
('CVE-2021-20265', "wrong fixes tag, see https://lkml.org/lkml/2016/2/24/1054"),
('CVE-2015-8961', "wrong fixes tag, the error was introduced in 9d5065940693"),
('CVE-2017-12188', "wrong fixes tag, see https://www.spinics.net/lists/kvm/msg156651.html"),
]
)
def test_fixes(hound, repo, cve):
Expand Down

0 comments on commit fd0d4d5

Please sign in to comment.