False Negative: DoubleCheckedLockingWithInitRace.ql misses initialization races once the double-checked pattern is split across helpers or early returns.
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 52/100
調査の方向性
まず Likely Bugs/Concurrency/DoubleCheckedLockingWithInitRace.ql と、例の PosCase1_Var3.java および PosCase1_Var5.java を読みます。クエリがヘルパー呼び出しと早期リターンをどのように処理するかを追跡し、その後、初期化レースの両方のバリアントが検出されることを確認します。
索引モデルが issue の本文から書いたものです。
説明
False Negative: DoubleCheckedLockingWithInitRace.ql misses initialization races once the double-checked pattern is split across helpers or early returns.
Version
codeql 2.24.3
Checker
- Checker id:
Likely Bugs/Concurrency/DoubleCheckedLockingWithInitRace.ql - Checker description: This checker detects a potential race condition in double-checked locking patterns where a field assignment inside a synchronized block may be visible to other threads before subsequent side-effect statements are executed.
Description of the false negative
These samples still publish f before the rest of the initialization work is complete. One variant moves the synchronized initialization into a helper, and the other rewrites the fast path as an early return, but the initialization race is the same.
Affected test cases
PosCase1_Var3.java
The helper call only hides the same double-checked-locking race where publication happens before later side effects.
// Double-checked locking with assignment to another field after the field assignment should be flagged as potential race condition.
package scensct.var.pos;
public class PosCase1_Var3 {
private Object f;
private Object otherField;
public Object getF() {
if (f == null) {
initField();
}
return f;
}
private void initField() {
synchronized (this) {
if (f == null) {
f = new Object();
otherField = new Object();
}
}
}
}
PosCase1_Var5.java
This still publishes the initialized object before a later field assignment completes, which is the race the query is meant to catch.
// Double-checked locking with assignment to another field after the field assignment should be flagged as potential race condition.
package scensct.var.pos;
public class PosCase1_Var5 {
private Object f;
private Object otherField;
public Object getF() {
if (f != null) {
return f;
}
synchronized (this) {
if (f == null) {
f = new Object();
otherField = new Object();
}
return f;
}
}
}
Cause analysis
The query appears too tied to one inline statement ordering pattern for double-checked initialization. Once the synchronized block is extracted into a helper or the fast path is expressed as an early return, it stops recognizing that f becomes visible before the remaining side effects complete.
That is a real concurrency gap. Initialization races often survive exactly this kind of refactoring.
References
None known.
- 主要言語
- CodeQL
- スター
- 10.1k
- フォーク
- 2.1k
- 平均マージ
- 2日 16時間
- マージ済み PR(30日)
- 143
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
github/codeql のほかの issue
-
agentic-workflows
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
false-positive javascript
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
-
C#: cs/simplifiable-boolean-expression false positive on Nullable<bool> compared with a literal オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
false-positive
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
palladius/rails8-app-on-gcp#145 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
elastic/gradle-plugins#156 ·
-
area:workflow bug ready-for-agent
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
fil-donadoni/tolaria#4409 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
dotenvx/dotenv-vscode#139 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
Fission-AI/OpenSpec#1960 ·