LeakSanitizer detects memory leak from CodeQL `x86_64-linux-gnu_x86_64_trace.so` when executing Rust fuzzing test in OneBranch pipeline
- 主要語言
- CodeQL
- 星號
- 10.1k
- 分支
- 2.1k
- 平均合併
- 2 天 15 小時
- 30 天內合併 PR
- 141
描述
Hi - I am seeing a memory leak being flagged during the execution of a Rust fuzzing test, on Azure Linux 3, within a OneBranch pipeline. I have been unable to reproduce the memory leak in local testing with the same set of Rust code; I think this may be a leak that is being caused by the CodeQL 3000 tracing library.
## Error Signature
Specifically, I am seeing this error signature:
(Click to expand)
```
2025-11-26T20:04:07.5343825Z ==109898==ERROR: LeakSanitizer: detected memory leaks
2025-11-26T20:04:07.5343887Z
2025-11-26T20:04:07.5344108Z Direct leak of 160 byte(s) in 1 object(s) allocated from:
2025-11-26T20:04:07.5344428Z #0 0x57a7ca86e6eb (/__w/1/s/MY_PROJECT/target/x86_64-unknown-linux-gnu/release/MY_FUZZ_TEST+0x4136eb) (BuildId: b6870f4ceac1ea4791814963416eff9d7e3b719b)
2025-11-26T20:04:07.5345092Z #1 0x7f7df75e33f3 (/__w/_temp/codeql3000/distribution/codeql/tools/linux64/lib/x86_64-linux-gnu_haswell_trace.so+0xdc3f3)
2025-11-26T20:04:07.5345174Z
2025-11-26T20:04:07.5345360Z Objects leaked above:
2025-11-26T20:04:07.5345555Z 0x7c5df5fe0040 (160 bytes)
2025-11-26T20:04:07.5345615Z
2025-11-26T20:04:07.5345832Z Indirect leak of 560 byte(s) in 7 object(s) allocated from:
2025-11-26T20:04:07.5346157Z #0 0x57a7ca86e6eb (/__w/1/s/MY_PROJECT/target/x86_64-unknown-linux-gnu/release/MY_FUZZ_TEST+0x4136eb) (BuildId: b6870f4ceac1ea4791814963416eff9d7e3b719b)
2025-11-26T20:04:07.5346463Z #1 0x7f7df75e33f3 (/__w/_temp/codeql3000/distribution/codeql/tools/linux64/lib/x86_64-linux-gnu_haswell_trace.so+0xdc3f3)
2025-11-26T20:04:07.5346523Z
2025-11-26T20:04:07.5346705Z Objects leaked above:
2025-11-26T20:04:07.5346893Z 0x7bbdf5fe0b10 (48 bytes)
2025-11-26T20:04:07.5347081Z 0x7bbdf5fe0d10 (48 bytes)
2025-11-26T20:04:07.5347271Z 0x7bbdf5fe0d50 (48 bytes)
2025-11-26T20:04:07.5347459Z 0x7bddf5fe0c20 (64 bytes)
2025-11-26T20:04:07.5347850Z 0x7bedf5fe0f00 (80 bytes)
2025-11-26T20:04:07.5348044Z 0x7bedf5fe0f70 (80 bytes)
2025-11-26T20:04:07.5348236Z 0x7c7df5fe0540 (192 bytes)
2025-11-26T20:04:07.5348312Z
2025-11-26T20:04:07.5348537Z SUMMARY: AddressSanitizer: 720 byte(s) leaked in 8 allocation(s).
```
Based on the stack trace being displayed by LeakSanitizer, I believe it may be the source of the memory leak. Or, I suspect the extra tracing being done is interfering with LeakSanitizer's ability to detect memory leaks, and it may be a false positive.
## Other Details
Our code is written in Rust; we are using the [cargo-fuzz](https://github.com/rust-fuzz/cargo-fuzz) crate, which is a wrapper around LLVM's [LibFuzzer](https://llvm.org/docs/LibFuzzer.html), to fuzz our Rust code. As part of the fuzzing, we've enabled detection of memory leaks, which is what resulted in the above error being spat out.
## Questions
* Is this a known issue with CodeQL 3000 in regard to Rust code or LibFuzzer, or perhaps both?
* If need be, is there a way we can disable CodeQL 3000 when executing our fuzzing tests?
There are more specific details I can share about this internally; please reach out to me at [connorshugg@microsoft.com](mailto:connorshugg@microsoft.com) or on Teams and I would be happy to share more.
貢獻指南
研究方向
Start with the reported LeakSanitizer signature and the CodeQL 3000 tracing library path in the OneBranch pipeline, then review how cargo-fuzz and LibFuzzer run the Rust test. Compare the pipeline setup with local testing to determine whether the 720-byte leak is caused by CodeQL tracing or is a false positive, and document whether CodeQL can be disabled for these tests.
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- rust
- 領域
- security, testing-qa
- Issue 類型
- 缺陷
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 需要釐清
- 新手友好度
- 25/100