Hello Alexey Serbin, Kudu Jenkins,

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/23038

to look at the new patch set (#4).

Change subject: [Rocky] Avoid hooking dl_iterate_phdr on Rocky to prevent ASan 
crashes
......................................................................

[Rocky] Avoid hooking dl_iterate_phdr on Rocky to prevent ASan crashes

In ASan builds on Rocky Linux, overriding dl_iterate_phdr can lead to
segmentation faults during early runtime initialization due to conflicts
with the sanitizer's internal usage of this symbol.

This patch introduces a new compile-time macro, __rocky__, to disable
the dl_iterate_phdr hook specifically for Rocky Linux environments.

The corresponding preprocessor condition has been updated to exclude the
hook if __rocky__ is defined, alongside other existing checks for
THREAD_SANITIZER and __APPLE__.

Crash stack trace observed during testing:

    Program received signal SIGSEGV, Segmentation fault.
    0x0000ffff741d7f0c in dl_iterate_phdr (
    callback=0xffff7fe95e20 <__asan::FindFirstDSOCallback(dl_phdr_info*,
    unsigned long, void*)>,data=0xffffe16df040)
    at /data/code/comm/kudu/src/kudu/util/debug/unwind_safeness.cc:157

This indicates a null function pointer call or an invalid override
due to uninitialized symbol resolution in ASan’s early setup phase.

Background references:

- https://sourceware.org/bugzilla/show_bug.cgi?id=19509
  Describes a glibc bug where `dlsym(RTLD_NEXT, ...)` may silently
  fail if the current shared object isn't referenced via DT_NEEDED.
  This can cause dynamic symbol lookups (like for `dl_iterate_phdr`)
  to return nullptr without triggering `dlerror()`, leading to
  hard-to-diagnose crashes.

- https://github.com/google/sanitizers/issues/915
  Explains how ASan itself calls `dl_iterate_phdr` during very early
  runtime initialization, before user-defined hooks or wrappers
  (like ours) are safe to execute. If these are invoked too early,
  they can crash due to unresolved symbols or unsafe execution state.

Disabling the hook on Rocky Linux 9 via __rocky__ ensures ASan builds
run safely without introducing subtle, non-deterministic crashes during
startup.

Change-Id: I5043e587c85dc18a37259f49b9c2f2008b3295ee
---
M CMakeLists.txt
M src/kudu/util/debug/unwind_safeness.cc
2 files changed, 23 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/38/23038/4
--
To view, visit http://gerrit.cloudera.org:8080/23038
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I5043e587c85dc18a37259f49b9c2f2008b3295ee
Gerrit-Change-Number: 23038
Gerrit-PatchSet: 4
Gerrit-Owner: KeDeng <[email protected]>
Gerrit-Reviewer: Alexey Serbin <[email protected]>
Gerrit-Reviewer: KeDeng <[email protected]>
Gerrit-Reviewer: Kudu Jenkins (120)

Reply via email to