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

main.mysql_client_test test_mdev19838 fails with MemorySanitizer

Details

    Description

      This came up while I was working on MDEV-26758. These tests used to fail with MemorySanitizer:

      main.mysql_client_test_comp              w3 [ pass ]  43767
      main.mysql_client_test_nonblock          w2 [ pass ]  44749
      main.mysql_client_test                   w1 [ pass ]  44743
      

      I suspect that fixing test_mdev19838() requires some changes in libmariadb itself. I am getting the following trace:

      ==WARNING: MemorySanitizer: use-of-uninitialized-value
          #0 0x55f050b09636 in madb_reset_stmt /mariadb/10.5m/libmariadb/libmariadb/mariadb_stmt.c:2159:15
          #1 0x55f050b04e7e in mysql_stmt_internal_reset /mariadb/10.5m/libmariadb/libmariadb/mariadb_stmt.c:2186:8
          #2 0x55f050b075e3 in mysql_stmt_close /mariadb/10.5m/libmariadb/libmariadb/mariadb_stmt.c:1400:7
          #3 0x55f050ac9524 in wrap_mysql_stmt_close /mariadb/10.5m/tests/nonblock-wrappers.h:369:1
          #4 0x55f050ac9524 in test_mdev19838 /mariadb/10.5m/tests/mysql_client_test.c:21259:5
          #5 0x55f05085e978 in main /mariadb/10.5m/tests/mysql_client_fw.c:1449:9
          #6 0x7f04193f1e49 in __libc_start_main csu/../csu/libc-start.c:314:16
          #7 0x55f0507d5869 in _start (/dev/shm/10.5msan/tests/mariadb-client-test+0x5b869)
       
        Uninitialized value was created by a heap allocation
          #0 0x55f0507e1cad in malloc (/dev/shm/10.5msan/tests/mariadb-client-test+0x67cad)
          #1 0x55f050af8a0c in ma_init_alloc_root /mariadb/10.5m/libmariadb/libmariadb/ma_alloc.c:36:18
      

      For now, I will disable test_mdev19838() under MemorySanitizer. It was already disabled for the embedded server.

      Attachments

        Issue Links

          Activity

            For what it is worth, also this simpler fix would seem to have fixed the issue for me:

            diff --git a/libmariadb/mariadb_stmt.c b/libmariadb/mariadb_stmt.c
            index 516b801..b56ac9f 100644
            --- a/libmariadb/mariadb_stmt.c
            +++ b/libmariadb/mariadb_stmt.c
            @@ -2207,8 +2207,7 @@ static my_bool madb_reset_stmt(MYSQL_STMT *stmt, unsigned int flags)
                   {
                     ulonglong i;
                     for (i=0; i < stmt->param_count; i++)
            -          if (stmt->params[i].long_data_used)
            -            stmt->params[i].long_data_used= 0;
            +          stmt->params[i].long_data_used= 0;
                   }
                 }
             
            

            I tested the fix on 10.5 and 10.6 and updated libmariadb on both.

            marko Marko Mäkelä added a comment - For what it is worth, also this simpler fix would seem to have fixed the issue for me: diff --git a/libmariadb/mariadb_stmt.c b/libmariadb/mariadb_stmt.c index 516b801..b56ac9f 100644 --- a/libmariadb/mariadb_stmt.c +++ b/libmariadb/mariadb_stmt.c @@ -2207,8 +2207,7 @@ static my_bool madb_reset_stmt(MYSQL_STMT *stmt, unsigned int flags) { ulonglong i; for (i=0; i < stmt->param_count; i++) - if (stmt->params[i].long_data_used) - stmt->params[i].long_data_used= 0; + stmt->params[i].long_data_used= 0; } } I tested the fix on 10.5 and 10.6 and updated libmariadb on both.

            People

              georg Georg Richter
              marko Marko Mäkelä
              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.