Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-33158

The macro MYSQL_THDVAR_ULONG leads to undefined behaviour, calling mysql_sys_var_long

    XMLWordPrintable

Details

    • Bug
    • Status: Confirmed (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.4(EOL), 10.5, 10.6, 10.7(EOL), 10.8(EOL), 10.9(EOL), 10.10(EOL), 10.11, 11.0(EOL), 11.1(EOL), 11.2, 11.3(EOL)
    • 10.5, 10.6, 10.11, 11.2
    • Embedded Server, Server

    Description

      Now that MDEV-26272 has been fixed and a cmake -DWITH_UBSAN=ON build with clang can pass the server bootstrap, we can find more undefined behaviour that is not flagged by GCC. Here is an example:

      10.4 832e96deb6f368591dcb35a4fa33b2fd770aa17a

      /mariadb/10.4/storage/innobase/handler/ha_innodb.cc:1821:9: runtime error: call to function mysql_sys_var_long(THD*, int) through pointer to incorrect function type 'unsigned long *(*)(THD *, int)'
      

      This is flagged for the function thd_lock_wait_timeout(), which simply accesses a data member that has been defined as follows:

      static MYSQL_THDVAR_ULONG(lock_wait_timeout, PLUGIN_VAR_RQCMDARG,
        "Timeout in seconds an InnoDB transaction may wait for a lock before being rolled back. Values above 100000000 disable the timeout.",
        NULL, NULL, 50, 0, 1024 * 1024 * 1024, 0);
      // ...
      static struct st_mysql_sys_var* innobase_system_variables[]= {
      // ...
        MYSQL_SYSVAR(lock_wait_timeout),
      // ...
        NULL
      };
      maria_declare_plugin(innobase)
      {
      // ...
      innobase_system_variables
      // ...
      },
      // ...
      maria_declare_plugin_end;
      

      Attachments

        Issue Links

          Activity

            People

              bnestere Brandon Nesterenko
              marko Marko Mäkelä
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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