[libcxx-commits] [PATCH] D89570: [Arm][Unwind][libc++abi] Add _Unwind_ForcedUnwind to EHABI.
Manoj Gupta via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Aug 24 12:26:56 PDT 2021
manojgupta added a comment.
@danielkiss
We have been trying to debug 1 issue on ARM32 Chrome OS devices related to pthread_cancel.
After some debugging, I found that glibc uses char[8] for the exception class [1] but libunwind is using uin64_t.
This causes crashes because of ABI mismatch when pthread_cancel calls Unwind routines.
e.g. look at the following code (*stop)(1, action, exception_object->exception_class, exception_object,
(_Unwind_Context *)(cursor), stop_parameter);
This mismatches the glibc's expected prototype for for unwind_stop in argument 3 (exception class should be char * vs uint64_t).
Here is some data I got from a sample program.
(gdb) bt
#0 unwind_stop (version=1, actions=10, exc_class=0x0, exc_obj=0x0, context=0xf74ff628, stop_parameter=0xf74fe648)
at unwind.c:44
#1 0xf7f77bdc in unwind_phase2_forced (uc=0xf74fe7d0, cursor=0xf74fe648, exception_object=0xf74ff628,
stop=0xf7fab3f1 <unwind_stop>, stop_parameter=0xf74fed78)
at /build/elm/tmp/portage/sys-libs/llvm-libunwind-13.0_pre428724-r2/work/llvm-libunwind-13.0_pre428724/libunwind/src/Unwind-EHABI.cpp:716
#2 0xf7f77df2 in _Unwind_ForcedUnwind (exception_object=0xf74ff628, stop=0xf7fab3f1 <unwind_stop>,
stop_parameter=0xf74fed78)
at /build/elm/tmp/portage/sys-libs/llvm-libunwind-13.0_pre428724-r2/work/llvm-libunwind-13.0_pre428724/libunwind/src/Unwind-EHABI.cpp:1100
#3 0xf7fab4d4 in __GI___pthread_unwind (buf=<optimized out>) at unwind.c:121
#4 0xf7fa22b0 in __do_cancel () at ./pthreadP.h:313
unwind_stop parameters show context=0xf74ff628, it should be the next value shown for stop_parameter instead i.e. 0xf74fe648.
(gdb) ptype exc_class
type = char *
this shows char * was expected in glibc instead of uint64_t.
[1] https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/arm/unwind.h;h=ffdea8047d5c6202bdc775548c27b640c36430ae;hb=HEAD#l194
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D89570/new/
https://reviews.llvm.org/D89570
More information about the libcxx-commits
mailing list