Commit Graph

54887 Commits

Author SHA1 Message Date
calum
3fd10ec994 C#: Address review comment. 2019-03-11 09:38:23 +00:00
calum
383e29ce13 C#: Analysis change notes. 2019-03-11 09:38:23 +00:00
calum
d6c315bbdf C#: Model NHibernate framework. 2019-03-11 09:38:22 +00:00
Tom Hvitved
b48576d7b9 C#: Address review comments 2019-03-10 15:45:31 +01:00
Tom Hvitved
8959d528a1 Merge remote-tracking branch 'upstream/rc/1.20' into csharp/dataflow/performance 2019-03-10 15:07:18 +01:00
Geoffrey White
0b21f4d59b CPP: Add an empty references section to the ReturnStackAllocatedMemory qhelp. 2019-03-08 23:21:47 +00:00
Tom Hvitved
548a28ff7d Merge pull request #912 from calumgrant/cs/ef
C#: Model EntityFrameworkCore
2019-03-08 22:13:13 +01:00
Jonas Jensen
a90e4a7bdf Merge pull request #1066 from xiemaisi/fix-qhelp-backticks
Fix qhelp backticks
2019-03-08 19:06:48 +01:00
Max Schaefer
a94f25e8fa C++: Fix erroneous backticks in query help. 2019-03-08 15:28:14 +00:00
Max Schaefer
c74db8bbbc JavaScript: Fix erroneous backticks in query help. 2019-03-08 15:28:03 +00:00
calum
3bdaf7c14e C#: Updated framework support list. 2019-03-08 15:12:50 +00:00
Tom Hvitved
6f44384db9 C#: No qualified name for local scope variables 2019-03-08 15:02:07 +01:00
Mark Shannon
94e4bd8b01 Merge pull request #1063 from taus-semmle/python-fix-compilation-warnings
Python: Fix compilation warnings.
2019-03-08 13:54:31 +00:00
Tom Hvitved
77185f1fa3 Merge pull request #1055 from calumgrant/cs/lazy-type-mention
C#: Fix an InvalidOperationException in csharp.log
2019-03-08 14:17:51 +01:00
Taus
300e3bdfec Merge pull request #1057 from markshannon/python-fix-os-guard
Python: Fix up OsGuard class.
2019-03-08 14:05:22 +01:00
Taus Brock-Nannestad
a74a2060f5 Remove use of deprecated function theEmptyTupleObject. 2019-03-08 14:00:16 +01:00
Taus Brock-Nannestad
116e262c62 Add missing override annotations. 2019-03-08 13:59:52 +01:00
Jonas Jensen
38310e0380 C++: Mention isGLValue in getResultType QLDoc 2019-03-08 11:46:35 +01:00
Taus
984fb3a010 Merge pull request #1043 from markshannon/python-fix-stack-trace-exposure
Python: fix stack trace exposure query.
2019-03-08 11:40:27 +01:00
Jonas Jensen
db104edbd6 Merge pull request #792 from rdmarsh2/rdmarsh/cpp/escape-analysis
C++: Interprocedural escape/alias analysis in IR construction
2019-03-08 07:29:26 +01:00
Robert Marsh
07bc9ca26c C++: fix whitespace 2019-03-07 13:14:58 -08:00
Robert Marsh
8a2a4678d8 C++: accept dataflow test change 2019-03-07 13:14:57 -08:00
Robert Marsh
ef836c39bb C++: respond to PR comments 2019-03-07 13:14:57 -08:00
Robert Marsh
17ad124c9e C++: remove VariableAddress from points_to test 2019-03-07 13:14:56 -08:00
Robert Marsh
7e30ce0c09 C++: add phi node support to escape analysis 2019-03-07 13:14:56 -08:00
Robert Marsh
97c11a5222 C++: points-to for argument-returning calls 2019-03-07 13:14:55 -08:00
Robert Marsh
878502f82e C++: remove duplicate logic 2019-03-07 13:14:52 -08:00
Jonas Jensen
794a8954cd C++: Simplify automaticVariableAddressEscapes
The `automaticVariableAddressEscapes` predicate got join-ordered badly
in its `unaliased_ssa` version. These are the tuple counts on Wireshark,
where one pipeline step is seen to have 716 million tuples:

```
[2019-03-02 11:29:41] (42s) Starting to evaluate predicate AliasAnalysis::automaticVariableAddressEscapes#2#f
[2019-03-02 11:30:06] (67s) Tuple counts:
                      353419    ~0%      {1} r1 = JOIN project#Instruction::VariableAddressInstruction#class#2#ff WITH AliasAnalysis::resultEscapesNonReturn#2#f ON project#Instruction::VariableAddressInstruction#class#2#ff.<0>=AliasAnalysis::resultEscapesNonReturn#2#f.<0> OUTPUT FIELDS {AliasAnalysis::resultEscapesNonReturn#2#f.<0>}
                      353419    ~0%      {2} r2 = JOIN r1 WITH IRConstruction::Cached::getInstructionEnclosingFunctionIR#ff@staged_ext ON r1.<0>=IRConstruction::Cached::getInstructionEnclosingFunctionIR#ff@staged_ext.<0> OUTPUT FIELDS {IRConstruction::Cached::getInstructionEnclosingFunctionIR#ff@staged_ext.<1>,r1.<0>}
                      353419    ~0%      {2} r3 = JOIN r2 WITH FunctionIR::FunctionIR::getFunction_dispred#3#ff ON r2.<0>=FunctionIR::FunctionIR::getFunction_dispred#3#ff.<0> OUTPUT FIELDS {FunctionIR::FunctionIR::getFunction_dispred#3#ff.<1>,r2.<1>}
                      716040298 ~0%      {2} r4 = JOIN r3 WITH IRVariable::IRVariable#class#3#ff_10#join_rhs ON r3.<0>=IRVariable::IRVariable#class#3#ff_10#join_rhs.<0> OUTPUT FIELDS {IRVariable::IRVariable#class#3#ff_10#join_rhs.<1>,r3.<1>}
                      4480139   ~0%      {2} r5 = JOIN r4 WITH IRVariable::IRAutomaticVariable#class#3#ff ON r4.<0>=IRVariable::IRAutomaticVariable#class#3#ff.<0> OUTPUT FIELDS {r4.<1>,r4.<0>}
                      66760     ~91%     {1} r6 = JOIN r5 WITH Instruction::VariableInstruction::getVariable_dispred#2#ff ON r5.<0>=Instruction::VariableInstruction::getVariable_dispred#2#ff.<0> AND r5.<1>=Instruction::VariableInstruction::getVariable_dispred#2#ff.<1> OUTPUT FIELDS {r5.<1>}
                                         return r6
[2019-03-02 11:30:06] (67s)  >>> Relation AliasAnalysis::automaticVariableAddressEscapes#2#f: 35531 rows using 0 MB
```

The predicate contained a cyclic join, which is always hard to optimize.
I couldn't see a reason to join the `FunctionIR`, so I removed that
part. The predicate is now fast, and there are no changes in the tests.
2019-03-07 13:14:51 -08:00
Robert Marsh
a72cd23d1d C++: fix escape test failures 2019-03-07 13:14:51 -08:00
Robert Marsh
09321ee062 C++: refactor escape analysis for performance 2019-03-07 13:14:51 -08:00
Robert Marsh
6f76c13385 C++: fix unused variable warning 2019-03-07 13:14:50 -08:00
Robert Marsh
726f38c802 C++: refactor alias analysis for performance 2019-03-07 13:14:50 -08:00
Robert Marsh
c70bd285de C++: assume arguments to virtual functions escape 2019-03-07 13:14:49 -08:00
Robert Marsh
2c94a8887d C++: test for virtual functions in escape analysis 2019-03-07 13:14:49 -08:00
Robert Marsh
6089172554 C++: escape analysis for this parameters 2019-03-07 13:14:49 -08:00
Robert Marsh
466e110338 C++: add new interprocedural escape analysis 2019-03-07 13:14:48 -08:00
Robert Marsh
bd39698528 C++: test changes for interproc escape analysis 2019-03-07 13:14:48 -08:00
Calum Grant
f6828fa5e5 Merge pull request #1053 from hvitved/csharp/dispatch-tweak
C#: `Dispatch.qll` performance tweaks
2019-03-07 16:21:29 +00:00
semmle-qlci
9dccd9f62c Merge pull request #1050 from asger-semmle/prototype-instance-methods
Approved by xiemaisi
2019-03-07 16:10:29 +00:00
Max Schaefer
b85f44643a Merge pull request #1049 from asger-semmle/js-type-tracking
JS: Add TypeTracking library
2019-03-07 16:09:19 +00:00
calum
fe4cdfdae0 C#: Minimise the test further. 2019-03-07 15:46:36 +00:00
calum
b358f87570 C#: Improve performance. 2019-03-07 14:56:07 +00:00
Mark Shannon
ef1c08e351 Python: Fix up OsGuard class. 2019-03-07 14:21:03 +00:00
calum
6cf2aee2ce C#: Fix failed CIL test. 2019-03-07 12:58:50 +00:00
Asger F
56977b80a0 JS: update comment 2019-03-07 11:35:41 +00:00
Asger F
d4566af271 JS: update test output 2019-03-07 11:27:07 +00:00
Tom Hvitved
397cc56a6f C#: Cache DataFlow::Node::getLocation() 2019-03-07 12:16:12 +01:00
Tom Hvitved
e6f7632d4c C#: Introduce data flow return nodes
Before this change,

```
flowOutOfCallableStep(CallNode call, ReturnNode ret, OutNode out, CallContext cc)
```

would compute all combinations of call sites `call` and returned expressions `ret`
up front.

Now, we instead introduce explicit return nodes, so each callable has exactly
one return node (as well as one for each `out`/`ref` parameter). There is then
local flow from a returned expression to the relevant return node, and
`flowOutOfCallableStep()` computes combinations of call sites and return nodes.

Not only does this result in better performance, it also makes `flowOutOfCallableStep()`
symmetric to `flowIntoCallableStep()`, where each argument is mapped to a parameter,
and not to all reads of that parameter.
2019-03-07 12:16:06 +01:00
Tom Hvitved
e6630cda6b C#: Use explicit recursion in data flow predicate 2019-03-07 12:16:01 +01:00
Tom Hvitved
738d1117f2 C#: Avoid recomputing flowThroughCallableLibraryOutRef() between queries 2019-03-07 12:15:53 +01:00