Skip to content

Exception state can be saved to incorrect thread in 1.88 #323

Description

@zhykzhykzhyk

The manage_exception_state try to save and restore the exception state from/to the current thread that executing the fiber, but only one __cxa_get_globals() call is generated for the outer function after optimization, which would be incorrect if fiber resume on another thread.

class manage_exception_state {
public:
manage_exception_state() {
exception_state_ = *__cxa_get_globals();
}
~manage_exception_state() {
*__cxa_get_globals() = exception_state_;
}
private:
__cxa_eh_globals exception_state_;
};

Result from compiler explorer

// check disassembly of this function
void foo(boost::context::fiber&& f) { std::move(f).resume(); }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions