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

MSAN errors in TXTFAM::GetFileLength upon creating or writing into Connect table

    XMLWordPrintable

Details

    Description

      I didn't check 10.4 as it's not MSAN-capable.

      INSTALL SONAME 'ha_connect';
      CREATE TABLE t (id INT, PRIMARY KEY (id)) ENGINE=Connect TABLE_TYPE=DOS;
       
      # Cleanup
      DROP TABLE t;
      UNINSTALL SONAME 'ha_connect';
      

      10.5 b04af64882f MSAN

      2023-10-10 19:48:22 4 [Note] CONNECT: Version 1.07.0002 March 22, 2021
      ==2192128==WARNING: MemorySanitizer: use-of-uninitialized-value
          #0 0x7fe5337587e8 in TXTFAM::GetFileLength(_global*) /data/src/10.5-msan/storage/connect/filamtxt.cpp:215:9
          #1 0x7fe53375bb2f in DOSFAM::GetFileLength(_global*) /data/src/10.5-msan/storage/connect/filamtxt.cpp:513:19
          #2 0x7fe53380e9b4 in TDBDOS::ResetTableOpt(_global*, bool, bool) /data/src/10.5-msan/storage/connect/tabdos.cpp:571:8
          #3 0x7fe5336c0841 in ha_connect::optimize(THD*, st_ha_check_opt*) /data/src/10.5-msan/storage/connect/ha_connect.cc:3593:30
          #4 0x7fe5336d670b in ha_connect::create(char const*, TABLE*, HA_CREATE_INFO*) /data/src/10.5-msan/storage/connect/ha_connect.cc:6956:20
          #5 0x561d54f1908f in handler::ha_create(char const*, TABLE*, HA_CREATE_INFO*) /data/src/10.5-msan/sql/handler.cc:5175:14
          #6 0x561d54f1fc13 in ha_create_table(THD*, char const*, char const*, char const*, HA_CREATE_INFO*, st_mysql_const_unsigned_lex_string*) /data/src/10.5-msan/sql/handler.cc:5643:22
          #7 0x561d54622734 in create_table_impl(THD*, st_mysql_const_lex_string const&, st_mysql_const_lex_string const&, st_mysql_const_lex_string const&, st_mysql_const_lex_string const&, char const*, DDL_options_st, HA_CREATE_INFO*, Alter_info*, int, bool*, st_key**, unsigned int*, st_mysql_const_unsigned_lex_string*) /data/src/10.5-msan/sql/sql_table.cc:5365:11
          #8 0x561d5461f436 in mysql_create_table_no_lock(THD*, Table_specification_st*, Alter_info*, bool*, int, TABLE_LIST*) /data/src/10.5-msan/sql/sql_table.cc:5449:8
          #9 0x561d54624961 in mysql_create_table(THD*, TABLE_LIST*, Table_specification_st*, Alter_info*) /data/src/10.5-msan/sql/sql_table.cc:5607:7
          #10 0x561d54679b19 in Sql_cmd_create_table_like::execute(THD*) /data/src/10.5-msan/sql/sql_table.cc:12389:12
          #11 0x561d5429ad2a in mysql_execute_command(THD*) /data/src/10.5-msan/sql/sql_parse.cc:6085:26
          #12 0x561d542824e7 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.5-msan/sql/sql_parse.cc:8120:18
          #13 0x561d54275a63 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.5-msan/sql/sql_parse.cc:1891:7
          #14 0x561d54284488 in do_command(THD*) /data/src/10.5-msan/sql/sql_parse.cc:1375:17
          #15 0x561d54884bcf in do_handle_one_connection(CONNECT*, bool) /data/src/10.5-msan/sql/sql_connect.cc:1416:11
          #16 0x561d548842c5 in handle_one_connection /data/src/10.5-msan/sql/sql_connect.cc:1318:5
          #17 0x561d55c9d18a in pfs_spawn_thread /data/src/10.5-msan/storage/perfschema/pfs.cc:2201:3
          #18 0x7fe53b874fd3 in start_thread nptl/./nptl/pthread_create.c:442:8
          #19 0x7fe53b8f55bb in clone3 misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
       
        Uninitialized value was created by an allocation of 'st' in the stack frame of function '_filelength'
          #0 0x7fe533707fa0 in _filelength /data/src/10.5-msan/storage/connect/osutil.c:126
       
      SUMMARY: MemorySanitizer: use-of-uninitialized-value /data/src/10.5-msan/storage/connect/filamtxt.cpp:215:9 in TXTFAM::GetFileLength(_global*)
      Exiting
      

      With FIX table type:

      2023-10-10 19:48:46 4 [Note] CONNECT: Version 1.07.0002 March 22, 2021
      ==2192296==WARNING: MemorySanitizer: use-of-uninitialized-value
          #0 0x7f2e581587e8 in TXTFAM::GetFileLength(_global*) /data/src/10.5-msan/storage/connect/filamtxt.cpp:215:9
          #1 0x7f2e5815bb2f in DOSFAM::GetFileLength(_global*) /data/src/10.5-msan/storage/connect/filamtxt.cpp:513:19
          #2 0x7f2e581588b3 in TXTFAM::Cardinality(_global*) /data/src/10.5-msan/storage/connect/filamtxt.cpp:238:15
          #3 0x7f2e58238564 in TDBFIX::Cardinality(_global*) /data/src/10.5-msan/storage/connect/tabfix.cpp:204:22
          #4 0x7f2e58237ccc in TDBFIX::ResetTableOpt(_global*, bool, bool) /data/src/10.5-msan/storage/connect/tabfix.cpp:138:3
          #5 0x7f2e580c0841 in ha_connect::optimize(THD*, st_ha_check_opt*) /data/src/10.5-msan/storage/connect/ha_connect.cc:3593:30
          #6 0x7f2e580d670b in ha_connect::create(char const*, TABLE*, HA_CREATE_INFO*) /data/src/10.5-msan/storage/connect/ha_connect.cc:6956:20
          #7 0x5599755e908f in handler::ha_create(char const*, TABLE*, HA_CREATE_INFO*) /data/src/10.5-msan/sql/handler.cc:5175:14
          #8 0x5599755efc13 in ha_create_table(THD*, char const*, char const*, char const*, HA_CREATE_INFO*, st_mysql_const_unsigned_lex_string*) /data/src/10.5-msan/sql/handler.cc:5643:22
          #9 0x559974cf2734 in create_table_impl(THD*, st_mysql_const_lex_string const&, st_mysql_const_lex_string const&, st_mysql_const_lex_string const&, st_mysql_const_lex_string const&, char const*, DDL_options_st, HA_CREATE_INFO*, Alter_info*, int, bool*, st_key**, unsigned int*, st_mysql_const_unsigned_lex_string*) /data/src/10.5-msan/sql/sql_table.cc:5365:11
          #10 0x559974cef436 in mysql_create_table_no_lock(THD*, Table_specification_st*, Alter_info*, bool*, int, TABLE_LIST*) /data/src/10.5-msan/sql/sql_table.cc:5449:8
          #11 0x559974cf4961 in mysql_create_table(THD*, TABLE_LIST*, Table_specification_st*, Alter_info*) /data/src/10.5-msan/sql/sql_table.cc:5607:7
          #12 0x559974d49b19 in Sql_cmd_create_table_like::execute(THD*) /data/src/10.5-msan/sql/sql_table.cc:12389:12
          #13 0x55997496ad2a in mysql_execute_command(THD*) /data/src/10.5-msan/sql/sql_parse.cc:6085:26
          #14 0x5599749524e7 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.5-msan/sql/sql_parse.cc:8120:18
          #15 0x559974945a63 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.5-msan/sql/sql_parse.cc:1891:7
          #16 0x559974954488 in do_command(THD*) /data/src/10.5-msan/sql/sql_parse.cc:1375:17
          #17 0x559974f54bcf in do_handle_one_connection(CONNECT*, bool) /data/src/10.5-msan/sql/sql_connect.cc:1416:11
          #18 0x559974f542c5 in handle_one_connection /data/src/10.5-msan/sql/sql_connect.cc:1318:5
          #19 0x55997636d18a in pfs_spawn_thread /data/src/10.5-msan/storage/perfschema/pfs.cc:2201:3
          #20 0x7f2e603dbfd3 in start_thread nptl/./nptl/pthread_create.c:442:8
          #21 0x7f2e6045c5bb in clone3 misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
       
        Uninitialized value was created by an allocation of 'st' in the stack frame of function '_filelength'
          #0 0x7f2e58107fa0 in _filelength /data/src/10.5-msan/storage/connect/osutil.c:126
       
      SUMMARY: MemorySanitizer: use-of-uninitialized-value /data/src/10.5-msan/storage/connect/filamtxt.cpp:215:9 in TXTFAM::GetFileLength(_global*)
      Exiting
      

      Also BIN, CSV, maybe more.

      Another test case, now with the explicit file name:

      INSTALL SONAME 'ha_connect';
       
      CREATE TABLE t (a INT) ENGINE=Connect TABLE_TYPE=BIN FILE_NAME='t.bin';
      INSERT INTO t VALUES (1);
      DROP TABLE t;
       
      UNINSTALL SONAME 'ha_connect';
      

      ==2200588==WARNING: MemorySanitizer: use-of-uninitialized-value
          #0 0x7f8d9a559148 in TXTFAM::GetFileLength(_global*) /data/src/10.6-msan/storage/connect/filamtxt.cpp:215:9
          #1 0x7f8d9a55c48f in DOSFAM::GetFileLength(_global*) /data/src/10.6-msan/storage/connect/filamtxt.cpp:513:19
          #2 0x7f8d9a559213 in TXTFAM::Cardinality(_global*) /data/src/10.6-msan/storage/connect/filamtxt.cpp:238:15
          #3 0x7f8d9a638924 in TDBFIX::Cardinality(_global*) /data/src/10.6-msan/storage/connect/tabfix.cpp:204:22
          #4 0x7f8d9a61ac56 in TDBDOS::MakeIndex(_global*, INDEXDEF*, bool) /data/src/10.6-msan/storage/connect/tabdos.cpp:1684:8
          #5 0x7f8d9a63845d in TDBFIX::ResetTableOpt(_global*, bool, bool) /data/src/10.6-msan/storage/connect/tabfix.cpp:167:12
          #6 0x7f8d9a4f7244 in CntCloseTable(_global*, TDB*, bool, bool) /data/src/10.6-msan/storage/connect/connect.cc:605:16
          #7 0x7f8d9a4cb2a3 in ha_connect::CloseTable(_global*) /data/src/10.6-msan/storage/connect/ha_connect.cc:2165:11
          #8 0x7f8d9a4cb2a3 in ha_connect::external_lock(THD*, int) /data/src/10.6-msan/storage/connect/ha_connect.cc:5010:9
          #9 0x56428e385bac in handler::ha_external_lock(THD*, int) /data/src/10.6-msan/sql/handler.cc:7143:3
          #10 0x56428e8f369a in handler::ha_external_unlock(THD*) /data/src/10.6-msan/sql/handler.h:3554:45
          #11 0x56428e8f369a in unlock_external(THD*, TABLE**, unsigned int) /data/src/10.6-msan/sql/lock.cc:730:11
          #12 0x56428e8f3d51 in mysql_unlock_tables(THD*, st_mysql_lock*, bool) /data/src/10.6-msan/sql/lock.cc:435:12
          #13 0x56428d4087d3 in close_thread_tables(THD*) /data/src/10.6-msan/sql/sql_base.cc:948:12
          #14 0x56428d691d3a in mysql_execute_command(THD*, bool) /data/src/10.6-msan/sql/sql_parse.cc:6092:3
          #15 0x56428d663d5a in mysql_parse(THD*, char*, unsigned int, Parser_state*) /data/src/10.6-msan/sql/sql_parse.cc:8050:18
          #16 0x56428d6582a0 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /data/src/10.6-msan/sql/sql_parse.cc:1896:7
          #17 0x56428d666150 in do_command(THD*, bool) /data/src/10.6-msan/sql/sql_parse.cc:1409:17
          #18 0x56428dc95e9f in do_handle_one_connection(CONNECT*, bool) /data/src/10.6-msan/sql/sql_connect.cc:1416:11
          #19 0x56428dc95485 in handle_one_connection /data/src/10.6-msan/sql/sql_connect.cc:1318:5
          #20 0x56428f10a4ca in pfs_spawn_thread /data/src/10.6-msan/storage/perfschema/pfs.cc:2201:3
          #21 0x7f8da280ffd3 in start_thread nptl/./nptl/pthread_create.c:442:8
          #22 0x7f8da28905bb in clone3 misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
       
        Uninitialized value was created by an allocation of 'st' in the stack frame of function '_filelength'
          #0 0x7f8d9a508ad0 in _filelength /data/src/10.6-msan/storage/connect/osutil.c:126
       
      SUMMARY: MemorySanitizer: use-of-uninitialized-value /data/src/10.6-msan/storage/connect/filamtxt.cpp:215:9 in TXTFAM::GetFileLength(_global*)
      Exiting
      

      Attachments

        Activity

          People

            TheLinuxJedi Andrew Hutchings
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            1 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.