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

SIGSEGV in flush_all_key_blocks when changing key_buffer_size / ASAN: heap-use-after-free in flush_all_key_blocks

    XMLWordPrintable

    Details

      Description

      SET GLOBAL keycache1.key_cache_segments=7;
      SET GLOBAL keycache1.key_buffer_size=1*1024*1024;
      SET GLOBAL keycache1.key_buffer_size=0;
      SET GLOBAL keycache1.key_buffer_size=128*1024;
      

      Leads to:

      10.5.4 3b251e24b6c8fe81bc5eeca086d9c1e57e6739d2

      Core was generated by `/test/MD150520-mariadb-10.5.4-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=11)
          at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
      [Current thread is 1 (Thread 0x14dcdb015700 (LWP 2638963))]
      (gdb) bt
      #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=11) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
      #1  0x0000560c2686a279 in my_write_core (sig=sig@entry=11) at /test/10.5_dbg/mysys/stacktrace.c:518
      #2  0x0000560c2600efcb in handle_fatal_signal (sig=11) at /test/10.5_dbg/sql/signal_handler.cc:329
      #3  <signal handler called>
      #4  flush_all_key_blocks (keycache=0x14dcb7c28388) at /test/10.5_dbg/mysys/mf_keycache.c:4463
      #5  prepare_resize_simple_key_cache (keycache=0x14dcb7c28388, release_lock=release_lock@entry=1 '\001') at /test/10.5_dbg/mysys/mf_keycache.c:709
      #6  0x0000560c26853738 in resize_partitioned_key_cache (keycache=0x14dcb7c71208, key_cache_block_size=1024, use_mem=131072, division_limit=100, age_threshold=300, changed_blocks_hash_size=0) at /test/10.5_dbg/mysys/mf_keycache.c:5279
      #7  0x0000560c26857bb6 in resize_key_cache (keycache=keycache@entry=0x14dcb7c23308, key_cache_block_size=key_cache_block_size@entry=1024, use_mem=use_mem@entry=131072, division_limit=division_limit@entry=100, age_threshold=age_threshold@entry=300, changed_blocks_hash_size=changed_blocks_hash_size@entry=0) at /test/10.5_dbg/mysys/mf_keycache.c:6067
      #8  0x0000560c2601ea3f in ha_resize_key_cache (key_cache=key_cache@entry=0x14dcb7c23308) at /test/10.5_dbg/sql/handler.cc:5446
      #9  0x0000560c25ed1d36 in update_buffer_size (thd=<optimized out>, key_cache=0x14dcb7c23308, offset=<optimized out>, new_value=131072) at /test/10.5_dbg/sql/sys_vars.ic:1110
      #10 0x0000560c25ee3550 in Sys_var_keycache::global_update (this=0x560c275e00a0 <Sys_key_buffer_size>, thd=0x14dcb7c15088, var=<optimized out>) at /test/10.5_dbg/sql/sys_vars.ic:1055
      #11 0x0000560c25c7ed1e in sys_var::update (this=0x560c275e00a0 <Sys_key_buffer_size>, thd=0x14dcb7c15088, var=0x14dcb7c743a0) at /test/10.5_dbg/sql/set_var.cc:207
      #12 0x0000560c25c7f247 in set_var::update (this=<optimized out>, thd=<optimized out>) at /test/10.5_dbg/sql/set_var.cc:859
      #13 0x0000560c25c805fa in sql_set_variables (thd=thd@entry=0x14dcb7c15088, var_list=var_list@entry=0x14dcb7c19fa8, free=free@entry=true) at /test/10.5_dbg/sql/set_var.cc:746
      #14 0x0000560c25d68884 in mysql_execute_command (thd=thd@entry=0x14dcb7c15088) at /test/10.5_dbg/sql/sql_parse.cc:4976
      #15 0x0000560c25d7286a in mysql_parse (thd=thd@entry=0x14dcb7c15088, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14dcdb0143e0, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:7957
      #16 0x0000560c25d5f063 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14dcb7c15088, packet=packet@entry=0x14dcb7c67089 "SET GLOBAL keycache1.key_buffer_size=128*1024", packet_length=packet_length@entry=45, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:1839
      #17 0x0000560c25d5d932 in do_command (thd=0x14dcb7c15088) at /test/10.5_dbg/sql/sql_parse.cc:1358
      #18 0x0000560c25eb7a35 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x14dcb9c453a8, put_in_cache=put_in_cache@entry=true) at /test/10.5_dbg/sql/sql_connect.cc:1411
      #19 0x0000560c25eb8151 in handle_one_connection (arg=arg@entry=0x14dcb9c453a8) at /test/10.5_dbg/sql/sql_connect.cc:1313
      #20 0x0000560c263161ce in pfs_spawn_thread (arg=0x14dcd8c45888) at /test/10.5_dbg/storage/perfschema/pfs.cc:2201
      #21 0x000014dcda43c6db in start_thread (arg=0x14dcdb015700) at pthread_create.c:463
      #22 0x000014dcd983a88f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 10.1.45 (dbg), 10.2.32 (dbg), 10.3.23 (dbg), 10.4.13 (dbg), 10.5.2 (dbg), 10.5.3 (dbg), 10.5.3 (opt), 10.5.4 (dbg)

      Bug confirmed not present in:
      MariaDB: 10.1.45 (opt), 10.2.32 (opt), 10.3.23 (opt), 10.4.13 (opt), 10.5.2 (opt), 10.5.4 (opt)
      MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.47 (dbg), 5.6.47 (opt), 5.7.29 (dbg), 5.7.29 (opt), 8.0.19 (dbg), 8.0.19 (opt)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              sanja Oleksandr Byelkin
              Reporter:
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              4 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.