[fix](be ut) Skip custom memcpy on ARM+ASAN to fix segfault at process startup#63656
[fix](be ut) Skip custom memcpy on ARM+ASAN to fix segfault at process startup#63656heguanhui wants to merge 1 commit into
Conversation
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
|
run buildall |
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
TPC-H: Total hot run time: 31673 ms |
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
TPC-DS: Total hot run time: 172256 ms |
|
/review |
|
PR approved by at least one committer and no changes requested. |
|
PR approved by anyone and no changes requested. |
There was a problem hiding this comment.
Requesting changes because the new ARM sanitizer guard does not cover the BE unit-test build mode that the PR title says it fixes.
Critical checkpoint conclusions:
- Goal/test proof: The goal is to avoid custom memcpy on ARM sanitizer BE UT startup, but the current condition only handles CMake build type ASAN while run-be-ut.sh passes ASAN_UT for the default ASAN UT build. No test evidence in the PR demonstrates the BE UT path is fixed.
- Scope/focus: The code change is small and focused, but the predicate is too narrow for the targeted build path.
- Concurrency/lifecycle/config/compatibility: No new runtime concurrency, lifecycle, config, storage-format, or protocol compatibility concerns found in this CMake-only change.
- Parallel paths: Regular BE ASAN is handled, but BE UT ASAN_UT is a parallel sanitizer build path and is missed.
- Test coverage: No automated coverage was added; at minimum the affected ARM ASAN_UT configuration should be validated.
- Performance/observability: No runtime performance or observability impact beyond build linkage.
User focus: No additional user-provided review focus was specified.
| # the global memcpy symbol. libpthread's __pthread_initialize_minimal() calls memcpy | ||
| # before ASAN shadow memory is initialized, causing SIGSEGV. Skip custom memcpy in | ||
| # this case and fall back to glibc's memcpy. | ||
| if (ARCH_ARM AND "${CMAKE_BUILD_TYPE}" STREQUAL "ASAN") |
There was a problem hiding this comment.
This misses the BE unit-test build mode. run-be-ut.sh defaults BUILD_TYPE_UT to ASAN, but before invoking CMake it maps that to -DCMAKE_BUILD_TYPE=ASAN_UT (lines 245-254). On ARM BE UTs, this condition is therefore false and memcpy_aarch64.cpp is still added to glibc-compatibility-explicit, leaving the startup crash described in the PR title unfixed. Please include ASAN_UT (or otherwise key off the sanitizer flags) in this guard.
What problem does this PR solve?
The glibc-compatibility module provides a custom memcpy implementation (memcpy_aarch64.cpp) that overrides the global memcpy symbol via extern "C". This is done to avoid dependency on a specific glibc symbol version (e.g., memcpy@@GLIBC_2.14) for portability.
However, libpthread's __pthread_initialize_minimal() calls memcpy during very early process startup — before main(), before C++ static initialization, and before ASAN shadow memory is set up. When ASAN is enabled, the custom memcpy accesses memory that ASAN shadow has not yet mapped, resulting in SIGSEGV.
This only affects aarch64 + ASAN because:
RELEASE builds have no ASAN shadow memory checks
x86_64 + ASAN does not exhibit this crash (different shadow memory layout and initialization timing)
Problem Summary:
Release note
None
Check List (For Author)
问题及修复.docx
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)