This is an automated email from the ASF dual-hosted git repository.

morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 859a19c3a54 [fix](build) Fix ASAN getentropy crash on glibc 2.17 
(#67848)
859a19c3a54 is described below

commit 859a19c3a54b3a0a09bb198f9a9f2c5c4c1cdc47
Author: daidai <[email protected]>
AuthorDate: Fri Sep 11 22:40:45 2026 +0800

    [fix](build) Fix ASAN getentropy crash on glibc 2.17 (#67848)
    
    ### What problem does this PR solve?
    
    Issue Number: N/A
    
    Related PR: #67752
    
    Problem Summary:
    
    BE unit tests can crash at address zero while Arrow Flight initializes
    Abseil random seeds on CentOS 7 (glibc 2.17). ASAN's weak `getentropy`
    interceptor satisfies the reference before the linker scans
    `libglibc-compatibility.a`, so Doris' compatibility implementation is
    not extracted. Since glibc 2.17 has no `getentropy`, the interceptor
    calls a null `real_getentropy` pointer. Restoring the CentOS 7 CI image
    exposed this existing gap.
    
    Link the existing `musl/getentropy.c` through
    `glibc-compatibility-explicit`, just like `getrandom`. Preserve the
    existing `HAVE_SYS_RANDOM_H` guard, ARM ASAN `memcpy` exclusion, and
    this source file's Clang conversion-warning policy. The C implementation
    and Flight cancellation logic are unchanged.
---
 be/src/glibc-compatibility/CMakeLists.txt | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/be/src/glibc-compatibility/CMakeLists.txt 
b/be/src/glibc-compatibility/CMakeLists.txt
index 116e0636893..fd9fc3cd5a3 100644
--- a/be/src/glibc-compatibility/CMakeLists.txt
+++ b/be/src/glibc-compatibility/CMakeLists.txt
@@ -45,9 +45,6 @@ if (GLIBC_COMPATIBILITY)
     endif ()
 
     list(REMOVE_ITEM glibc_compatibility_sources musl/getentropy.c)
-    if(HAVE_SYS_RANDOM_H)
-        list(APPEND glibc_compatibility_sources musl/getentropy.c)
-    endif()
 
     # lance_c is linked after this archive and introduces these libc references
     # too late for another archive scan. Keep the hidden version adapters in 
the
@@ -83,6 +80,16 @@ if (GLIBC_COMPATIBILITY)
             ${lance_compatibility_source}
         )
     endif()
+    if(HAVE_SYS_RANDOM_H)
+        # ASAN's weak getentropy interceptor prevents extracting our 
implementation
+        # from the static archive. Link it explicitly so calls do not reach a 
null
+        # real_getentropy on glibc < 2.25.
+        target_sources(glibc-compatibility-explicit PRIVATE musl/getentropy.c)
+        if (COMPILER_CLANG)
+            # Preserve the warning policy previously supplied by the archive 
target.
+            set_source_files_properties(musl/getentropy.c PROPERTIES 
COMPILE_OPTIONS -Wno-conversion)
+        endif()
+    endif()
     target_compile_options(glibc-compatibility-explicit PRIVATE -fPIC)
     add_library(glibc-compatibility STATIC ${glibc_compatibility_sources})
     target_compile_options(


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to