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

Uninitialize TABLE_LIST cause crash triger by DROP SERVER

    XMLWordPrintable

Details

    • Bug
    • Status: Confirmed (View Workflow)
    • Critical
    • Resolution: Unresolved
    • 10.11, 11.4, 11.8, 11.8.8
    • 10.11, 11.4, 11.8
    • Server
    • Q4/2026 Server Maintenance

    Description

      DROP SERVER s1
      -> drop_server_internal()
      -> close_cached_connection_tables()
      -> close_cached_tables()
      -> mysql_ha_flush_tables()
      -> mysql_ha_find_match()
      -> TABLE_LIST::get_db_name()
      -> Lex_ident::streq()
      -> Lex_ident::is_valid_ident()
      -> SIGSEGV
      close_cached_connection_tables_callback use uninitialized table_list
      ```c
      // close_cached_connection_tables_callback():
      tmp= (TABLE_LIST*) alloc_root(..., sizeof(TABLE_LIST));

      make_lex_string(&tmp->db, ...);
      make_lex_string(&tmp->table_name, ...);

      tmp->next_global= tmp->next_local= arg->tables;
      MDL_REQUEST_INIT(&tmp->mdl_request, ...);
      ```

      Reproduce:
      CREATE DATABASE IF NOT EXISTS test_sqlright1;
      USE test_sqlright1;
      CREATE OR REPLACE SERVER 's1' FOREIGN DATA WRAPPER mysql
      OPTIONS (HOST '127.0.0.1', DATABASE 'test_sqlright1', USER 'root');
      CREATE TABLE v1(id INT) CONNECTION='s1';
      HANDLER v1 OPEN;
      DROP SERVER 's1';

      Crash:
      Server version: 11.8.8-MariaDB-debug source revision: 46a8eb42a520193686d9a16d4cea4b3e002917e4

      The information page at https://mariadb.com/kb/en/how-to-produce-a-full-stack-trace-for-mariadbd/
      contains instructions to obtain a better version of the backtrace below.
      Following these instructions will help MariaDB developers provide a fix quicker.

      Attempting backtrace. Include this in the bug report.
      (note: Retrieving this information may fail)

      Thread pointer: 0x772210000dc8
      stack_bottom = 0x7f2258133000 thread_stack 0x49000
      mysys/stacktrace.c:215(my_print_stacktrace)[0x55759d3cd272]
      sql/signal_handler.cc:227(handle_fatal_signal)[0x55759c17920f]
      /lib/x86_64-linux-gnu/libc.so.6(+0x42520)[0x7f225ae45520]
      sql/lex_ident.h:79(Lex_ident<Compare_table_names>::is_valid_ident() const)[0x55759b78c2a7]
      sql/lex_ident.h:118(Lex_ident<Compare_table_names>::streq(st_mysql_const_lex_string const&) const)[0x55759b806bac]
      sql/sql_handler.cc:1081(mysql_ha_find_match(THD*, TABLE_LIST*))[0x55759b8e62e4]
      sql/sql_handler.cc:1147(mysql_ha_flush_tables(THD*, TABLE_LIST*))[0x55759b8e688b]
      sql/sql_base.cc:438(close_cached_tables(THD*, TABLE_LIST*, bool, unsigned long))[0x55759b80f230]
      sql/sql_servers.cc:202(close_cached_connection_tables(THD*, st_mysql_const_lex_string*))[0x55759bd5184b]
      sql/sql_servers.cc:825(drop_server_internal(THD*, st_lex_server_options*))[0x55759bd55ffd]
      sql/sql_servers.cc:842(drop_server(THD*, st_lex_server_options*))[0x55759bd561c3]
      sql/sql_parse.cc:5883(mysql_execute_command(THD*, bool))[0x55759b9a8a5b]
      sql/sql_parse.cc:7953(mysql_parse(THD*, char*, unsigned int, Parser_state*))[0x55759b9b5211]
      sql/sql_parse.cc:1923(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool))[0x55759b98b45c]
      sql/sql_parse.cc:1431(do_command(THD*, bool))[0x55759b9883db]
      sql/sql_connect.cc:1504(do_handle_one_connection(CONNECT*, bool))[0x55759bd6417a]
      sql/sql_connect.cc:1416(handle_one_connection)[0x55759bd63c6c]
      perfschema/pfs.cc:2200(pfs_spawn_thread)[0x55759c7e3a02]
      /lib/x86_64-linux-gnu/libc.so.6(+0x94ac3)[0x7f225ae97ac3]
      /lib/x86_64-linux-gnu/libc.so.6(+0x1268d0)[0x7f225af298d0]

      Connection ID (thread ID): 6
      Status: NOT_KILLED
      Query (0x772210048180): DROP SERVER 's1'

      Attachments

        Activity

          People

            ycp Yuchen Pei
            v3rdant Xingwang Xiang
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - 0d
                0d
                Remaining:
                Remaining Estimate - 1.5d
                1.5d
                Logged:
                Time Spent - Not Specified
                Not Specified

                Git Integration

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