zclllyybb commented on issue #64170: URL: https://github.com/apache/doris/issues/64170#issuecomment-4639600966
Breakwater-GitHub-Analysis-Slot: slot_83de95694b4d Initial read: this looks like a real build-system isolation bug, not an OpenBLAS runtime issue. What I could confirm from current `upstream/master`: - Doris sets sanitizer build flags globally in `be/CMakeLists.txt`: `LSAN` uses `-fsanitize=leak`, `ASAN` / `ASAN_UT` use `-fsanitize=address`, and `UBSAN` currently includes `-mcmodel=medium`. - The same file then copies the C++ flags into `CMAKE_C_FLAGS`, so these options also affect C-only configure helpers. - `be/src/storage/index/ann/cmake-protect/CMakeLists.txt` adds only `-w` before importing `contrib/openblas` and `contrib/faiss`; it does not clear sanitizer flags or the UBSAN `-mcmodel=medium` flag before `add_subdirectory()`. - OpenBLAS CMake builds and runs the `getarch` helper during configure via `try_compile()` / `execute_process()`. - The checked OpenBLAS aarch64 detector (`cpuid_arm64.c`) allocates `cpu_part` / `cpu_implementer` with `strdup()` in `detect()` and returns through `get_corename()` without freeing those buffers, so an LSAN-enabled build-time `getarch` can report leaks exactly in this path. So the likely failure chain is: 1. Doris sanitizer mode sets global BE C/C++ flags. 2. The ANN CMake wrapper imports OpenBLAS/FAISS without isolating third-party configure/build flags. 3. OpenBLAS builds `getarch` with those inherited sanitizer flags. 4. On aarch64, `getarch` runs CPU detection code that leaks small `strdup()` allocations. 5. LeakSanitizer can make the build-time helper fail during CMake configure, blocking the BE build before Doris code is built. For `UBSAN`, the separate `-mcmodel=medium` report is also consistent with the current CMake wiring: the flag is set in Doris' UBSAN build flags and then inherited by OpenBLAS/FAISS. That flag should not be propagated into aarch64 third-party sub-builds. Suggested fix direction: - Isolate the ANN third-party sub-builds in `be/src/storage/index/ann/cmake-protect/CMakeLists.txt`: save the Doris `CMAKE_C_FLAGS` / `CMAKE_CXX_FLAGS`, strip sanitizer options/defines and x86-only options such as `-mcmodel=medium` before adding OpenBLAS and FAISS, then restore the original flags for Doris targets. - Prefer this over globally disabling LSAN leak detection, because global `detect_leaks=0` would hide real Doris leaks and would not address the UBSAN `-mcmodel=medium` leakage. - A smaller OpenBLAS-side fix to free the aarch64 `strdup()` buffers would also be reasonable, but Doris should still avoid instrumenting build-time third-party configure helpers with Doris' sanitizer flags. Useful validation artifacts for the PR: - Full CMake configure logs for `LSAN`, `ASAN_UT`, `ASAN`, and `UBSAN` on the aarch64 host, including the printed `C Flags` / `CXX Flags` lines. - Compiler and sanitizer runtime versions (`gcc`/`clang`, libc, OS image). - The first fatal CMake error for the UBSAN case, especially whether it comes from OpenBLAS `getarch`, OpenBLAS compilation, or FAISS compilation. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
