-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy pathDoNotCallSignalInMultithreadedProgram.ql
More file actions
32 lines (30 loc) · 1.12 KB
/
DoNotCallSignalInMultithreadedProgram.ql
File metadata and controls
32 lines (30 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/**
* @id c/cert/do-not-call-signal-in-multithreaded-program
* @name CON37-C: Do not call signal() in a multithreaded program
* @description Calling signal() from within a multithreaded program can result in unpredictable
* program behavior.
* @kind problem
* @precision very-high
* @problem.severity error
* @tags external/cert/id/con37-c
* correctness
* concurrency
* external/cert/severity/low
* external/cert/likelihood/probable
* external/cert/remediation-cost/low
* external/cert/priority/p6
* external/cert/level/l2
* external/cert/obligation/rule
*/
import cpp
import codingstandards.c.cert
import codingstandards.cpp.Concurrency
from FunctionCall fc
// This should only be applied in the context of a multi-threaded program (since
// it is valid to be used in a non-threaded program) so we filter those types of
// programs out here
where
not isExcluded(fc, Concurrency1Package::doNotCallSignalInMultithreadedProgramQuery()) and
fc.getTarget().getName() = "signal" and
exists(ThreadedFunction f)
select fc, "Call to `signal()` in multithreaded programs."