Skip to content

Merge rc/3.7 into main #10478

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 35 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
9745073
C++: Speedup 'cpp/using-expired-stack-address' by avoiding a large ne…
MathiasVP Sep 6, 2022
d6b8f25
C++: Add more tests.
MathiasVP Sep 6, 2022
9504455
Merge pull request #10321 from MathiasVP/speedup-using-expired-stack-…
Sep 7, 2022
a9d80a5
Release preparation for version 2.10.5
invalid-email-address Sep 8, 2022
12ca801
Merge pull request #10350 from github/release-prep/2.10.5
igfoo Sep 8, 2022
ed66388
Port Pack Docs changes to 3.7
aeisenberg Aug 18, 2022
361dba1
Add information about the `registries` block in `codeql-workspace.yml`
aeisenberg Sep 7, 2022
abdc79b
Update the example `codeql-workspace.yml`
aeisenberg Sep 9, 2022
a9202b5
Tweak the query suites documentation
aeisenberg Sep 12, 2022
68f0505
Apply suggestions from code review
aeisenberg Sep 12, 2022
996695d
Merge pull request #10367 from github/aeisenberg/packs-docs-changes-3.7
aeisenberg Sep 13, 2022
dbd5195
Merge pull request #10344 from github/aeisenberg/registries-in-workspace
aeisenberg Sep 13, 2022
3c1f67d
Apply suggestions from code review
aeisenberg Sep 14, 2022
3102a44
Merge pull request #10389 from github/aeisenberg/suites-docs
aeisenberg Sep 14, 2022
c17af8c
update info about downloading dbs in vs code
jf205 Sep 2, 2022
64ea959
new screenshot
jf205 Sep 2, 2022
8ce4ed5
update info about downloading dbs in vs code
jf205 Sep 2, 2022
c3b2d2b
new screenshot
jf205 Sep 2, 2022
3321c52
Add section about using the API to download dbs
jf205 Sep 9, 2022
9b74b8f
remove link to deleted file
jf205 Sep 9, 2022
60dbfd2
delete old note that refers to lgtm
jf205 Sep 9, 2022
ff98805
delete unused reusable note
jf205 Sep 9, 2022
efd4853
Apply suggestions from code review
jf205 Sep 12, 2022
72bc7ae
address review comments
jf205 Sep 13, 2022
c7ec6fc
mention compatibility with CLI used by GHES
jf205 Sep 13, 2022
d18bc13
fix indentation
jf205 Sep 13, 2022
8f29c5b
fix broken anchor
jf205 Sep 13, 2022
625e18a
Apply suggestions from code review
jf205 Sep 13, 2022
c383701
add link and remove todo
jf205 Sep 14, 2022
cdbc839
Update docs/codeql/codeql-cli/getting-started-with-the-codeql-cli.rst
jf205 Sep 14, 2022
2503a13
Merge pull request #10428 from jf205/download-db-vs-code-release
jf205 Sep 14, 2022
67ce442
Post-release preparation for codeql-cli-2.10.5
invalid-email-address Sep 16, 2022
4a4cd8a
Merge pull request #10456 from github/post-release-prep/codeql-cli-2.…
igfoo Sep 16, 2022
d0c6837
C#: Do not recognize 'run' as supported dotnet command for tracing.
michaelnebel Sep 17, 2022
01a043d
Merge pull request #10464 from michaelnebel/csharp/remove-dotnet-run-…
hvitved Sep 19, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cpp/ql/lib/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## 0.3.5

## 0.3.4

### Deprecated APIs
Expand Down
1 change: 1 addition & 0 deletions cpp/ql/lib/change-notes/released/0.3.5.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
## 0.3.5
2 changes: 1 addition & 1 deletion cpp/ql/lib/codeql-pack.release.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
lastReleaseVersion: 0.3.4
lastReleaseVersion: 0.3.5
2 changes: 1 addition & 1 deletion cpp/ql/lib/qlpack.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: codeql/cpp-all
version: 0.3.5-dev
version: 0.3.6-dev
groups: cpp
dbscheme: semmlecode.cpp.dbscheme
extractor: cpp
Expand Down
2 changes: 2 additions & 0 deletions cpp/ql/src/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## 0.3.4

## 0.3.3

### Minor Analysis Improvements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,19 +163,46 @@ TGlobalAddress globalAddress(Instruction instr) {
result = globalAddress(instr.(PointerOffsetInstruction).getLeft())
}

/** Gets a `StoreInstruction` that may be executed after executing `store`. */
pragma[inline]
StoreInstruction getAStoreStrictlyAfter(StoreInstruction store) {
exists(IRBlock block, int index1, int index2 |
block.getInstruction(index1) = store and
block.getInstruction(index2) = result and
index2 > index1
/**
* Gets a first `StoreInstruction` that writes to address `globalAddress` reachable
* from `block`.
*/
StoreInstruction getFirstStore(IRBlock block, TGlobalAddress globalAddress) {
1 = getStoreRank(result, block, globalAddress)
or
not exists(getStoreRank(_, block, globalAddress)) and
result = getFirstStore(block.getASuccessor(), globalAddress)
}

/**
* Gets the rank of `store` in block `block` (i.e., a rank of `1` means that it is the
* first `store` to write to `globalAddress`, a rank of `2` means it's the second, etc.)
*/
int getStoreRank(StoreInstruction store, IRBlock block, TGlobalAddress globalAddress) {
blockStoresToAddress(block, _, store, globalAddress) and
store =
rank[result](StoreInstruction anotherStore, int i |
blockStoresToAddress(_, i, anotherStore, globalAddress)
|
anotherStore order by i
)
}

/**
* Gets a next subsequent `StoreInstruction` to write to `globalAddress`
* after `store` has done so.
*/
StoreInstruction getANextStoreTo(StoreInstruction store, TGlobalAddress globalAddress) {
exists(IRBlock block, int rnk |
rnk = getStoreRank(store, block, globalAddress) and
rnk + 1 = getStoreRank(result, block, globalAddress)
)
or
exists(IRBlock block1, IRBlock block2 |
store.getBlock() = block1 and
result.getBlock() = block2 and
block1.getASuccessor+() = block2
exists(IRBlock block, int rnk, IRBlock succ |
rnk = getStoreRank(store, block, globalAddress) and
not rnk + 1 = getStoreRank(_, block, globalAddress) and
succ = block.getASuccessor() and
result = getFirstStore(succ, globalAddress)
)
}

Expand All @@ -192,7 +219,7 @@ predicate stackAddressEscapes(
stackPointerFlowsToUse(store.getSourceValue(), vai)
) and
// Ensure there's no subsequent store that overrides the global address.
not globalAddress = globalAddress(getAStoreStrictlyAfter(store).getDestinationAddress())
not exists(getANextStoreTo(store, globalAddress))
}

predicate blockStoresToAddress(
Expand Down
1 change: 1 addition & 0 deletions cpp/ql/src/change-notes/released/0.3.4.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
## 0.3.4
2 changes: 1 addition & 1 deletion cpp/ql/src/codeql-pack.release.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
lastReleaseVersion: 0.3.3
lastReleaseVersion: 0.3.4
2 changes: 1 addition & 1 deletion cpp/ql/src/qlpack.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: codeql/cpp-queries
version: 0.3.4-dev
version: 0.3.5-dev
groups:
- cpp
- queries
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ edges
| test.cpp:201:5:201:17 | EnterFunction: maybe_deref_p | test.cpp:201:5:201:17 | VariableAddress: maybe_deref_p |
| test.cpp:210:3:210:9 | Call: call to escape1 | test.cpp:201:5:201:17 | EnterFunction: maybe_deref_p |
| test.cpp:210:3:210:9 | Call: call to escape1 | test.cpp:201:5:201:17 | VariableAddress: maybe_deref_p |
| test.cpp:234:3:234:13 | Store: ... = ... | test.cpp:238:3:238:9 | Call: call to escape2 |
| test.cpp:238:3:238:9 | Call: call to escape2 | test.cpp:239:17:239:17 | Load: p |
| test.cpp:263:3:263:13 | Store: ... = ... | test.cpp:267:3:267:9 | Call: call to escape3 |
| test.cpp:267:3:267:9 | Call: call to escape3 | test.cpp:268:17:268:17 | Load: p |
#select
| test.cpp:15:16:15:16 | Load: p | test.cpp:10:3:10:13 | Store: ... = ... | test.cpp:15:16:15:16 | Load: p | Stack variable $@ escapes $@ and is used after it has expired. | test.cpp:9:7:9:7 | x | x | test.cpp:10:3:10:13 | Store: ... = ... | here |
| test.cpp:24:16:24:16 | Load: p | test.cpp:10:3:10:13 | Store: ... = ... | test.cpp:24:16:24:16 | Load: p | Stack variable $@ escapes $@ and is used after it has expired. | test.cpp:9:7:9:7 | x | x | test.cpp:10:3:10:13 | Store: ... = ... | here |
Expand All @@ -90,3 +94,5 @@ edges
| test.cpp:180:14:180:19 | Load: * ... | test.cpp:154:3:154:22 | Store: ... = ... | test.cpp:180:14:180:19 | Load: * ... | Stack variable $@ escapes $@ and is used after it has expired. | test.cpp:133:7:133:8 | b2 | b2 | test.cpp:154:3:154:22 | Store: ... = ... | here |
| test.cpp:181:13:181:20 | Load: access to array | test.cpp:155:3:155:21 | Store: ... = ... | test.cpp:181:13:181:20 | Load: access to array | Stack variable $@ escapes $@ and is used after it has expired. | test.cpp:134:7:134:8 | b3 | b3 | test.cpp:155:3:155:21 | Store: ... = ... | here |
| test.cpp:182:14:182:19 | Load: * ... | test.cpp:156:3:156:25 | Store: ... = ... | test.cpp:182:14:182:19 | Load: * ... | Stack variable $@ escapes $@ and is used after it has expired. | test.cpp:134:7:134:8 | b3 | b3 | test.cpp:156:3:156:25 | Store: ... = ... | here |
| test.cpp:239:17:239:17 | Load: p | test.cpp:234:3:234:13 | Store: ... = ... | test.cpp:239:17:239:17 | Load: p | Stack variable $@ escapes $@ and is used after it has expired. | test.cpp:232:7:232:7 | x | x | test.cpp:234:3:234:13 | Store: ... = ... | here |
| test.cpp:268:17:268:17 | Load: p | test.cpp:263:3:263:13 | Store: ... = ... | test.cpp:268:17:268:17 | Load: p | Stack variable $@ escapes $@ and is used after it has expired. | test.cpp:260:7:260:7 | x | x | test.cpp:263:3:263:13 | Store: ... = ... | here |
Original file line number Diff line number Diff line change
Expand Up @@ -209,4 +209,61 @@ int maybe_deref_p(bool b) {
int field_indirect_maybe_bad(bool b) {
escape1();
return maybe_deref_p(b);
}

// These next tests cover subsequent stores to the same address in the same basic block.

static struct S100 s102;

void not_escape1() {
int x;
s102.p = &x;
s102.p = nullptr;
}

void calls_not_escape1() {
not_escape1();
int x = *s102.p; // GOOD
}

static struct S100 s103;

void escape2() {
int x;
s103.p = nullptr;
s103.p = &x;
}

void calls_escape2() {
escape2();
int x = *s103.p; // BAD
}

bool unknown();
static struct S100 s104;

void not_escape2() {
int x;
s104.p = &x;
if(unknown()) { }
s104.p = nullptr;
}

void calls_not_escape2() {
not_escape2();
int x = *s104.p; // GOOD
}

static struct S100 s105;

void escape3() {
int x;
s105.p = nullptr;
if(unknown()) { }
s105.p = &x;
}

void calls_escape3() {
escape3();
int x = *s105.p; // BAD
}
2 changes: 2 additions & 0 deletions csharp/ql/campaigns/Solorigate/lib/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## 1.2.5

## 1.2.4

## 1.2.3
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
## 1.2.5
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
lastReleaseVersion: 1.2.4
lastReleaseVersion: 1.2.5
2 changes: 1 addition & 1 deletion csharp/ql/campaigns/Solorigate/lib/qlpack.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: codeql/csharp-solorigate-all
version: 1.2.5-dev
version: 1.2.6-dev
groups:
- csharp
- solorigate
Expand Down
2 changes: 2 additions & 0 deletions csharp/ql/campaigns/Solorigate/src/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## 1.2.5

## 1.2.4

## 1.2.3
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
## 1.2.5
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
lastReleaseVersion: 1.2.4
lastReleaseVersion: 1.2.5
2 changes: 1 addition & 1 deletion csharp/ql/campaigns/Solorigate/src/qlpack.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: codeql/csharp-solorigate-queries
version: 1.2.5-dev
version: 1.2.6-dev
groups:
- csharp
- solorigate
Expand Down
2 changes: 2 additions & 0 deletions csharp/ql/lib/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## 0.3.5

## 0.3.4

### Deprecated APIs
Expand Down
1 change: 1 addition & 0 deletions csharp/ql/lib/change-notes/released/0.3.5.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
## 0.3.5
2 changes: 1 addition & 1 deletion csharp/ql/lib/codeql-pack.release.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
lastReleaseVersion: 0.3.4
lastReleaseVersion: 0.3.5
2 changes: 1 addition & 1 deletion csharp/ql/lib/qlpack.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: codeql/csharp-all
version: 0.3.5-dev
version: 0.3.6-dev
groups: csharp
dbscheme: semmlecode.csharp.dbscheme
extractor: csharp
Expand Down
2 changes: 2 additions & 0 deletions csharp/ql/src/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## 0.3.4

## 0.3.3

### Minor Analysis Improvements
Expand Down
1 change: 1 addition & 0 deletions csharp/ql/src/change-notes/released/0.3.4.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
## 0.3.4
2 changes: 1 addition & 1 deletion csharp/ql/src/codeql-pack.release.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
lastReleaseVersion: 0.3.3
lastReleaseVersion: 0.3.4
2 changes: 1 addition & 1 deletion csharp/ql/src/qlpack.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: codeql/csharp-queries
version: 0.3.4-dev
version: 0.3.5-dev
groups:
- csharp
- queries
Expand Down
16 changes: 1 addition & 15 deletions csharp/tools/tracing-config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,26 +36,12 @@ function RegisterExtractorPack(id)
match = true
break
end
if arg == 'run' then
-- for `dotnet run`, we need to make sure that `-p:UseSharedCompilation=false` is
-- not passed in as an argument to the program that is run
match = true
needsSeparator = true
end
end
if arg == '--' then
needsSeparator = false
break
end
end
if match then
local injections = { '-p:UseSharedCompilation=false' }
if needsSeparator then
table.insert(injections, '--')
end
return {
order = ORDER_REPLACE,
invocation = BuildExtractorInvocation(id, compilerPath, compilerPath, compilerArguments, nil, injections)
invocation = BuildExtractorInvocation(id, compilerPath, compilerPath, compilerArguments, nil, { '-p:UseSharedCompilation=false' })
}
end
return nil
Expand Down
Loading