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

Abierto
#20,976 0 comentarios 0 reacciones 0 asignados Ver en GitHub
question
Lenguaje dominante
CodeQL
Estrellas
10.1k
Forks
2.1k
Merge medio
2 d 15 h
PR fusionados (30 d)
141

Descripción

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.

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza con la firma de LeakSanitizer reportada y la ruta de la biblioteca de tracing de CodeQL 3000 en el pipeline de OneBranch; después, revisa cómo cargo-fuzz y LibFuzzer ejecutan la prueba de Rust. Compara la configuración del pipeline con las pruebas locales para determinar si el leak de 720 bytes está causado por CodeQL tracing o es un false positive, y documenta si CodeQL puede deshabilitarse para estas pruebas.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
rust
Área
security, testing-qa
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Necesita aclaración
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.