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
If a C function contains a cleanup attribute and the source code is compiled with -fexceptions, then __gcc_personality_v0() will be called by the unwinder.
However, our __gcc_personality_v0() implementation in compiler-rt is not compatible with ARM EHABI. Consequently, the mismatch of the function signature will cause a segmentation fault.
$ cat cleanup.c
extern void my_throw();
int i = 0;
void callback(int *p) {
i = 1;
}
void test_cleanup() {
int a attribute((cleanup(callback))) = 1;
my_throw();
}
$ gdb ./bad.out
... skipped ...
Program received signal SIGSEGV, Segmentation fault.
0xb6f6e910 in unw_get_proc_info () from /opt/llvm/lib/libunwind.so.1
(gdb) bt
#0 0xb6f6e910 in unw_get_proc_info () from /opt/llvm/lib/libunwind.so.1
#1 0xb6f73c70 in _Unwind_GetLanguageSpecificData ()
from /opt/llvm/lib/libunwind.so.1
#2 0x000108fc in __gcc_personality_v0 ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb)
NOTE: There is a patch (written by Timon Van Overveldt) in the review process that can fix the problem: http://reviews.llvm.org/D15781
The text was updated successfully, but these errors were encountered:
I've spent much of today (thanks to poor Android native debugging) tracking down a crash on Android that seems to be this. If libc.so's _Unwind_Backtrace() gets called, I get the same crash:
#00 pc 00097122 libc++_shared.so (unw_get_proc_info+93)
#01 pc 000992ab libc++_shared.so (_Unwind_GetLanguageSpecificData+10)
#02 pc 00094c0f libc++_shared.so (__gxx_personality_v0+46)
#03 pc 0003c630 /system/lib/libc.so (__gnu_Unwind_Backtrace+152)
#04 pc 0003cb44 /system/lib/libc.so (_Unwind_Backtrace+20)
This happens due to system libraries that only link to libc.so calling _Unwind_Backtrace.
I haven't found any workaround for this, so I'll revert back to gnuc++ for now (and jump some other hoops for a library that doesn't work with that gnuc++, which was the reason I was trying to use this in the first place). This is the repro I isolated, FWIW:
Extended Description
If a C function contains a cleanup attribute and the source code is compiled with -fexceptions, then __gcc_personality_v0() will be called by the unwinder.
However, our __gcc_personality_v0() implementation in compiler-rt is not compatible with ARM EHABI. Consequently, the mismatch of the function signature will cause a segmentation fault.
$ cat cleanup.c
extern void my_throw();
int i = 0;
void callback(int *p) {
i = 1;
}
void test_cleanup() {
int a attribute((cleanup(callback))) = 1;
my_throw();
}
$ gdb ./bad.out
... skipped ...
Program received signal SIGSEGV, Segmentation fault.
0xb6f6e910 in unw_get_proc_info () from /opt/llvm/lib/libunwind.so.1
(gdb) bt
#0 0xb6f6e910 in unw_get_proc_info () from /opt/llvm/lib/libunwind.so.1
#1 0xb6f73c70 in _Unwind_GetLanguageSpecificData ()
from /opt/llvm/lib/libunwind.so.1
#2 0x000108fc in __gcc_personality_v0 ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb)
NOTE: There is a patch (written by Timon Van Overveldt) in the review process that can fix the problem:
http://reviews.llvm.org/D15781
The text was updated successfully, but these errors were encountered: