Uploaded image for project: 'MariaDB Connector/C'
  1. MariaDB Connector/C
  2. CONC-553

SIGBUS when calling mysql_real_connect_start on ARM64 macOS

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • 3.1.12
    • 3.1.17
    • API
    • None
    • macOS 11.4 on M1, libmariadb installed with Vcpkg, clang-1205.0.22.9

    Description

      A simple program like this will cause SIGBUS:

          MYSQL mysql;
          mysql_init(&mysql);
          auto r = mysql_options(&mysql, MYSQL_OPT_NONBLOCK, nullptr);
          MYSQL *ret = nullptr;
          mysql_real_connect_start(&ret,
                                   &mysql,
                                   "127.0.0.1",
                                   "root",
                                   "root",
                                   "mysql",
                                   3306,
                                   nullptr,
                                   0);
      

      It actually won't produce any stack trace but with single step in IDE, the crash actually produced at swapcontext in my_context_continue.
      Might related to MDEV-9112

      Update: It's because _XOPEN_SOURCE macro caused stack struct change in macOS. But someone defined _XOPEN_SOURCE in the source file instead of in CMakefile.txt.
      Ref: https://stackoverflow.com/questions/23852522/swapcontext-segfaults-when-swapping-to-a-ucontext-ts-uc-link

      Attachments

        Activity

          People

            georg Georg Richter
            kotori kotori
            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.