Skip to content

Commit 3fb0ff0

Browse files
IrqlAnnotationIssue: CodeQL port of c28153 (#158)
* CodeQL port of C28153 * Remove TODO comment * updates from review
1 parent 9eb68b3 commit 3fb0ff0

File tree

4 files changed

+502
-0
lines changed

4 files changed

+502
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<!DOCTYPE qhelp PUBLIC "-//Semmle//qhelp//EN" "qhelp.dtd">
2+
<qhelp>
3+
<overview>
4+
<p>
5+
The value for an IRQL from annotation could not be evaluated in this context.
6+
</p>
7+
</overview>
8+
<recommendation>
9+
<p>
10+
This warning indicates that the Code Analysis tool cannot interpret the function annotation because the annotation is not
11+
coded correctly. As a result, the Code Analysis tool cannot determine the specified IRQL value. This warning can occur with any of
12+
the driver-specific annotations that mention an IRQL when the Code Analysis tool cannot evaluate the expression for the IRQL.
13+
</p>
14+
</recommendation>
15+
<example>
16+
<p>
17+
Incorrect IRQL annotation
18+
</p>
19+
<sample language="c"> <![CDATA[
20+
_IRQL_requires_(65)
21+
}]]>
22+
</sample>
23+
<p>
24+
Incorrect IRQL annotation
25+
</p>
26+
<sample language="c"> <![CDATA[
27+
_IRQL_always_function_max_(irql_variable)
28+
}]]>
29+
</sample>
30+
</example>
31+
<semmleNotes>
32+
<p>
33+
</p>
34+
</semmleNotes>
35+
<references>
36+
<li>
37+
<a href="https://learn.microsoft.com/en-us/windows-hardware/drivers/devtest/28153-irql-annotation-eval-context">
38+
C28153
39+
</a>
40+
</li>
41+
</references>
42+
</qhelp>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT license.
3+
/**
4+
* @id cpp/drivers/irql-annotation-issue
5+
* @kind problem
6+
* @name Irql Annotation Issue
7+
* @description The value for an IRQL from annotation could not be evaluated in this context.
8+
* @platform Desktop
9+
* @feature.area Multiple
10+
* @impact Insecure Coding Practice
11+
* @repro.text This warning indicates that the Code Analysis tool cannot interpret the function annotation because the annotation is not
12+
* coded correctly. As a result, the Code Analysis tool cannot determine the specified IRQL value. This warning can occur with any of
13+
* the driver-specific annotations that mention an IRQL when the Code Analysis tool cannot evaluate the expression for the IRQL.
14+
* @owner.email: [email protected]
15+
* @opaqueid CQLD-C28153
16+
* @problem.severity warning
17+
* @precision medium
18+
* @tags correctness
19+
* @scope domainspecific
20+
* @query-version v1
21+
*/
22+
23+
import cpp
24+
import drivers.libraries.Irql
25+
26+
from IrqlFunctionAnnotation ifa
27+
where not ifa.getIrqlLevel() instanceof IrqlValue
28+
select ifa, "Invalid IRQL annotation: " + ifa.getIrqlLevel()

0 commit comments

Comments
 (0)