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

use-of-uninitialized-value in MYSQL_QUERY_LOG::write

    XMLWordPrintable

Details

    • Can result in hang or crash
    • Q4/2026 Replic. Maintenance

    Description

      Mtr compatible test case

      SET GLOBAL log_output='FILE';
      CHANGE MASTER 'aaaa' TO master_host='aaaa',master_use_gtid=slave_pos;
      SET GLOBAL log_slow_verbosity='full';
      SET GLOBAL init_slave='aaaa';
      SET GLOBAL long_query_time=0;
      SET GLOBAL slow_query_log=1;
      START SLAVE 'aaaa';
      SET GLOBAL log_output='FILE';
      

      CS 12.3.2 66b3c6784689fbb65110a5b21efcb815a8bcde24 (Debug, MSAN, Clang 20.1.8-20250708) Build 03/06/2026

      ==1558226==WARNING: MemorySanitizer: use-of-uninitialized-value
          #0 0x5555572276ec in MYSQL_QUERY_LOG::write(THD*, long, char const*, unsigned long, unsigned long long, unsigned long long, bool, char const*, unsigned long) /test/12.3/sql/log.cc:4227:60
          #1 0x555557224c7b in Log_to_file_event_handler::log_slow(THD*, my_hrtime_t, char const*, unsigned long, unsigned long long, unsigned long long, bool, char const*, unsigned long) /test/12.3/sql/log.cc:1369:31
          #2 0x55555722a7d1 in LOGGER::slow_log_print(THD*, char const*, unsigned long, unsigned long long) /test/12.3/sql/log.cc:1646:36
          #3 0x555556382208 in log_slow_statement(THD*) /test/12.3/sql/sql_parse.cc:2615:5
          #4 0x555556375bab in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /test/12.3/sql/sql_parse.cc:2475:5
          #5 0x55555636f5e8 in execute_init_command(THD*, st_mysql_lex_string*, st_mysql_rwlock*) /test/12.3/sql/sql_parse.cc:972:3
          #6 0x55555608015a in handle_slave_sql /test/12.3/sql/slave.cc:5425:5
          #7 0x5555576e60b7 in pfs_spawn_thread /test/12.3/storage/perfschema/pfs.cc:2198:3
          #8 0x7fffe669caa3 in start_thread nptl/pthread_create.c:447:8
          #9 0x7fffe6729c6b in clone3 misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
       
        Memory was marked as uninitialized
          #0 0x555555ecec7d in __msan_allocated_memory (/test/MSAN_MD030626-mariadb-12.3.2-linux-x86_64-dbg/bin/mariadbd+0x97ac7d) (BuildId: f3b9920826568bb57c9d09893df6cf12338c1873)
          #1 0x55555836347d in my_malloc /test/12.3/mysys/my_malloc.c:117:7
       
      SUMMARY: MemorySanitizer: use-of-uninitialized-value /test/12.3/sql/log.cc:4227:60 in MYSQL_QUERY_LOG::write(THD*, long, char const*, unsigned long, unsigned long long, unsigned long long, bool, char const*, unsigned long)
      

      CS 12.3.2 66b3c6784689fbb65110a5b21efcb815a8bcde24 (Debug, MSAN, Clang 20.1.8-20250708) Build 03/06/2026

      Core was generated by `/test/MSAN_MD030626-mariadb-12.3.2-linux-x86_64-dbg/bin/mariadbd --no-defaults'.
      Program terminated with signal SIGABRT, Aborted.
      #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:44
       
      [Current thread is 1 (LWP 1569027)]
      (gdb) bt
      #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:44
      #1  __pthread_kill_internal (signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:78
      #2  __GI___pthread_kill (threadid=<optimized out>, signo=6)at ./nptl/pthread_kill.c:89
      #3  0x0000555556dbaeba in handle_fatal_signal (sig=6)at /test/12.3/sql/signal_handler.cc:298
      #4  0x0000555555f1dcc9 in SignalHandler(int) ()
      #5  <signal handler called>
      #6  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:44
      #7  __pthread_kill_internal (signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:78
      #8  __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6)at ./nptl/pthread_kill.c:89
      #9  0x00007fffe664527e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #10 0x00007fffe66288ff in __GI_abort () at ./stdlib/abort.c:79
      #11 0x0000555555ea901c in __sanitizer::Abort() ()
      #12 0x0000555555ea6ebe in __sanitizer::Die() ()
      #13 0x0000555555ebe1a3 in __msan_warning_with_origin_noreturn ()
      #14 0x00005555572276ed in MYSQL_QUERY_LOG::write (this=this@entry=0x71e000000538, thd=thd@entry=0x72c000170020, current_time=1780512726, user_host=<optimized out>, user_host_len=<optimized out>, query_utime=<optimized out>, lock_utime=<optimized out>, is_command=<optimized out>, sql_text=<optimized out>, sql_text_len=<optimized out>)at /test/12.3/sql/log.cc:4227
      #15 0x0000555557224c7c in Log_to_file_event_handler::log_slow (this=<optimized out>, thd=0x72c000170020, current_time=<optimized out>, user_host=<optimized out>, user_host_len=<optimized out>, query_utime=<optimized out>, lock_utime=<optimized out>, is_command=<optimized out>, sql_text=<optimized out>, sql_text_len=<optimized out>) at /test/12.3/sql/log.cc:1369
      #16 0x000055555722a7d2 in LOGGER::slow_log_print (this=<optimized out>, thd=<optimized out>, query=<optimized out>, query_length=<optimized out>, current_utime=<optimized out>) at /test/12.3/sql/log.cc:1646
      #17 0x0000555556382209 in log_slow_statement (thd=thd@entry=0x72c000170020)at /test/12.3/sql/sql_parse.cc:2615
      #18 0x0000555556375bac in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x72c000170020, packet=<optimized out>, packet@entry=0x70500000f090 "aaaa", packet_length=<optimized out>, blocking=<optimized out>) at /test/12.3/sql/sql_parse.cc:2475
      #19 0x000055555636f5e9 in execute_init_command (thd=0x72c000170020, init_command=<optimized out>, var_lock=<optimized out>)at /test/12.3/sql/sql_parse.cc:972
      #20 0x000055555608015b in handle_slave_sql (arg=arg@entry=0x72a000018000)at /test/12.3/sql/slave.cc:5425
      #21 0x00005555576e60b8 in pfs_spawn_thread (arg=0x716000020120)at /test/12.3/storage/perfschema/pfs.cc:2198
      #22 0x00007fffe669caa4 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #23 0x00007fffe6729c6c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      Bug Signature

      MSAN|use-of-uninitialized-value|sql/log.cc|MYSQL_QUERY_LOG::write|Log_to_file_event_handler::log_slow|LOGGER::slow_log_print|log_slow_statement
      

      Attachments

        Activity

          People

            ParadoxV5 Jimmy Hú
            saahil Saahil Alam
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - 3d Original Estimate - 3d
                3d
                Remaining:
                Time Spent - 1.5h Remaining Estimate - 3d
                3d
                Logged:
                Time Spent - 1.5h Remaining Estimate - 3d
                1.5h

                Git Integration

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