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

GCC 13: sql/sys_vars.inl: runtime error: store to address ... with insufficient space for an object of type ...

    XMLWordPrintable

Details

    Description

      When I compile the server with GCC 13.1.0, tests fail massively due to UBSAN errors on static initialization like the following:

      static Sys_var_mybool Sys_automatic_sp_privileges(
             "automatic_sp_privileges",
             "Creating and dropping stored procedures alters ACLs",
             GLOBAL_VAR(sp_automatic_privileges),
             CMD_LINE(OPT_ARG), DEFAULT(TRUE));
      

      If I compile with GCC 12.3.0, no error is reported.

      The minimal steps to reproduce this should be as follows:

      cmake -DWITH_UBSAN=ON -DMYSQL_MAINTAINER_MODE=WARN /mariadb/10.5
      cmake --build .
      sql/mariadbd --no-defaults --wrong-option
      

      The output that I am seeing is as follows:

      10.5 055f2e308bf1dd4026df65093a1166526ac35d9b

      /mariadb/10.5/sql/sys_vars.inl:193:18: runtime error: store to address 0x55bf69c88ec8 with insufficient space for an object of type 'uchar'
      0x55bf69c88ec8: note: pointer points here
       00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00
                    ^ 
      /mariadb/10.5/sql/sys_vars.inl:193:18: runtime error: store to address 0x55bf69c88e48 with insufficient space for an object of type 'uchar'
      0x55bf69c88e48: note: pointer points here
       00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00
                    ^ 
      /mariadb/10.5/sql/sys_vars.inl:520:28: runtime error: store to address 0x55bf69409930 with insufficient space for an object of type 'uchar'
      0x55bf69409930: note: pointer points here
       00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00
                    ^ 
      /mariadb/10.5/sql/sys_vars.inl:193:18: runtime error: store to address 0x55bf6940c758 with insufficient space for an object of type 'uchar'
      0x55bf6940c758: note: pointer points here
       00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00
                    ^ 
      /mariadb/10.5/sql/sys_vars.inl:1839:8: runtime error: load of address 0x55bf6940c728 with insufficient space for an object of type 'uchar'
      0x55bf6940c728: note: pointer points here
       00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 80 00 00 00 00 00 00  00 00 00 00
                    ^ 
      /mariadb/10.5/sql/sys_vars.inl:1839:26: runtime error: store to address 0x55bf6940c728 with insufficient space for an object of type 'uchar'
      0x55bf6940c728: note: pointer points here
       00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 80 00 00 00 00 00 00  00 00 00 00
                    ^ 
      /mariadb/10.5/sql/sys_vars.inl:389:22: runtime error: store to address 0x55bf690c57b0 with insufficient space for an object of type 'uchar'
      0x55bf690c57b0: note: pointer points here
       ff ff ff 7f  02 00 00 00 00 00 00 00  00 04 00 00 00 00 00 00  09 00 00 00 ff ff ff ff  fe fe 08 02
                    ^ 
      /mariadb/10.5/sql/sys_vars.inl:827:35: runtime error: store to address 0x55bf6940c8e8 with insufficient space for an object of type 'size_t'
      0x55bf6940c8e8: note: pointer points here
       bf 55 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00
                    ^ 
      /mariadb/10.5/sql/sys_vars.inl:827:35: runtime error: store to address 0x55bf6940c8d8 with insufficient space for an object of type 'size_t'
      0x55bf6940c8d8: note: pointer points here
       bf 55 00 00  00 00 00 00 00 00 00 00  13 16 22 67 bf 55 00 00  00 00 00 00 00 00 00 00  00 00 00 00
                    ^ 
      /mariadb/10.5/sql/sys_vars.inl:193:18: runtime error: store to address 0x55bf6940c844 with insufficient space for an object of type 'uchar'
      0x55bf6940c844: note: pointer points here
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
                    ^ 
      /mariadb/10.5/sql/sys_vars.inl:1413:26: runtime error: store to address 0x55bf6940c768 with insufficient space for an object of type 'uchar'
      0x55bf6940c768: note: pointer points here
       00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00
                    ^ 
      /mariadb/10.5/sql/sys_vars.inl:193:18: runtime error: store to address 0x55bf69420c64 with insufficient space for an object of type 'uchar'
      0x55bf69420c64: note: pointer points here
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  13 16 22 67 bf 55 00 00  00 00 00 00 00 00 00 00
                    ^ 
      2023-07-31 13:00:44 0 [Warning] Can't create test file /usr/local/mysql/data/jyty.lower-test
      /dev/shm/10.5u/sql/mariadbd: Can't change dir to '/usr/local/mysql/data/' (Errcode: 2 "No such file or directory")
      2023-07-31 13:00:44 0 [ERROR] Aborting
      /mariadb/10.5/sql/sys_vars.inl:526:14: runtime error: load of address 0x55bf6940c850 with insufficient space for an object of type 'uchar'
      0x55bf6940c850: note: pointer points here
       00 00 00 00  00 00 00 00 00 00 00 00  00 01 00 01 00 01 00 00  00 00 00 00 00 00 00 00  00 00 00 00
                    ^ 
      /mariadb/10.5/sql/sys_vars.inl:527:25: runtime error: store to address 0x55bf6940c850 with insufficient space for an object of type 'uchar'
      0x55bf6940c850: note: pointer points here
       00 00 00 00  00 00 00 00 00 00 00 00  00 01 00 01 00 01 00 00  00 00 00 00 00 00 00 00  00 00 00 00
                    ^ 
      

      It could be worthwhile to test this on clang as well, once MDEV-26272 has been fixed.

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              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.