Details

    • New Feature
    • Status: Closed (View Workflow)
    • Trivial
    • Resolution: Fixed
    • None
    • 3.3.15
    • Non blocking API
    • None

    Description

      For correctness of AddressSanitizer stack-use-after-return detection one has to annotate swapcontext calls with those when implementing their own fibers.

      Since stack-use-after-return is enabled by default in recent clang-15 release (when compiling with -fsanitize=address that is), would be great to see this feature supported by mariadb-connector-c.

      Attachments

        Activity

          The address sanitiser API with __sanitizer_start_switch_fiber() and __sanitizer_finish_switch_fiber() is hard to use in the custom assembler used in the efficient co-routine implementation of the non-blocking library. These routines call directly into the target function after switching the stack, there isn't really a good place for a call to __sanitizer_finish_switch_fiber().

          Instead, what I will do is to detect if AddressSanitizer is enabled, and in this case switch to one of the fallback system co-routine implementations (boost::context or ucontext), which should have the required instrumentation. This should solve the problem.

          The ucontext fallback is used by default, the boost::context can be used instead by running cmake with -DWITH_BOOST_CONTEXT=ON in addition to -DWITH_ASAN=YES.

          knielsen Kristian Nielsen added a comment - The address sanitiser API with __sanitizer_start_switch_fiber() and __sanitizer_finish_switch_fiber() is hard to use in the custom assembler used in the efficient co-routine implementation of the non-blocking library. These routines call directly into the target function after switching the stack, there isn't really a good place for a call to __sanitizer_finish_switch_fiber(). Instead, what I will do is to detect if AddressSanitizer is enabled, and in this case switch to one of the fallback system co-routine implementations (boost::context or ucontext), which should have the required instrumentation. This should solve the problem. The ucontext fallback is used by default, the boost::context can be used instead by running cmake with -DWITH_BOOST_CONTEXT=ON in addition to -DWITH_ASAN=YES.

          Merged to 3.3

          knielsen Kristian Nielsen added a comment - Merged to 3.3

          People

            knielsen Kristian Nielsen
            i.trofimow Ivan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.