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

Trying to decrypt a not encrypted page

Details

    Description

      Crashing bug, the server is trying to decrypt a page that is not encrypted.

      /usr/sbin/mysqld(my_print_stacktrace+0x2e)[0x7f0fe2763a6e]
      /usr/sbin/mysqld(handle_fatal_signal+0x38d)[0x7f0fe229216d]
      /lib/x86_64-linux-gnu/libpthread.so.0(+0x10340)[0x7f0fe07ec340]
      /usr/sbin/mysqld(_Z8do_cryptPKhjPhPjP20st_encryption_schemejjjyi+0x48)[0x7f0fe2246e48]
      /usr/sbin/mysqld(encryption_scheme_decrypt+0x2b)[0x7f0fe22470bb]
      /usr/sbin/mysqld(+0x9ac476)[0x7f0fe2691476]
      /usr/sbin/mysqld(+0x948d33)[0x7f0fe262dd33]
      /usr/sbin/mysqld(+0x949370)[0x7f0fe262e370]
      /usr/sbin/mysqld(+0x9627c6)[0x7f0fe26477c6]
      /usr/sbin/mysqld(+0x940acd)[0x7f0fe2625acd]
      /usr/sbin/mysqld(+0x9c2760)[0x7f0fe26a7760]
      /usr/sbin/mysqld(+0x90f547)[0x7f0fe25f4547]
      /usr/sbin/mysqld(+0x9121e0)[0x7f0fe25f71e0]
      /usr/sbin/mysqld(+0x9208f1)[0x7f0fe26058f1]
      /usr/sbin/mysqld(+0x816c5c)[0x7f0fe24fbc5c]
      /usr/sbin/mysqld(+0x819f54)[0x7f0fe24fef54]
      /usr/sbin/mysqld(+0x91d59a)[0x7f0fe260259a]
      /usr/sbin/mysqld(+0x8b4dd6)[0x7f0fe2599dd6]
      /usr/sbin/mysqld(+0x8b1bc7)[0x7f0fe2596bc7]
      /usr/sbin/mysqld(+0x8b2aca)[0x7f0fe2597aca]
      /usr/sbin/mysqld(+0x8b33e8)[0x7f0fe25983e8]
      /usr/sbin/mysqld(+0x87a067)[0x7f0fe255f067]
      /usr/sbin/mysqld(+0x8e129e)[0x7f0fe25c629e]
      /usr/sbin/mysqld(+0x8cefb6)[0x7f0fe25b3fb6]
      /lib/x86_64-linux-gnu/libpthread.so.0(+0x8182)[0x7f0fe07e4182]
      /lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7f0fdff0747d]

      Recompiled MariaDB 10.1.10 from source and debug symbols , the backtrace is:

      (gdb) bt
      #0  0x00005555560890b2 in fil_space_decrypt (crypt_data=0x0, tmp_frame=0x7fee38008000 "", page_size=16384, src_frame=0x7ff7778a8000 "i13\222", err=0x7feeb49b494c) at /root/mariadb/mariadb-10.1.10/storage/xtradb/fil/fil0crypt.cc:722
      #1  0x000055555608930c in fil_space_decrypt (space=0, tmp_frame=0x7fee38008000 "", page_size=16384, src_frame=0x7ff7778a8000 "i13\222") at /root/mariadb/mariadb-10.1.10/storage/xtradb/fil/fil0crypt.cc:808
      #2  0x000055555600f64c in buf_page_decrypt_after_read (bpage=0x7ff577c46700) at /root/mariadb/mariadb-10.1.10/storage/xtradb/buf/buf0buf.cc:6397
      #3  0x000055555600b956 in buf_page_io_complete (bpage=0x7ff577c46700) at /root/mariadb/mariadb-10.1.10/storage/xtradb/buf/buf0buf.cc:4630
      #4  0x0000555556029d7f in buf_read_page_low (err=0x7feeb49b4b5c, sync=true, mode=132, space=0, zip_size=0, unzip=0, tablespace_version=1, offset=768, trx=0x0, rbpage=0x7feeb49b4bd8) at /root/mariadb/mariadb-10.1.10/storage/xtradb/buf/buf0rea.cc:262
      #5  0x000055555602a201 in buf_read_page (space=0, zip_size=0, offset=768, trx=0x0, bpage=0x7feeb49b4bd8) at /root/mariadb/mariadb-10.1.10/storage/xtradb/buf/buf0rea.cc:474
      #6  0x0000555556007a3d in buf_page_get_gen (space=0, zip_size=0, offset=768, rw_latch=2, guess=0x0, mode=10, file=0x555556557020 "/root/mariadb/mariadb-10.1.10/storage/xtradb/include/fut0fut.ic", line=51, mtr=0x7feeb49b4d30, err=0x0)
          at /root/mariadb/mariadb-10.1.10/storage/xtradb/buf/buf0buf.cc:2942
      #7  0x000055555609b1db in fut_get_ptr (space=0, zip_size=0, addr=..., rw_latch=2, mtr=0x7feeb49b4d30) at /root/mariadb/mariadb-10.1.10/storage/xtradb/include/fut0fut.ic:51
      #8  0x000055555609ca5f in flst_validate (base=0x7fffe3fd004a "", mtr1=0x7feeb49b58b0) at /root/mariadb/mariadb-10.1.10/storage/xtradb/fut/fut0lst.cc:479
      #9  0x0000555555fc84fe in btr_page_free_for_ibuf (index=0x55560c2fe058, block=0x7ffbc8f0c200, mtr=0x7feeb49b58b0) at /root/mariadb/mariadb-10.1.10/storage/xtradb/btr/btr0btr.cc:1336
      #10 0x0000555555fc8741 in btr_page_free_low (index=0x55560c2fe058, block=0x7ffbc8f0c200, level=0, blob=false, mtr=0x7feeb49b58b0) at /root/mariadb/mariadb-10.1.10/storage/xtradb/btr/btr0btr.cc:1436
      #11 0x0000555555fc88c1 in btr_page_free (index=0x55560c2fe058, block=0x7ffbc8f0c200, mtr=0x7feeb49b58b0) at /root/mariadb/mariadb-10.1.10/storage/xtradb/btr/btr0btr.cc:1486
      #12 0x0000555555fce957 in btr_compress (cursor=0x7feeb49b57d0, adjust=0, mtr=0x7feeb49b58b0) at /root/mariadb/mariadb-10.1.10/storage/xtradb/btr/btr0btr.cc:4123
      #13 0x0000555555fe0fde in btr_cur_compress_if_useful (cursor=0x7feeb49b57d0, adjust=0, mtr=0x7feeb49b58b0) at /root/mariadb/mariadb-10.1.10/storage/xtradb/btr/btr0cur.cc:3446
      #14 0x0000555555fe1961 in btr_cur_pessimistic_delete (err=0x7feeb49b568c, has_reserved_extents=1, cursor=0x7feeb49b57d0, flags=0, rb_ctx=RB_NONE, mtr=0x7feeb49b58b0) at /root/mariadb/mariadb-10.1.10/storage/xtradb/btr/btr0cur.cc:3710
      #15 0x0000555555e64fc2 in ibuf_delete_rec (space=92, page_no=490819, pcur=0x7feeb49b57d0, search_tuple=0x7fee38000ab8, mtr=0x7feeb49b58b0) at /root/mariadb/mariadb-10.1.10/storage/xtradb/ibuf/ibuf0ibuf.cc:4580
      #16 0x0000555555e65e7c in ibuf_merge_or_delete_for_page (block=0x7ffbc8f0bec0, space=92, page_no=490819, zip_size=0, update_ibuf_bitmap=1) at /root/mariadb/mariadb-10.1.10/storage/xtradb/ibuf/ibuf0ibuf.cc:4947
      #17 0x000055555600c03b in buf_page_io_complete (bpage=0x7ffbc8f0bec0) at /root/mariadb/mariadb-10.1.10/storage/xtradb/buf/buf0buf.cc:4840
      #18 0x0000555556082410 in fil_aio_wait (segment=7) at /root/mariadb/mariadb-10.1.10/storage/xtradb/fil/fil0fil.cc:6034
      #19 0x0000555555f73a86 in io_handler_thread (arg=0x555556d93d98 <n+56>) at /root/mariadb/mariadb-10.1.10/storage/xtradb/srv/srv0start.cc:542
      #20 0x00007ffff7787182 in start_thread (arg=0x7feeb49b6700) at pthread_create.c:312
      #21 0x00007ffff6eaa47d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

      key_version seems to be not zero:

      (gdb) l
      715
      716             *err = DB_SUCCESS;
      717
      718             if (key_version == ENCRYPTION_KEY_NOT_ENCRYPTED) {
      719                     return false;
      720             }
      721
      722             ut_ad(crypt_data->encryption != FIL_SPACE_ENCRYPTION_OFF);
      723
      724             /* read space & offset & lsn */
      (gdb) p key_version
      $5 = 713

      Although:
      a) encryption was never enabled on this server
      b) examining the page, the content is obviously not encrypted

      Attachments

        Activity

          Transition Time In Source Status Execution Times
          Jan Lindström (Inactive) made transition -
          Open In Progress
          29d 17h 48m 1
          Jan Lindström (Inactive) made transition -
          In Progress Closed
          5h 25m 1

          People

            jplindst Jan Lindström (Inactive)
            rcannao René Cannaò
            Votes:
            1 Vote for this issue
            Watchers:
            8 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.