Skip to content

Commit 61c41f3

Browse files
committed
Package SignalHandlers
1 parent f8c9158 commit 61c41f3

20 files changed

+307
-4
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# SIG30-C: Call only asynchronous-safe functions within signal handlers
2+
3+
This query implements the CERT-C rule SIG30-C:
4+
5+
> Call only asynchronous-safe functions within signal handlers
6+
7+
8+
## CERT
9+
10+
** REPLACE THIS BY RUNNING THE SCRIPT `scripts/help/cert-help-extraction.py` **
11+
12+
## Implementation notes
13+
14+
None
15+
16+
## References
17+
18+
* CERT-C: [SIG30-C: Call only asynchronous-safe functions within signal handlers](https://wiki.sei.cmu.edu/confluence/display/c)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* @id c/cert/call-only-async-safe-functions-within-signal-handlers
3+
* @name SIG30-C: Call only asynchronous-safe functions within signal handlers
4+
* @description Call only asynchronous-safe functions within signal handlers.
5+
* @kind problem
6+
* @precision very-high
7+
* @problem.severity error
8+
* @tags external/cert/id/sig30-c
9+
* external/cert/obligation/rule
10+
*/
11+
12+
import cpp
13+
import codingstandards.c.cert
14+
15+
from
16+
where
17+
not isExcluded(x, SignalHandlersPackage::callOnlyAsyncSafeFunctionsWithinSignalHandlersQuery()) and
18+
select
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# SIG31-C: Do not access shared objects in signal handlers
2+
3+
This query implements the CERT-C rule SIG31-C:
4+
5+
> Do not access shared objects in signal handlers
6+
7+
8+
## CERT
9+
10+
** REPLACE THIS BY RUNNING THE SCRIPT `scripts/help/cert-help-extraction.py` **
11+
12+
## Implementation notes
13+
14+
None
15+
16+
## References
17+
18+
* CERT-C: [SIG31-C: Do not access shared objects in signal handlers](https://wiki.sei.cmu.edu/confluence/display/c)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* @id c/cert/do-not-access-shared-objects-in-signal-handlers
3+
* @name SIG31-C: Do not access shared objects in signal handlers
4+
* @description Do not access shared objects in signal handlers.
5+
* @kind problem
6+
* @precision very-high
7+
* @problem.severity error
8+
* @tags external/cert/id/sig31-c
9+
* external/cert/obligation/rule
10+
*/
11+
12+
import cpp
13+
import codingstandards.c.cert
14+
15+
from
16+
where
17+
not isExcluded(x, SignalHandlersPackage::doNotAccessSharedObjectsInSignalHandlersQuery()) and
18+
select
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# SIG34-C: Do not call signal() from within interruptible signal handlers
2+
3+
This query implements the CERT-C rule SIG34-C:
4+
5+
> Do not call signal() from within interruptible signal handlers
6+
7+
8+
## CERT
9+
10+
** REPLACE THIS BY RUNNING THE SCRIPT `scripts/help/cert-help-extraction.py` **
11+
12+
## Implementation notes
13+
14+
None
15+
16+
## References
17+
18+
* CERT-C: [SIG34-C: Do not call signal() from within interruptible signal handlers](https://wiki.sei.cmu.edu/confluence/display/c)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* @id c/cert/do-not-call-signal-from-interruptible-signal-handlers
3+
* @name SIG34-C: Do not call signal() from within interruptible signal handlers
4+
* @description Do not call signal() from within interruptible signal handlers.
5+
* @kind problem
6+
* @precision very-high
7+
* @problem.severity error
8+
* @tags external/cert/id/sig34-c
9+
* external/cert/obligation/rule
10+
*/
11+
12+
import cpp
13+
import codingstandards.c.cert
14+
15+
from
16+
where
17+
not isExcluded(x, SignalHandlersPackage::doNotCallSignalFromInterruptibleSignalHandlersQuery()) and
18+
select
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# SIG35-C: Do not return from a computational exception signal handler
2+
3+
This query implements the CERT-C rule SIG35-C:
4+
5+
> Do not return from a computational exception signal handler
6+
## CERT
7+
8+
** REPLACE THIS BY RUNNING THE SCRIPT `scripts/help/cert-help-extraction.py` **
9+
10+
## Implementation notes
11+
12+
None
13+
14+
## References
15+
16+
* CERT-C: [SIG35-C: Do not return from a computational exception signal handler](https://wiki.sei.cmu.edu/confluence/display/c)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* @id c/cert/do-not-return-from-a-computational-exception-handler
3+
* @name SIG35-C: Do not return from a computational exception signal handler
4+
* @description Do not return from a computational exception signal handler.
5+
* @kind problem
6+
* @precision very-high
7+
* @problem.severity error
8+
* @tags external/cert/id/sig35-c
9+
* external/cert/obligation/rule
10+
*/
11+
12+
import cpp
13+
import codingstandards.c.cert
14+
15+
from
16+
where
17+
not isExcluded(x, SignalHandlersPackage::doNotReturnFromAComputationalExceptionHandlerQuery()) and
18+
select
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
No expected results have yet been specified
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rules/SIG30-C/CallOnlyAsyncSafeFunctionsWithinSignalHandlers.ql

0 commit comments

Comments
 (0)