Commit Graph

17948 Commits

Author SHA1 Message Date
Rebecca Valentine
b09ab67e75 Python: Modernizes query 2020-03-04 17:10:32 -08:00
semmle-qlci
98034aaa53 Merge pull request #2988 from asger-semmle/js/autoformat-again-again
Approved by esbena
2020-03-04 21:20:52 +00:00
semmle-qlci
c6e3d8df49 Merge pull request #2969 from esbena/js/process-as-event-emitter
Approved by erik-krogh
2020-03-04 20:24:12 +00:00
Asger Feldthaus
53569453ba JS: Autoformat again 2020-03-04 19:28:24 +00:00
Robert Marsh
d9d6960110 Merge pull request #2985 from MathiasVP/bounded-uncontrolled-alloc-size
C++: Add testcase for cpp/uncontrolled-allocation-size
2020-03-04 10:00:43 -08:00
Robert Marsh
80ec5c11b3 Merge pull request #2983 from jbj/definitionReachesRank-perf
C++: IR: faster definitionReachesRank
2020-03-04 09:57:06 -08:00
semmle-qlci
c5d39039bc Merge pull request #2962 from erik-krogh/YetAnotherSanitizer
Approved by asgerf
2020-03-04 15:27:09 +00:00
Asger Feldthaus
c2f7cdce25 JS: Change precision to very-high 2020-03-04 15:06:10 +00:00
Mathias Vorreiter Pedersen
3973a50c9b C++: Add testcase for cpp/uncontrolled-allocation-size 2020-03-04 15:51:14 +01:00
Felicity Chapman
4a415d8ad6 Update or remove unwanted links 2020-03-04 14:18:24 +00:00
Jonas Jensen
6b2fd17f03 C++: IR: faster definitionReachesRank
On Wireshark with 6GB RAM, I've observed `definitionReachesRank` to be
the slowest predicate in the IR. It seems that the implementation was
slow because the optimizer failed to eliminate the common
`reachesRank - 1` subexpression. This led to context being pushed into
the `not`, which got implemented as `MATERIALIZE`. That wouldn't
normally be a disaster, but this is one of the largest predicates in the
IR SSA construction, and iteration 2 was very slow.

Before:

    (1505s) Starting to evaluate predicate SSAConstruction::DefUse::definitionReachesRank#ffff#cur_delta/4[1]@93f592 (iteration 1)
    (1535s) Tuple counts for SSAConstruction::DefUse::definitionReachesRank#ffff#cur_delta:
    130670697 ~0%     {4} r1 = SCAN project#SSAConstruction::DefUse::hasDefinitionAtRank#fffff AS I OUTPUT I.<0>, I.<1>, I.<2>, (I.<2> + 1)
    130670697 ~6%     {5} r2 = JOIN r1 WITH SSAConstruction::DefUse::exitRank#fff AS R ON FIRST 2 OUTPUT r1.<0>, r1.<1>, r1.<2>, r1.<3>, R.<2>
    130670697 ~6%     {5} r3 = SELECT r2 ON r2.<3> <= r2.<4>
    130670697 ~0%     {4} r4 = SCAN r3 OUTPUT r3.<0>, r3.<1>, r3.<2>, r3.<3>
                      return r4
    (1535s) 			 - SSAConstruction::DefUse::definitionReachesRank#ffff_delta has 130670697 rows (order for disjuncts: delta=<standard>).

    (1535s) Starting to evaluate predicate SSAConstruction::DefUse::definitionReachesRank#ffff#cur_delta/4[2]@866c14 (iteration 2)
    (1626s) Tuple counts for SSAConstruction::DefUse::definitionReachesRank#ffff#cur_delta:
    261341394 ~107%     {4} r1 = JOIN SSAConstruction::DefUse::definitionReachesRank#ffff#prev_delta AS L WITH SSAConstruction::DefUse::definitionReachesRank#ffff#join_rhs AS R ON FIRST 3 OUTPUT R.<0>, R.<1>, R.<2>, (1 + L.<3>)
    261341394 ~107%     {4} r2 = r1 AND NOT SSAConstruction::DefUse::definitionReachesRank#ffff#prev AS R(r1.<0>, r1.<1>, r1.<2>, r1.<3>)
    130670697 ~0%       {5} r3 = SCAN r2 OUTPUT r2.<0>, r2.<1>, (r2.<3> - 1), r2.<2>, r2.<3>
    106034590 ~1%       {4} r4 = JOIN r3 WITH project#SSAConstruction::DefUse::hasDefinitionAtRank#fffff AS R ON FIRST 3 OUTPUT r3.<0>, r3.<1>, r3.<3>, r3.<4>
    106034590           {4} r5 = MATERIALIZE r4 AS antijoin_rhs
    24636107  ~3%       {4} r6 = r2 AND NOT r5(r2.<0>, r2.<1>, r2.<2>, r2.<3>)
    24636107  ~0%       {5} r7 = JOIN r6 WITH SSAConstruction::DefUse::exitRank#fff AS R ON FIRST 2 OUTPUT r6.<0>, r6.<1>, r6.<2>, r6.<3>, R.<2>
    2749441   ~0%       {5} r8 = SELECT r7 ON r7.<3> <= r7.<4>
    2749441   ~4%       {4} r9 = SCAN r8 OUTPUT r8.<0>, r8.<1>, r8.<2>, r8.<3>
                        return r9
    (1626s) 			 - SSAConstruction::DefUse::definitionReachesRank#ffff_delta has 2749441 rows (order for disjuncts: delta=<standard>).

After:

    (12s) Tuple counts for SSAConstruction::DefUse::definitionReachesRank#ffff#cur_delta:
    130670697 ~0%     {4} r1 = SCAN project#SSAConstruction::DefUse::hasDefinitionAtRank#fffff AS I OUTPUT I.<0>, I.<1>, I.<2>, (I.<2> + 1)
                      return r1
    (12s) 			 - SSAConstruction::DefUse::definitionReachesRank#ffff_delta has 130670697 rows (order for disjuncts: delta=<standard>).
    (12s) Starting to evaluate predicate SSAConstruction::DefUse::definitionReachesRank#ffff#cur_delta/4[2]@fff64c (iteration 2)
    (34s) Tuple counts for SSAConstruction::DefUse::definitionReachesRank#ffff#cur_delta:
    108784031 ~0%     {4} r1 = SSAConstruction::DefUse::definitionReachesRank#ffff#prev_delta AS L AND NOT SSAConstruction::DefUse::exitRank#fff AS R(L.<0>, L.<1>, L.<3>)
    2749441   ~5%     {4} r2 = r1 AND NOT project#SSAConstruction::DefUse::hasDefinitionAtRank#fffff AS R(r1.<0>, r1.<1>, r1.<3>)
    2749441   ~4%     {4} r3 = SCAN r2 OUTPUT r2.<0>, r2.<1>, r2.<2>, (r2.<3> + 1)
    2749441   ~4%     {4} r4 = r3 AND NOT SSAConstruction::DefUse::definitionReachesRank#ffff#prev AS R(r3.<0>, r3.<1>, r3.<2>, r3.<3>)
                      return r4
    (34s) 			 - SSAConstruction::DefUse::definitionReachesRank#ffff_delta has 2749441 rows (order for disjuncts: delta=<standard>).

Note that the row counts are exactly the same before and after.
2020-03-04 15:00:47 +01:00
Mathias Vorreiter Pedersen
bbcf0b52df Merge pull request #2941 from jbj/Overflow-stmtDominates
C++: Avoid `iDominates*` in Overflow.qll
2020-03-04 12:40:52 +01:00
Esben Sparre Andreasen
db335ae89b JS: add default/chaining for request 2020-03-04 12:36:49 +01:00
Esben Sparre Andreasen
92b3e8c060 JS: add default/chaining tests for request 2020-03-04 12:25:23 +01:00
Mathias Vorreiter Pedersen
b20afa6370 Merge pull request #2979 from jbj/GVN-noinline
C++: pragma[noinline] on GVN charpred
2020-03-04 12:19:27 +01:00
Asger Feldthaus
6f2b05932e JS: Change note 2020-03-04 11:18:12 +00:00
Asger Feldthaus
af0df6c369 JS: Lower severity of js/syntax-error 2020-03-04 11:16:59 +00:00
semmle-qlci
c4b961c8af Merge pull request #2973 from tausbn/python-fix-or-disable-cps
Approved by BekaValentine
2020-03-04 10:36:47 +00:00
Jonas Jensen
60bcbf477a C++: pragma[noinline] on GVN charpred
The charpred of class `GVN` in `ASTValueNumbering.qll` got inlined into
the member predicate `getAnInstruction` and caused a tuple explosion on
Wireshark in the query `StrncpyFlippedArgs.ql`.

I interrupted the predicate after 10 minutes and got these intermediate
tuple counts:

    (5208s) Tuple counts for ASTValueNumbering::GVN::getAnInstruction_dispred#ff:
    8754900909 ~5%          {3} r1 = JOIN ValueNumberingInternal::tvalueNumber#ff_10#join_rhs AS L WITH ValueNumberingInternal::tvalueNumber#ff_10#join_rhs AS R ON FIRST 1 OUTPUT R.<1>, L.<1>, L.<0>
    4390274632 ~150085%     {2} r2 = JOIN r1 WITH project#SSAConstruction::Cached::getInstructionUnconvertedResultExpression AS R ON FIRST 1 OUTPUT r1.<2>, r1.<1>
                            return r2

After this change, the `getAnInstruction` predicate is itself inlined,
like it should be. The new non-inlined charpred takes 2.1s and has these
tuple counts:

    (2s) Tuple counts for ASTValueNumbering::GVN#f:
    9158442  ~117%     {1} r1 = JOIN project#SSAConstruction::Cached::getInstructionUnconvertedResultExpression AS L WITH ValueNumberingInternal::tvalueNumber#ff@staged_ext AS R ON FIRST 1 OUTPUT R.<1>
                       return r1
2020-03-04 10:34:05 +01:00
Esben Sparre Andreasen
ae43e90a67 JS: model process as an EventEmitter 2020-03-04 09:49:16 +01:00
Rebecca Valentine
2bcd8c8cb8 Python: Moves query over to modernized predicates 2020-03-03 17:05:47 -08:00
Rebecca Valentine
fa59fc607c Python: Adds modernized predicates 2020-03-03 17:05:29 -08:00
Rebecca Valentine
0f26734e9a Python: Moves more predicates over to suffixed form 2020-03-03 17:04:12 -08:00
Rebecca Valentine
a0cf2cbb13 Python: Moves old predicates to suffixed form 2020-03-03 16:53:56 -08:00
Rebecca Valentine
400a0f5741 Python: Adds preliminary modernization 2020-03-03 16:52:12 -08:00
Rebecca Valentine
b33b222db8 Python: Modernizes query 2020-03-03 16:41:52 -08:00
Rebecca Valentine
88daf65854 Python: Removes obsolete predicates 2020-03-03 16:03:27 -08:00
Rebecca Valentine
3bedd5cb58 Python: Adds modernized predicates and moves query over to them 2020-03-03 16:02:25 -08:00
Rebecca Valentine
5fea31eed1 Python: Moves predicates over to suffixed form 2020-03-03 15:55:40 -08:00
Rebecca Valentine
e39a0c9121 Python: Moves non_local_control_flow to new API, and fixes bug in ClassValue implementation 2020-03-03 15:38:35 -08:00
Taus
02ae0fbda6 Merge pull request #2965 from BekaValentine/python-objectapi-to-valueapi-raising
Python: ObjectAPI to ValueAPI: Raising
2020-03-04 00:03:17 +01:00
Rebecca Valentine
ce204ac949 Python: Moves statement out of quantifier that it didnt need to be in 2020-03-03 14:57:30 -08:00
Rebecca Valentine
8e1c089ff3 Python: Removes unused import 2020-03-03 14:38:26 -08:00
Robert Marsh
1e3419fd60 C++/C#: generate IR for funcs excluded in PrintIR
Previously, functions excluded from PrintIR would not have IR
generated. This sometimes affected escacpe analysis of functions that
were printed.
2020-03-03 14:34:08 -08:00
semmle-qlci
6f508bccc1 Merge pull request #2943 from esbena/js/more-fs-modules
Approved by erik-krogh
2020-03-03 21:50:43 +00:00
Taus Brock-Nannestad
48a47e1b54 Python: Fix broken test output. 2020-03-03 19:45:13 +01:00
Taus
8bd4f6d136 Merge pull request #2945 from BekaValentine/python-objectapi-to-valueapi-calltosuperwrongclass
Python: ObjectAPI to ValueAPI: CallToSuperWrongClass
2020-03-03 18:38:58 +01:00
Taus
9068040097 Merge pull request #2964 from BekaValentine/python-objectapi-to-valueapi-notimplemented
Python: ObjectAPI to ValueAPI: NotImplemented
2020-03-03 18:36:14 +01:00
Calum Grant
464a034c7d Merge pull request #2894 from BekaValentine/python-objectapi-to-valueapi-iscomparisons
Python: ObjectAPI to ValueAPI: IsComparisons
2020-03-03 17:25:24 +00:00
Taus Brock-Nannestad
eecace788f Python: Fix or disable CPs introduced by #2700 and #2875. 2020-03-03 18:18:03 +01:00
yo-h
a576f3fa54 Merge pull request #2966 from aschackmull/java/nullness-fp-test
Java: Document a FP for nullness in a test.
2020-03-03 12:04:52 -05:00
Nick Rolfe
c2db3d7984 Merge pull request #2968 from igfoo/unused_types
C++: Update tests following extractor no longer extracting some unused types
2020-03-03 16:03:40 +00:00
Esben Sparre Andreasen
4625217a68 Merge branch 'master' of github.com:Semmle/ql into js/more-fs-modules 2020-03-03 15:07:51 +01:00
Jonas Jensen
30b43b9322 C++: Tests for variables with ambiguous types 2020-03-03 14:45:04 +01:00
Esben Sparre Andreasen
dfa07130b5 JS: add process EventEmitter test 2020-03-03 14:26:03 +01:00
Jonas Jensen
88c74b2a4b Merge pull request #2917 from MathiasVP/inexact-is-chi-for-all-aliased-memory
C++: `isChiForAllAliasedMemory` recursion through inexact Phi operands
2020-03-03 14:25:49 +01:00
Jonas Jensen
4f23acf080 Merge pull request #2957 from MathiasVP/dataflow-dispatch-same-num-args
C++: Only return functions that match arguments in DataFlowDispatch::viableCallable
2020-03-03 14:19:26 +01:00
Anders Schack-Mulligen
4601639bad Java: Document a FP in a test. 2020-03-03 13:39:26 +01:00
Erik Krogh Kristensen
f03c67266a add taint step for replace call that only removes dots 2020-03-03 12:58:06 +01:00
Erik Krogh Kristensen
95819c8731 use RegExpTerm to generalize predicate 2020-03-03 12:34:18 +01:00