Skip to content

Commit ce53a3e

Browse files
github-actions[bot]heguanhuiroot
authored
branch-4.1: [fix](be ut) Skip custom memcpy on ARM+ASAN to fix segfault at process startup #63656 (#63942)
Cherry-picked from #63656 Co-authored-by: heguanhui <hgh_wy163mail@163.com> Co-authored-by: root <root@DESKTOP-3AF37B>
1 parent 5491bbd commit ce53a3e

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

be/src/glibc-compatibility/CMakeLists.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,16 @@ if (GLIBC_COMPATIBILITY)
5959
list(REMOVE_ITEM glibc_compatibility_sources musl/getrandom.c)
6060
# NOTE(amos): sanitizers might generate memcpy references that are too late to
6161
# refer. Let's also extract memcpy definitions explicitly to avoid UNDEF GLIBC 2.14.
62-
add_library(glibc-compatibility-explicit OBJECT musl/getrandom.c ${MEMCPY_SOURCE})
62+
#
63+
# NOTE: On ARM (aarch64) with ASAN, the custom memcpy (memcpy_aarch64.cpp) overrides
64+
# the global memcpy symbol. libpthread's __pthread_initialize_minimal() calls memcpy
65+
# before ASAN shadow memory is initialized, causing SIGSEGV. Skip custom memcpy in
66+
# this case and fall back to glibc's memcpy.
67+
if (ARCH_ARM AND (CMAKE_BUILD_TYPE STREQUAL "ASAN_UT" OR CMAKE_BUILD_TYPE STREQUAL "ASAN"))
68+
add_library(glibc-compatibility-explicit OBJECT musl/getrandom.c)
69+
else()
70+
add_library(glibc-compatibility-explicit OBJECT musl/getrandom.c ${MEMCPY_SOURCE})
71+
endif()
6372
target_compile_options(glibc-compatibility-explicit PRIVATE -fPIC)
6473
add_library(glibc-compatibility STATIC ${glibc_compatibility_sources})
6574
target_compile_options(

0 commit comments

Comments
 (0)