You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hide libunwind's _Unwind_* symbols under Bazel to fix bthread_tracer crash (#3297)
libunwind ships its `src/unwind/*.c` (the GCC `_Unwind_*`
ABI compatibility layer) as exported symbols of `libexternal_S~libunwind.so`.
At runtime the dynamic loader resolves `_Unwind_*` lookups (from
`pthread_exit`, libstdc++'s `__gxx_personality_v0`, etc.) to libunwind's
DWARF-based implementation instead of `libgcc_s.so.1`, hitting an
uninitialized internal context and crashing on the no-return cleanup chain
triggered by pthread_exit / C++ exception unwinding -- e.g. it makes
BthreadTest.bthread_exit segfault deterministically when
`--define=with_bthread_tracer=true` is on.
This is purely an ELF runtime symbol-resolution-order issue and reproduces
identically on GCC and Clang, since both default to `libstdc++ + libgcc_s`
on Linux.
启用 bthread tracer 后,可能在 `bthread_exit` / `pthread_exit` 或者 C++ 异常处理路径上偶发段错误,类似如下调用栈:
83
+
84
+
```text
85
+
#0 0x0000000000000000 in ?? ()
86
+
#1 0x00007fa2b5d6458a in _ULx86_64_dwarf_find_proc_info ()
87
+
from /root/.cache/bazel/_bazel_root/743b333b2429a1dbd390ef66b59c771d/execroot/_main/bazel-out/k8-fastbuild/bin/test/../_solib_k8/libexternal_Slibunwind~_Slibunwind.so
88
+
#2 0x00007fa2b5d6668d in fetch_proc_info ()
89
+
from /root/.cache/bazel/_bazel_root/743b333b2429a1dbd390ef66b59c771d/execroot/_main/bazel-out/k8-fastbuild/bin/test/../_solib_k8/libexternal_Slibunwind~_Slibunwind.so
90
+
#3 0x00007fa2b5d681a1 in _ULx86_64_dwarf_make_proc_info ()
91
+
from /root/.cache/bazel/_bazel_root/743b333b2429a1dbd390ef66b59c771d/execroot/_main/bazel-out/k8-fastbuild/bin/test/../_solib_k8/libexternal_Slibunwind~_Slibunwind.so
92
+
#4 0x00007fa2b5d70cfd in _ULx86_64_get_proc_info ()
93
+
from /root/.cache/bazel/_bazel_root/743b333b2429a1dbd390ef66b59c771d/execroot/_main/bazel-out/k8-fastbuild/bin/test/../_solib_k8/libexternal_Slibunwind~_Slibunwind.so
94
+
#5 0x00007fa2b5d6c775 in __libunwind_Unwind_GetLanguageSpecificData ()
95
+
from /root/.cache/bazel/_bazel_root/743b333b2429a1dbd390ef66b59c771d/execroot/_main/bazel-out/k8-fastbuild/bin/test/../_solib_k8/libexternal_Slibunwind~_Slibunwind.so
96
+
#6 0x00007fa2b503c6df in __gxx_personality_v0 () from /lib/x86_64-linux-gnu/libstdc++.so.6
97
+
#7 0x00007fa2b5452ce5 in ?? () from /lib/x86_64-linux-gnu/libgcc_s.so.1
98
+
#8 0x00007fa2b54533c0 in _Unwind_ForcedUnwind () from /lib/x86_64-linux-gnu/libgcc_s.so.1
99
+
#9 0x00007fa2b4ca57a4 in __GI___pthread_unwind (buf=<optimized out>) at ./nptl/unwind.c:130
100
+
#10 0x00007fa2b4c9dd22 in __do_cancel () at ../sysdeps/nptl/pthreadP.h:271
101
+
#11 __GI___pthread_exit (value=0x0) at ./nptl/pthread_exit.c:36
0 commit comments