github / github/codeql

LeakSanitizer detects memory leak from CodeQL `x86_64-linux-gnu_x86_64_trace.so` when executing Rust fuzzing test in OneBranch pipeline

Đang mở
#20,976 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
question
Ngôn ngữ chính
CodeQL
Star
10.1k
Fork
2.1k
Merge trung bình
2 ngày 15 giờ
Pull request đã merge (30 ngày)
141

Mô tả

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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.