HappenLee opened a new pull request, #68217:
URL: https://github.com/apache/doris/pull/68217
### What problem does this PR solve?
Issue Number: N/A
Related PR: #64093
Problem Summary:
With `ASAN_OPTIONS=fast_unwind_on_malloc=0`, an ASAN BE can abort before
`main`, including when running `doris_be --version`. OpenMP initialization
reached from OpenBLAS probes optional symbols with `dlsym`. On affected glibc
versions, a subsequent lookup frees the previous `dlerror` string before
clearing its pointer. ASAN's free interceptor collects a slow stack, which
reaches Doris' global `dl_iterate_phdr` interposer. Its fallback calls `dlsym`
again, reenters the pending error cleanup and frees the same string twice.
Exclude only the global `dl_iterate_phdr` interposer from ASAN builds. ASAN
then uses the system implementation without reentering `dlsym` through Doris.
Keep the PHDR snapshot and dedicated `doris_unwind_iterate_phdr` hook for GNU
libunwind; non-ASAN interposition is unchanged.
Add an ASAN subprocess regression that re-execs with slow unwinding enabled
and performs two failed symbol lookups without consuming `dlerror` between
them. Adapt the existing late-`dlopen` test to assert that ASAN keeps the live
system view even inside `ScopedPHDRCacheRead`, while the dedicated GNU hook
still uses the snapshot.
### Release note
Fix an ASAN BE startup double-free when allocation/free stack collection
uses slow unwinding.
### Check List (For Author)
- Test
- [ ] Regression test
- [ ] Unit Test execution: added a subprocess regression and updated the
PHDR cache test; full local execution is blocked by the installed AWS SDK
missing `aws/core/auth/GeneralHTTPCredentialsProvider.h` while compiling
unchanged `common/cpp/aws_common.cpp`.
- [x] Manual test:
- Compiled the actual pre-fix and fixed `phdr_cache.cpp` into the
same ASAN startup reproducer (two failed `dlsym` calls,
`fast_unwind_on_malloc=0`): pre-fix reports double-free; fixed reaches `main`.
- OpenMP initialization from a pre-main constructor with the fixed
source and slow unwinding: passed.
- Live-loader versus PHDR snapshot checks in ASAN and non-ASAN
standalone probes, including a late-loaded DSO and cache refresh: passed.
- Updated unit-test source syntax check: passed.
- clang-format 16, build hygiene and clang-tidy checks on all three
changed files: passed.
- Full local test command attempted: `./run-be-ut.sh -j 48 --run
--filter='PhdrCache*'` (ASAN; dependency failure noted above).
- Behavior changed:
- [x] Yes. ASAN uses the system `dl_iterate_phdr` even inside a scoped
cache read; its dedicated GNU libunwind hook remains cached. Non-ASAN behavior
is unchanged.
- Does this need documentation?
- [x] No. Internal sanitizer compatibility fix; the source API comment
documents the ASAN exception.
### 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]