Repository navigation
branch-4.1.4: [fix](thirdparty) Upgrade libunwind to 1.8.3 to fix aarch64 BE startup crash on 64 KiB-page kernels - #68507
Merged
morningman merged 1 commit intoSep 25, 2026
Conversation
…ch64 BE startup crash on 64 KiB-page kernels Cherry-picked from apache#67877 (master e797e99), via its branch-4.1 pick apache#68339 (commit 5e1ee24). Conflict resolution on this branch: two files differ from branch-4.1. - `thirdparty/CHANGELOG.md`: this branch has not taken the `## 20260901` thrift 0.16.0 -> 0.24.0 entry (nor master's `## 20260909` snappy one), so only the `## 20260911` libunwind entry is inserted, above `## 20260429`. - `thirdparty/patches/libunwind-1.8.3-doris-phdr-cache.patch`: this branch still carries the pre-apache#67564 1.6.2 patch, and a patch file has no mergeable content, so the new file is taken wholesale from the branch-4.1 pick. It is now byte-identical to the branch-4.1 and master versions. The remaining five files applied without conflict. `thirdparty/vars.sh`, `thirdparty/build-thirdparty.sh`, `thirdparty/download-thirdparty.sh` and `.github/workflows/build-thirdparty.yml` still differ from branch-4.1, but only by thirdparty drift this branch has not taken (thrift 0.24.0, aws-sdk-cpp 1.11.221, simdutf, google-cloud-cpp, lance-c 0.1.9, jemalloc); no hunk of this change is affected, and `thirdparty/test/libunwind-page-size-test.sh` is byte-identical. Release note: Fix the aarch64 BE crashing before `main()` (SIGSEGV in `access_mem`/`is_plt_entry` under `unw_backtrace`) on 64 KiB-page kernels such as Kunpeng 920 with Kylin, openEuler or CentOS, by upgrading the bundled libunwind from 1.6.2 to 1.8.3. (cherry picked from commit 5e1ee24)
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cherry-picked from #67877 (master commit
e797e99fcbe) via its branch-4.1 pick #68339 (commit5e1ee245e23) tobranch-4.1.4.Conflict resolution. This branch is a 2026-09-04 cut of branch-4.1, so two of the seven files differed:
thirdparty/CHANGELOG.md: branch-4.1's## 20260901thrift 0.16.0 → 0.24.0 entry is not on this branch (it still pins thrift 0.16.0), and neither is master's## 20260909snappy 1.2.1 entry. Only the## 20260911libunwind entry is inserted, above## 20260429.thirdparty/patches/libunwind-1.8.3-doris-phdr-cache.patch: this branch still carries the pre-branch-4.1: [fix](thirdparty) Repair the libunwind phdr-cache patch mangled in the #64093 backport #67564 1.6.2 patch, and a patch file has no mergeable content, so the new file is taken wholesale from the branch-4.1 pick. It is byte-identical to the branch-4.1 and master versions.The other five files applied without conflict.
thirdparty/vars.sh,thirdparty/build-thirdparty.sh,thirdparty/download-thirdparty.shand.github/workflows/build-thirdparty.ymlstill differ from branch-4.1, but only by thirdparty drift this branch has not taken (thrift 0.24.0, aws-sdk-cpp 1.11.221, simdutf, google-cloud-cpp, lance-c 0.1.9, jemalloc); no hunk of this change is affected.thirdparty/test/libunwind-page-size-test.shand the rebased patch are byte-identical to master's.What problem does this PR solve?
Related PRs: #64093, #67877, #68339
Problem Summary:
Every aarch64 BE built from branch-4.1.4 since 4.1.4-rc01 crashes before
main()on a 64 KiB-page kernel (Kunpeng 920 + Kylin V10 / openEuler / CentOS aarch64, the common ARM server stack). The core from the 4.1.4 arm64 deployment shows:SIGSEGV with
si_addr=0, AUXVPAGESZ=65536, and inside the libunwind cursorip=0,validate=0,mem_validate_func=msync_validate,last_good_addr[]={0,0,0,0}.How it happens:
USE_UNWIND=ONon Linux, referencesunw_*fromphdr_cache.cppwithout the__x86_64__guard, and builds jemalloc with--enable-prof-libunwind). libunwind's weakbacktracealias then replaces glibc'sbacktrace()for every caller in the process: bRPC's pre-main warm-up,StackTrace::tryCapture()on aarch64, jemalloc heap profiling. The 4.1.3 arm64 package was immune only because it was built withUSE_UNWIND=OFF(which the ARM compilation doc still prescribes and [Enhancement](BE) Make print stack API more stable #64093 removed): it hasbacktrace@GLIBC_2.17and zero_ULaarch64_*symbols.PAGE_SIZE 4096insrc/aarch64/Ginit.c. On a 64 KiB-page kernelmincore()/msync()reject its 4 KiB-aligned probes withEINVAL, sovalidate_mem()fails for 15/16 of all addresses (the core'smsync_validate+ emptylast_good_addrare exactly this).unw_step()therefore getsunw_is_signal_frame() < 0for a valid IP, takes the "IP points to non-mapped memory, use LR" recovery path and loadsuc.regs[30]— a slot_Uaarch64_getcontext_tracenever writes (it saves only FP/SP/PC). On the reporting host that stack garbage is 0.dwarf_step(ip=0)finds nothing, and the fallback callsis_plt_entry()withc->validaterestored to 0, soaccess_memexecutesldr x8, [x1]withx1=0.The PHDR cache being empty before
main()is not what breaks this (step 3 has already poisonedipbefore any FDE lookup, and the same crash reproduces without the Doris hook); changing the cache initialisation order would not fix it, and every laterbacktrace()on such a host rolls the same dice.Changes
Fix: upgrade libunwind 1.6.2 → 1.8.3, which was never bumped since it was introduced in 2023 (#21938):
unw_page_size = sysconf(_SC_PAGESIZE)instead of the hard-coded 4096.src/mi/Gaddress_validator.cvalidates through the pipe-write probe only, somincore/msyncalignment no longer matters at all;unw_step()setsc->validate = 1before the DWARF-failure fallback, so a garbage IP is rejected instead of dereferenced.Specifically:
thirdparty/vars.sh: libunwind 1.6.2 → 1.8.3 (md513bc7b41462ac6ea157d350eaf6c1503).thirdparty/patches/libunwind-1.8.3-doris-phdr-cache.patch: the [Enhancement](BE) Make print stack API more stable #64093 hook rebased onto 1.8.3'sas->iterate_phdr_functioncall site; semantics unchanged (doris_unwind_iterate_phdrstill takes precedence whenever it is linked in). 1.8 also exposesunw_set_iterate_phdr_function(), which could replace the source patch in a follow-up.thirdparty/build-thirdparty.sh:--disable-tests --disable-documentation; onlylibunwind.ais consumed.thirdparty/test/libunwind-page-size-test.sh(+ run at the end of the Linux thirdparty CI build): reproduces the failure on any Linux host. AnLD_PRELOADshim gives libunwind a 64 KiB-page kernel's behaviour (EINVALfor unalignedmincore/msync,sysconf(_SC_PAGESIZE)=65536), and a program shaped like the bRPC warm-up callsbacktrace()from a constructor with a zeroed stack. Against 1.6.2 it segfaults with the customer's exact stack and cursor state; against 1.8.3 it passes.No BE source change: every
unw_*API the BE, jemalloc and the x86_64 stack-trace code use is unchanged in 1.8.3,cxx_exceptionsstays off on x86_64/aarch64, and the weakbacktracealias is still provided.Release note
Fix the aarch64 BE crashing before
main()(SIGSEGV inaccess_mem/is_plt_entryunderunw_backtrace) on 64 KiB-page kernels such as Kunpeng 920 with Kylin, openEuler or CentOS, by upgrading the bundled libunwind from 1.6.2 to 1.8.3.Check List (For Author)
Test
thirdparty/test/libunwind-page-size-test.sh(1.6.2 FAIL, 1.8.3 PASS on aarch64 and x86_64) were verified;Build Third Party Libraries (Linux),(macOS),(macOS-arm64)andThirdparty Script Testpassed there.libunwind-1.8.3-doris-phdr-cache.patchandthirdparty/test/libunwind-page-size-test.share byte-identical to master's;bash -npasses on the four touched scripts; no stalelibunwind-1.6.2reference remains in the tree.doris_berebuilt with 1.8.3 on a real 64 KiB-page host. That is the one check that still needs an aarch64 machine.Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)