Open jforissier opened 4 years ago
After some investigation and reading the ftrace code again, the error is not surprising. The C++ runtime needs to unwind the stack to propagate exceptions. When doing so, it assumes a "standard" stack layout. When ftrace is enabled however, the stack is modified which is why the unwinder can't find an exception handler and aborts the program.
The linux kernel ftrace uses a similar mechanism to intercept function returns, see this patch: [1] https://lore.kernel.org/patchwork/patch/709315/ which is part of a series that makes the unwinder ftrace-aware. Our unwinder in ldelf
seems to be aware of ftrace, too (ftrace_map_lr()
).
Unfortunately, modifying the C++ unwinder to make it ftrace-aware is impossible in our case. It seems our only option is to document that function tracing and C++ exception handling are incompatible, and skip the test :cry:
@b49020 FYI and valuable comments :wink:
Thanks @jforissier for the notification. I will try to look into this issue.
When OP-TEE is built with function tracing enabled and the TA is instrumented (
-pg
compiler flag), the C/C++ mixed frame exception test fails with anabort()
triggered by the C++ runtime.