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

bool show_role_grants(THD *, const char *, ACL_USER_BASE *, char *, size_t): Assertion `pair' failed

    XMLWordPrintable

Details

    • Can result in hang or crash

    Description

      CLI compatible test case:-

      set sql_mode='';
      CREATE ROLE i0;
      DELETE FROM mysql.user;
      GRANT USAGE ON *.* TO i0;
      DROP ROLE i0;
      SHOW GRANTS;
      

      Leads to:

      CS 13.0.2 b2c4e675049e23ce8c7346985f40840fcd4e583f (Optimized, Clang 22.1.8-20260621) Build 09/09/2026

      Core was generated by `/test/MD090926-mariadb-13.0.2-linux-x86_64-opt/bin/mariadbd --no-defaults --loo'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  show_role_grants (thd=thd@entry=0x6a3780000c70, hostname=hostname@entry=0x6a37800032ad "localhost", acl_entry=0x57b6214c5520, buff=buff@entry=0x7238958f1b10 "GRANT `i0` TO `root`@`localhost`", buffsize=1024) at /test/13.0_opt/sql/sql_acl.cc:9905
       
      [Current thread is 1 (LWP 1921196)]
      (gdb) bt
      #0  show_role_grants (thd=thd@entry=0x6a3780000c70, hostname=hostname@entry=0x6a37800032ad "localhost", acl_entry=0x57b6214c5520, buff=buff@entry=0x7238958f1b10 "GRANT `i0` TO `root`@`localhost`", buffsize=1024) at /test/13.0_opt/sql/sql_acl.cc:9905
      #1  0x000057b61da1a0ff in mysql_show_grants (thd=thd@entry=0x6a3780000c70, lex_user=lex_user@entry=0x6a3780017bf0)at /test/13.0_opt/sql/sql_acl.cc:9749
      #2  0x000057b61daa80ab in mysql_execute_command (thd=thd@entry=0x6a3780000c70, is_called_from_prepared_stmt=false) at /test/13.0_opt/sql/sql_parse.cc:5504
      #3  0x000057b61daa1a2d in mysql_parse (thd=thd@entry=0x6a3780000c70, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x7238958f24f0)at /test/13.0_opt/sql/sql_parse.cc:7943
      #4  0x000057b61daa01ff in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x6a3780000c70, packet=packet@entry=0x6a3780008d91 "", packet_length=packet_length@entry=11, blocking=true)at /test/13.0_opt/sql/sql_parse.cc:1903
      #5  0x000057b61daa1eb0 in do_command (thd=thd@entry=0x6a3780000c70, blocking=true) at /test/13.0_opt/sql/sql_parse.cc:1437
      #6  0x000057b61dbca35d in do_handle_one_connection (connect=<optimized out>, connect@entry=0x57b62145e550, put_in_cache=true)at /test/13.0_opt/sql/sql_connect.cc:1514
      #7  0x000057b61dbca192 in handle_one_connection (arg=arg@entry=0x57b62145e550)at /test/13.0_opt/sql/sql_connect.cc:1426
      #8  0x000057b61df6d453 in pfs_spawn_thread (arg=0x57b62147e940)at /test/13.0_opt/storage/perfschema/pfs.cc:2198
      #9  0x0000723898a9cb84 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #10 0x0000723898b29ecc in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      CS 13.0.2 b2c4e675049e23ce8c7346985f40840fcd4e583f (Debug, Clang 22.1.8-20260621) Build 09/09/2026

      mariadbd: /test/13.0_dbg/sql/sql_acl.cc:9903: bool show_role_grants(THD *, const char *, ACL_USER_BASE *, char *, size_t): Assertion `pair' failed.
      

      CS 13.0.2 b2c4e675049e23ce8c7346985f40840fcd4e583f (Debug, Clang 22.1.8-20260621) Build 09/09/2026

      Core was generated by `/test/MD090926-mariadb-13.0.2-linux-x86_64-dbg/bin/mariadbd --no-defaults --loo'.
      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 1921132)]
      (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  0x000077947c84527e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x000077947c8288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x000077947c82881b in __assert_fail_base (fmt=0x77947c9d1208 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x5c9c40c6b587 "pair", file=file@entry=0x5c9c40a686fc "/test/13.0_dbg/sql/sql_acl.cc", line=line@entry=9903, function=function@entry=0x5c9c40a6ad6e "bool show_role_grants(THD *, const char *, ACL_USER_BASE *, char *, size_t)") at ./assert/assert.c:96
      #6  0x000077947c83b517 in __assert_fail (assertion=0x5c9c40c6b587 "pair", file=0x5c9c40a686fc "/test/13.0_dbg/sql/sql_acl.cc", line=9903, function=0x5c9c40a6ad6e "bool show_role_grants(THD *, const char *, ACL_USER_BASE *, char *, size_t)") at ./assert/assert.c:105
      #7  0x00005c9c3f9b1b17 in show_role_grants (thd=0x6f9364000d60, hostname=0x6f9364003555 "localhost", acl_entry=0x5c9c6627d5e0, buff=0x77947809ddf0 "GRANT `i0` TO `root`@`localhost`", buffsize=1024)at /test/13.0_dbg/sql/sql_acl.cc:9903
      #8  0x00005c9c3f9b1546 in mysql_show_grants (thd=0x6f9364000d60, lex_user=0x6f936401a450) at /test/13.0_dbg/sql/sql_acl.cc:9749
      #9  0x00005c9c3faa4151 in mysql_execute_command (thd=0x6f9364000d60, is_called_from_prepared_stmt=false) at /test/13.0_dbg/sql/sql_parse.cc:5504
      #10 0x00005c9c3fa96d18 in mysql_parse (thd=0x6f9364000d60, rawbuf=0x6f936401a3c0 "SHOW GRANTS", length=11, parser_state=0x77947809f9f0) at /test/13.0_dbg/sql/sql_parse.cc:7943
      #11 0x00005c9c3fa9446e in dispatch_command (command=COM_QUERY, thd=0x6f9364000d60, packet=0x6f936400b5f1 "", packet_length=11, blocking=true) at /test/13.0_dbg/sql/sql_parse.cc:1903
      #12 0x00005c9c3fa9779a in do_command (thd=0x6f9364000d60, blocking=true)at /test/13.0_dbg/sql/sql_parse.cc:1437
      #13 0x00005c9c3fc6975e in do_handle_one_connection (connect=0x5c9c662d4880, put_in_cache=true) at /test/13.0_dbg/sql/sql_connect.cc:1514
      #14 0x00005c9c3fc69541 in handle_one_connection (arg=0x5c9c662b31e0)at /test/13.0_dbg/sql/sql_connect.cc:1426
      #15 0x000077947c89cb84 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #16 0x000077947c929ecc in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      Bug Detection Matrix

          Rel    o/d  Build   Commit                                    UniqueID observed             
      CS  10.11  dbg  090926  2753b5919a10abd32ba822877c6a1cbf602d3748  pair|SIGABRT|show_role_grants|mysql_show_grants|mysql_execute_command|mysql_parse
      CS  10.11  opt  090926  2753b5919a10abd32ba822877c6a1cbf602d3748  SIGSEGV|show_role_grants|mysql_show_grants|mysql_execute_command|mysql_parse
      CS  11.4   dbg  090926  42038e1145dd43b3910055c364fb720a8a152d61  pair|SIGABRT|show_role_grants|mysql_show_grants|mysql_execute_command|mysql_parse
      CS  11.4   opt  090926  42038e1145dd43b3910055c364fb720a8a152d61  SIGSEGV|show_role_grants|mysql_show_grants|mysql_execute_command|mysql_parse
      CS  11.8   dbg  090926  e2e060ce3d8c3ce11b6c7ba28ced0f1a30c50a54  pair|SIGABRT|show_role_grants|mysql_show_grants|mysql_execute_command|mysql_parse
      CS  11.8   opt  090926  e2e060ce3d8c3ce11b6c7ba28ced0f1a30c50a54  SIGSEGV|show_role_grants|mysql_show_grants|mysql_execute_command|mysql_parse
      CS  12.3   dbg  090926  e9f84a1fdf7093191e55b55dc14b08b9d4ebaa20  pair|SIGABRT|show_role_grants|mysql_show_grants|mysql_execute_command|mysql_parse
      CS  12.3   opt  090926  e9f84a1fdf7093191e55b55dc14b08b9d4ebaa20  SIGSEGV|show_role_grants|mysql_show_grants|mysql_execute_command|mysql_parse
      CS  13.0   dbg  090926  b2c4e675049e23ce8c7346985f40840fcd4e583f  pair|SIGABRT|show_role_grants|mysql_show_grants|mysql_execute_command|mysql_parse
      CS  13.0   opt  090926  b2c4e675049e23ce8c7346985f40840fcd4e583f  SIGSEGV|show_role_grants|mysql_show_grants|mysql_execute_command|mysql_parse
      CS  13.1   dbg  090926  02c842c30dcb05a962eaac58c69920e6be3369cf  pair|SIGABRT|show_role_grants|mysql_show_grants|mysql_execute_command|mysql_parse
      CS  13.1   opt  090926  02c842c30dcb05a962eaac58c69920e6be3369cf  SIGSEGV|show_role_grants|mysql_show_grants|mysql_execute_command|mysql_parse
      ES  10.6   dbg  090926  aa3fb9800c358182ee2a1f8cca8ffbdd6d0a37eb  pair|SIGABRT|show_role_grants|mysql_show_grants|mysql_execute_command|mysql_parse
      ES  10.6   opt  090926  aa3fb9800c358182ee2a1f8cca8ffbdd6d0a37eb  SIGSEGV|show_role_grants|mysql_show_grants|mysql_execute_command|mysql_parse
      ES  11.4   dbg  090926  32807340954440071ca8ae8e2de51fb180d134c6  pair|SIGABRT|show_role_grants|mysql_show_grants|mysql_execute_command|mysql_parse
      ES  11.4   opt  090926  32807340954440071ca8ae8e2de51fb180d134c6  SIGSEGV|show_role_grants|mysql_show_grants|mysql_execute_command|mysql_parse
      ES  11.8   dbg  090926  c4af6f687a2dd983072457429aa2294f11957650  pair|SIGABRT|show_role_grants|mysql_show_grants|mysql_execute_command|mysql_parse
      ES  11.8   opt  090926  c4af6f687a2dd983072457429aa2294f11957650  SIGSEGV|show_role_grants|mysql_show_grants|mysql_execute_command|mysql_parse
      ES  12.3   dbg  090926  c3bd5108d81f19e33efb93f7b6ae971293732fd0  pair|SIGABRT|show_role_grants|mysql_show_grants|mysql_execute_command|mysql_parse
      ES  12.3   opt  090926  c3bd5108d81f19e33efb93f7b6ae971293732fd0  SIGSEGV|show_role_grants|mysql_show_grants|mysql_execute_command|mysql_parse
      

      Attachments

        Activity

          People

            serg Sergei Golubchik
            saahil Saahil Alam
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

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

                Git Integration

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