On Wed Oct 19 17:00:00 2022 +0000, Rémi Bernon wrote:
For the record, we discussed a bit more about that and it ends up that a C code compiled with `-fexceptions` also registers its pthread cleanup handlers into the personality routines. It would then eventually be possible to partially unwind stacks, and correctly execute and unregister the pthread handlers using standard stack unwinding logic (through libunwind or other), were we building everything with `-fexceptions`. There would still be potential issues when interacting with third-party C libraries built without that flag.
BTW, I doubt many libraries really use cleanup handlers, except glibc which already uses `-fexceptions`. So there's hope that's not a problem in practice.