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

Assertion `((hash)->blength != 0)' failed in uchar *my_hash_first(const HASH *, const uchar *, size_t, HASH_SEARCH_STATE *)

    XMLWordPrintable

Details

    • Can result in hang or crash

    Description

      Replay using CLI. We may need to execute the test case multiple times to reproduce the issue.

      # mysqld options required for replay:  --skip-grant-tables=1
      SET max_statement_time=0.001;
      FLUSH PRIVILEGES;
      CREATE VIEW v1 AS SELECT 1;
      

      Leads to:

      CS 12.1.2 033471a367b4c60b7262e64f43f46b02e95b9d74 (Debug, Clang) Build 13/08/2025

      mariadbd: /test/12.1_dbg/mysys/hash.c:261: uchar *my_hash_first(const HASH *, const uchar *, size_t, HASH_SEARCH_STATE *): Assertion `((hash)->blength != 0)' failed.
      

      CS 12.1.2 033471a367b4c60b7262e64f43f46b02e95b9d74 (Debug, Clang) Build 13/08/2025

      Core was generated by `/test/MD130825-mariadb-12.1.2-linux-x86_64-dbg/bin/mariadbd --no-defaults --max'.
      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 3065695)]
      (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=signo@entry=6)at ./nptl/pthread_kill.c:89
      #3  0x000075adbde4527e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x000075adbde288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x000075adbde2881b in __assert_fail_base (fmt=0x75adbdfd01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x58ced56e014d "((hash)->blength != 0)", file=file@entry=0x58ced56e011c "/test/12.1_dbg/mysys/hash.c", line=line@entry=261, function=function@entry=0x58ced56e0164 "uchar *my_hash_first(const HASH *, const uchar *, size_t, HASH_SEARCH_STATE *)") at ./assert/assert.c:96
      #6  0x000075adbde3b517 in __assert_fail (assertion=0x58ced56e014d "((hash)->blength != 0)", file=0x58ced56e011c "/test/12.1_dbg/mysys/hash.c", line=261, function=0x58ced56e0164 "uchar *my_hash_first(const HASH *, const uchar *, size_t, HASH_SEARCH_STATE *)") at ./assert/assert.c:105
      #7  0x000058ced5238e09 in my_hash_first (hash=0x58ced6183100 <column_priv_hash>, key=0x75a9dd3cc7c0 "", length=9, current_record=0x75a9dd3cc764) at /test/12.1_dbg/mysys/hash.c:261
      #8  0x000058ced44140f5 in name_hash_search (name_hash=0x58ced6183100 <column_priv_hash>, host=0x58ced5561565 "localhost", ip=0x0, db=0x7592b4019f80 "test", user=0x7592b4003028 "", tname=0x7592b4019f20 "v1", exact=false, name_tolower=false) at /test/12.1_dbg/sql/sql_acl.cc:5845
      #9  0x000058ced43fa53d in table_hash_search (host=0x58ced5561565 "localhost", ip=0x0, db=0x7592b4019f80 "test", user=0x7592b4003028 "", tname=0x7592b4019f20 "v1", exact=false)at /test/12.1_dbg/sql/sql_acl.cc:5886
      #10 0x000058ced44008b7 in st_grant_info::read (this=0x7592b401a2b0, sctx=0x7592b4003010, db=0x7592b4019f80 "test", table=0x7592b4019f20 "v1")at /test/12.1_dbg/sql/sql_acl.cc:8727
      #11 0x000058ced441f6e4 in st_grant_info::refresh (this=0x7592b401a2b0, sctx=0x7592b4003010, db=0x7592b4019f80 "test", table=0x7592b4019f20 "v1")at /test/12.1_dbg/sql/sql_acl.cc:8717
      #12 0x000058ced440f5ce in fill_effective_table_privileges (thd=0x7592b4000d58, grant=0x7592b401a2b0, db=0x7592b4019f80 "test", table=0x7592b4019f20 "v1")at /test/12.1_dbg/sql/sql_acl.cc:13475
      #13 0x000058ced466ff48 in mysql_create_view (thd=0x7592b4000d58, views=0x7592b4019f90, mode=VIEW_CREATE_NEW)at /test/12.1_dbg/sql/sql_view.cc:628
      #14 0x000058ced4505729 in mysql_execute_command (thd=0x7592b4000d58, is_called_from_prepared_stmt=false) at /test/12.1_dbg/sql/sql_parse.cc:5666
      #15 0x000058ced44f5664 in mysql_parse (thd=0x7592b4000d58, rawbuf=0x7592b4019e80 "CREATE VIEW v1 AS SELECT 1 QUERY", length=32, parser_state=0x75a9dd3cea10) at /test/12.1_dbg/sql/sql_parse.cc:7883
      #16 0x000058ced44f2a38 in dispatch_command (command=COM_QUERY, thd=0x7592b4000d58, packet=0x7592b400b1f9 "CREATE VIEW v1 AS SELECT 1 QUERY", packet_length=32, blocking=true) at /test/12.1_dbg/sql/sql_parse.cc:1878
      #17 0x000058ced44f6213 in do_command (thd=0x7592b4000d58, blocking=true)at /test/12.1_dbg/sql/sql_parse.cc:1417
      #18 0x000058ced46e34b9 in do_handle_one_connection (connect=0x58cef375c808, put_in_cache=true) at /test/12.1_dbg/sql/sql_connect.cc:1414
      #19 0x000058ced46e325e in handle_one_connection (arg=0x58cef36f7ed8)at /test/12.1_dbg/sql/sql_connect.cc:1326
      #20 0x000075adbde9caa4 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #21 0x000075adbdf29c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      Bug Detection Matrix

          Rel    o/d  Build   Commit                                    UniqueID observed             
      CS  10.6   dbg  040825  317f099ca56130a14a45b7250996c207cc95d461  ((hash)->blength != 0)|SIGABRT|my_hash_first|name_hash_search|table_hash_search|fill_effective_table_privileges              
      CS  10.6   opt  040825  317f099ca56130a14a45b7250996c207cc95d461  SIGSEGV|my_hash_first|name_hash_search|table_hash_search|fill_effective_table_privileges     
      CS  10.11  dbg  130825  e46c9a01529687401b0f82b1427855535d38c0c0  ((hash)->blength != 0)|SIGABRT|my_hash_first|name_hash_search|table_hash_search|st_grant_info::read               
      CS  10.11  opt  130825  e46c9a01529687401b0f82b1427855535d38c0c0  SIGSEGV|my_hash_first|name_hash_search|table_hash_search|st_grant_info::read           
      CS  11.4   dbg  130825  03b31c0bd99390c1984f19a19f22dd6e77b7692e  ((hash)->blength != 0)|SIGABRT|my_hash_first|name_hash_search|table_hash_search|st_grant_info::read                      
      CS  11.4   opt  130825  03b31c0bd99390c1984f19a19f22dd6e77b7692e  SIGSEGV|my_hash_first|name_hash_search|table_hash_search|st_grant_info::read                      
      CS  11.8   dbg  130825  1a446ccc48528e88a3cd6cd1d1ec9e7492d342ca  ((hash)->blength != 0)|SIGABRT|my_hash_first|name_hash_search|table_hash_search|st_grant_info::read                  
      CS  11.8   opt  130825  1a446ccc48528e88a3cd6cd1d1ec9e7492d342ca  SIGSEGV|my_hash_first|name_hash_search|table_hash_search|st_grant_info::read
      CS  12.1   dbg  130825  033471a367b4c60b7262e64f43f46b02e95b9d74  ((hash)->blength != 0)|SIGABRT|my_hash_first|name_hash_search|table_hash_search|st_grant_info::read                  
      CS  12.1   opt  130825  033471a367b4c60b7262e64f43f46b02e95b9d74  SIGSEGV|my_hash_first|name_hash_search|table_hash_search|st_grant_info::read                  
      CS  12.2   dbg  130825  e02f4d7e311e214ea62ff2e59599849e229f4165  ((hash)->blength != 0)|SIGABRT|my_hash_first|name_hash_search|table_hash_search|st_grant_info::read
      CS  12.2   opt  070825  e02f4d7e311e214ea62ff2e59599849e229f4165  SIGSEGV|my_hash_first|name_hash_search|table_hash_search|st_grant_info::read
      ES  10.5   dbg  040825  70586522eacf09d04d49962072e14325a75d8155  ((hash)->blength != 0)|SIGABRT|my_hash_first|name_hash_search|table_hash_search|fill_effective_table_privileges                  
      ES  10.5   opt  040825  70586522eacf09d04d49962072e14325a75d8155  SIGSEGV|my_hash_first|name_hash_search|table_hash_search|fill_effective_table_privileges
      ES  10.6   dbg  040825  9b794f34b48fb7eee490b6da44edc0f33a947447  ((hash)->blength != 0)|SIGABRT|my_hash_first|name_hash_search|table_hash_search|fill_effective_table_privileges
      ES  10.6   opt  040825  9b794f34b48fb7eee490b6da44edc0f33a947447  SIGSEGV|my_hash_first|name_hash_search|table_hash_search|fill_effective_table_privileges                  
      ES  11.4   dbg  040825  a1c03ccd54b582e75506687ee19b273ca897f261  ((hash)->blength != 0)|SIGABRT|my_hash_first|name_hash_search|table_hash_search|st_grant_info::read
      ES  11.4   opt  040825  a1c03ccd54b582e75506687ee19b273ca897f261  SIGSEGV|my_hash_first|name_hash_search|table_hash_search|st_grant_info::read
      

      No UB/ASAN issues observed.

      Attachments

        Activity

          People

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