gavinchou opened a new pull request, #67316: URL: https://github.com/apache/doris/pull/67316
### What problem does this PR solve? Issue Number: None Related PR: #65749 Problem Summary: Several FDB-related CloudUT ASAN binaries can terminate with a zero-page SEGV in `libfdb_c.so`. The existing runner fallback from #65749 prevents the overall job from failing when the log contains both ASAN output and `libfdb_c.so`, but it does not fix the binary or guarantee that its GoogleTest cases actually ran. This PR fixes the underlying symbol-resolution failure. ### Root cause 1. CloudUT ASAN executables are compiled against glibc 2.27, where `getentropy` exists, and run on workers with glibc 2.17, where it does not. 2. Compiler-rt links a `getentropy` ASAN interceptor into each executable. `libfdb_c` checks `getentropy` as an optional weak symbol during FDB network initialization, so the interceptor makes the availability check succeed. 3. The interceptor tries to forward the call to libc, but `dlsym(RTLD_NEXT, "getentropy")` resolves to null on glibc 2.17. 4. The call therefore jumps to address zero, producing `AddressSanitizer:DEADLYSIGNAL`, `pc=0`, and a non-zero test-binary result. An A/B diagnostic CloudUT run ([build 52882](http://47.243.177.214:8111/buildConfiguration/SelectdbCore_Cloudut/52882)) observed the full chain: - compile-time glibc 2.27 and runtime glibc 2.17; - native `getentropy` resolved to `__interceptor_trampoline_getentropy`; - `RTLD_NEXT getentropy` resolved to null; - the native probe reproduced the zero-page SEGV; - a probe exporting a strong syscall-backed `getentropy` was called during FDB network startup and completed successfully. Changing `fdb_external_client_directory` and aligning FDB client/server versions were also tested independently; neither changed the failure. This ruled out FDB client selection and protocol-version compatibility. ### Why this fix works - A strong `getentropy` implementation is linked directly into Linux ASAN CloudUT executables that link or initialize FDB. - `ENABLE_EXPORTS` puts the executable symbol in the dynamic symbol table, so `libfdb_c.so` resolves `getentropy` to this implementation instead of the unusable ASAN trampoline. - The implementation calls `SYS_getrandom` directly, avoiding both libc `getentropy` and libc `getrandom` interceptor paths. - It preserves the `getentropy(3)` 256-byte limit, retries interrupted operations, and falls back to `/dev/urandom` when the running kernel reports `ENOSYS`. - The compatibility object is limited to Linux ASAN unit tests. Production binaries, non-ASAN builds, FDB versions, and FDB configuration are unchanged. The BE glibc-compatibility objects cannot be reused directly here because Cloud is a separate CMake project and does not link them. That implementation also delegates to `getrandom`, while this workaround deliberately uses a direct syscall to avoid another interceptor dependency. ### What is changed? - Add a Linux ASAN test-only, syscall-backed `getentropy` implementation. - Export it from the FDB-linked/FDB-initializing CloudUT executables. - Keep the existing FDB client version, external-client configuration, and test runner unchanged. ### Testing - A/B CloudUT build 52882: native probe reproduced the zero-page crash; the strong-symbol probe passed and recorded the FDB network call. - CloudUT [build 53003](http://47.243.177.214:8111/buildConfiguration/SelectdbCore_Cloudut/53003): all four previously crashing binaries returned raw `ret=0`; their 1 + 19 + 22 + 24 FDB tests (66 total) passed without invoking ASAN-result masking. - Apache Doris master CloudUT on this PR: pending. - Local checks: - clang-format 16 dry-run; - C11 `-Wall -Wextra -Werror` syntax checks for both the fallback and `SYS_getrandom` paths; - CMake target-existence check; - `git diff --check`. ### Release note None ### Check List (For Author) - Test - [ ] Regression test - [x] Unit Test - [ ] Manual test (add detailed scripts or steps below) - [ ] No need to test or manual test. Explain why: - [ ] This is a refactor/code format and no logic has been changed. - [ ] Previous test can cover this change. - [ ] No code files have been changed. - [ ] Other reason - Behavior changed: - [x] No. Production binaries and FDB configuration are unchanged. - [ ] Yes. - Does this need documentation? - [x] No. - [ ] Yes. ### Check List (For Reviewer who merge this PR) - [ ] Confirm the release note - [ ] Confirm test cases - [ ] Confirm document - [ ] Add branch pick label -- 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]
