Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.4.7, 10.5.0
-
None
-
Server built with/BUILD/compile-pentium64-valgrind-max
Description
mtr --valgrind encryption.innodb_encryption
This is log is from MariaDB 10.5 compiled with
./BUILD/compile-pentium64-valgrind-max
We get similar errors (and more) in 10.4)
encryption.innodb_encryption 'innodb,undo0' [ fail ] Found warnings/errors in server log file!
Test ended at 2019-08-10 16:21:55
line
==12768== Invalid read of size 2
==12768== at 0x4C356A7: memmove (vg_replace_strmem.c:1271)
==12768== by 0x15763C7: wolfSSL_EVP_CipherUpdate (evp.c:361)
==12768== by 0x1437725: MyCTX::update(unsigned char const*, unsigned int, unsigned char*, unsigned int*) (my_crypt.cc:85)
==12768== by 0x143796B: MyCTX_nopad::update(unsigned char const*, unsigned int, unsigned char*, unsigned int*) (my_crypt.cc:143)
==12768== by 0x14372ED: my_aes_crypt_update (my_crypt.cc:310)
==12768== by 0xF2CFDF1: ctx_update(void*, unsigned char const*, unsigned int, unsigned char*, unsigned int*) (example_key_management_plugin.cc:126)
==12768== by 0xADF5FA: encryption_crypt (service_encryption.h:119)
==12768== by 0xADFF2F: do_crypt(unsigned char const*, unsigned int, unsigned char*, unsigned int*, st_encryption_scheme*, unsigned int, unsigned int, unsigned int, unsigned long long, int) (encryption.cc:223)
==12768== by 0xADFFD1: encryption_scheme_decrypt (encryption.cc:244)
==12768== by 0x12CDC06: fil_space_decrypt_full_crc32(unsigned long, fil_space_crypt_t*, unsigned char*, unsigned char*, dberr_t*) (fil0crypt.cc:842)
==12768== by 0x12CE1A7: fil_space_decrypt(unsigned long, fil_space_crypt_t*, unsigned char*, unsigned long, unsigned long, unsigned char*, dberr_t*) (fil0crypt.cc:976)
==12768== by 0x12CE30D: fil_space_decrypt(fil_space_t const*, unsigned char*, unsigned char*, bool*) (fil0crypt.cc:1011)
==12768== by 0x122565E: buf_page_decrypt_after_read(buf_page_t*, fil_space_t*) (buf0buf.cc:555)
==12768== by 0x1236C14: buf_page_io_complete(buf_page_t*, bool, bool) (buf0buf.cc:6019)
==12768== by 0x1261339: buf_read_page_low(dberr_t*, bool, unsigned long, unsigned long, page_id_t, unsigned long, bool, bool) (buf0rea.cc:203)
==12768== by 0x1261AE3: buf_read_page(page_id_t, unsigned long) (buf0rea.cc:411)
==12768== Address 0x10324000 is 0 bytes after a block of size 16,384 alloc'd
==12768== at 0x4C30833: memalign (vg_replace_malloc.c:908)
==12768== by 0x4C30936: posix_memalign (vg_replace_malloc.c:1072)
==12768== by 0x123B9B2: aligned_malloc(unsigned long, unsigned long) (buf0buf.cc:130)
==12768== by 0x12250BD: buf_tmp_reserve_crypt_buf(buf_tmp_buffer_t*) (buf0buf.cc:441)
==12768== by 0x1225622: buf_page_decrypt_after_read(buf_page_t*, fil_space_t*) (buf0buf.cc:550)
==12768== by 0x1236C14: buf_page_io_complete(buf_page_t*, bool, bool) (buf0buf.cc:6019)
==12768== by 0x1261339: buf_read_page_low(dberr_t*, bool, unsigned long, unsigned long, page_id_t, unsigned long, bool, bool) (buf0rea.cc:203)
==12768== by 0x1261AE3: buf_read_page(page_id_t, unsigned long) (buf0rea.cc:411)
==12768== by 0x1231BA4: buf_page_get_gen(page_id_t, unsigned long, unsigned long, buf_block_t*, unsigned long, char const*, unsigned int, mtr_t*, dberr_t*) (buf0buf.cc:4380)
==12768== by 0x126825F: dict_hdr_get(mtr_t*) (dict0boot.cc:49)
==12768== by 0x1268936: dict_boot() (dict0boot.cc:276)
==12768== by 0x116D1E6: srv_start(bool) (srv0start.cc:1881)
==12768== by 0xF83B68: innodb_init(void*) (ha_innodb.cc:4127)
==12768== by 0xBA2FC4: ha_initialize_handlerton(st_plugin_int*) (handler.cc:550)
==12768== by 0x8A3030: plugin_initialize(st_mem_root*, st_plugin_int*, int*, char**, bool) (sql_plugin.cc:1437)
==12768== by 0x8A3C2C: plugin_init(int*, char**, int) (sql_plugin.cc:1719)
==12768== Invalid read of size 2
==12768== at 0x4C35698: memmove (vg_replace_strmem.c:1271)
==12768== by 0x15763C7: wolfSSL_EVP_CipherUpdate (evp.c:361)
==12768== by 0x1437725: MyCTX::update(unsigned char const*, unsigned int, unsigned char*, unsigned int*) (my_crypt.cc:85)
==12768== by 0x143796B: MyCTX_nopad::update(unsigned char const*, unsigned int, unsigned char*, unsigned int*) (my_crypt.cc:143)
==12768== by 0x14372ED: my_aes_crypt_update (my_crypt.cc:310)
==12768== by 0xF2CFDF1: ctx_update(void*, unsigned char const*, unsigned int, unsigned char*, unsigned int*) (example_key_management_plugin.cc:126)
==12768== by 0xADF5FA: encryption_crypt (service_encryption.h:119)
==12768== by 0xADFF2F: do_crypt(unsigned char const*, unsigned int, unsigned char*, unsigned int*, st_encryption_scheme*, unsigned int, unsigned int, unsigned int, unsigned long long, int) (encryption.cc:223)
==12768== by 0xADFFD1: encryption_scheme_decrypt (encryption.cc:244)
==12768== by 0x12CDC06: fil_space_decrypt_full_crc32(unsigned long, fil_space_crypt_t*, unsigned char*, unsigned char*, dberr_t*) (fil0crypt.cc:842)
==12768== by 0x12CE1A7: fil_space_decrypt(unsigned long, fil_space_crypt_t*, unsigned char*, unsigned long, unsigned long, unsigned char*, dberr_t*) (fil0crypt.cc:976)
==12768== by 0x12CE30D: fil_space_decrypt(fil_space_t const*, unsigned char*, unsigned char*, bool*) (fil0crypt.cc:1011)
==12768== by 0x122565E: buf_page_decrypt_after_read(buf_page_t*, fil_space_t*) (buf0buf.cc:555)
==12768== by 0x1236C14: buf_page_io_complete(buf_page_t*, bool, bool) (buf0buf.cc:6019)
==12768== by 0x1261339: buf_read_page_low(dberr_t*, bool, unsigned long, unsigned long, page_id_t, unsigned long, bool, bool) (buf0rea.cc:203)
==12768== by 0x1261AE3: buf_read_page(page_id_t, unsigned long) (buf0rea.cc:411)
==12768== Address 0x10324004 is 4 bytes after a block of size 16,384 alloc'd
==12768== at 0x4C30833: memalign (vg_replace_malloc.c:908)
==12768== by 0x4C30936: posix_memalign (vg_replace_malloc.c:1072)
==12768== by 0x123B9B2: aligned_malloc(unsigned long, unsigned long) (buf0buf.cc:130)
==12768== by 0x12250BD: buf_tmp_reserve_crypt_buf(buf_tmp_buffer_t*) (buf0buf.cc:441)
==12768== by 0x1225622: buf_page_decrypt_after_read(buf_page_t*, fil_space_t*) (buf0buf.cc:550)
==12768== by 0x1236C14: buf_page_io_complete(buf_page_t*, bool, bool) (buf0buf.cc:6019)
==12768== by 0x1261339: buf_read_page_low(dberr_t*, bool, unsigned long, unsigned long, page_id_t, unsigned long, bool, bool) (buf0rea.cc:203)
==12768== by 0x1261AE3: buf_read_page(page_id_t, unsigned long) (buf0rea.cc:411)
==12768== by 0x1231BA4: buf_page_get_gen(page_id_t, unsigned long, unsigned long, buf_block_t*, unsigned long, char const*, unsigned int, mtr_t*, dberr_t*) (buf0buf.cc:4380)
==12768== by 0x126825F: dict_hdr_get(mtr_t*) (dict0boot.cc:49)
==12768== by 0x1268936: dict_boot() (dict0boot.cc:276)
==12768== by 0x116D1E6: srv_start(bool) (srv0start.cc:1881)
==12768== by 0xF83B68: innodb_init(void*) (ha_innodb.cc:4127)
==12768== by 0xBA2FC4: ha_initialize_handlerton(st_plugin_int*) (handler.cc:550)
==12768== by 0x8A3030: plugin_initialize(st_mem_root*, st_plugin_int*, int*, char**, bool) (sql_plugin.cc:1437)
==12768== by 0x8A3C2C: plugin_init(int*, char**, int) (sql_plugin.cc:1719)
Attachments
Issue Links
- is part of
-
MDEV-20310 valgrind bugs found in 10.5
-
- Closed
-
- relates to
-
MDEV-20312 InnoDB encryption accesses memory outside of allocated block part 2
-
- Closed
-
-
MDEV-20377 Make WITH_MSAN more usable
-
- Closed
-
I can repeat this with MSAN (enabled as described in
MDEV-20377):10.5 da53fb6d7de906fd8bd73d5f244bac4d77b687aa
==11249==WARNING: MemorySanitizer: use-of-uninitialized-value
2019-08-19 13:15:46 0 [Note] Server socket created on IP: '127.0.0.1'.
2019-08-19 13:15:46 0 [Note] Reading of all Master_info entries succeeded
2019-08-19 13:15:46 0 [Note] Added new Master_info '' to hash table
2019-08-19 13:15:46 0 [Note] /dev/shm/10.5/sql/mysqld: ready for connections.
Version: '10.5.0-MariaDB-debug-log' socket: '/dev/shm/10.5/mysql-test/var/tmp/2/mysqld.1.sock' port: 16020 Source distribution
#0 0x33350be in fil_space_encrypt(fil_space_t const*, unsigned long, unsigned long, unsigned char*, unsigned char*) /mariadb/10.5/storage/innobase/fil/fil0crypt.cc:756:4
#1 0x30f35c6 in buf_page_encrypt(fil_space_t*, buf_page_t*, unsigned char*) /mariadb/10.5/storage/innobase/buf/buf0buf.cc:7547:10
#2 0x312f71d in buf_flush_write_block_low(buf_page_t*, buf_flush_t, bool) /mariadb/10.5/storage/innobase/buf/buf0flu.cc:1026:11
#3 0x312f71d in buf_flush_page(buf_pool_t*, buf_page_t*, buf_flush_t, bool) /mariadb/10.5/storage/innobase/buf/buf0flu.cc:1211
#4 0x3136b54 in buf_flush_try_neighbors(page_id_t, buf_flush_t, unsigned long, unsigned long) /mariadb/10.5/storage/innobase/buf/buf0flu.cc:1437:9
#5 0x3136b54 in buf_flush_page_and_try_neighbors(buf_page_t*, buf_flush_t, unsigned long, unsigned long*) /mariadb/10.5/storage/innobase/buf/buf0flu.cc:1511
#6 0x3139f7c in buf_do_flush_list_batch(buf_pool_t*, unsigned long, unsigned long) /mariadb/10.5/storage/innobase/buf/buf0flu.cc:1769:3
#7 0x3139f7c in buf_flush_batch(buf_pool_t*, buf_flush_t, unsigned long, unsigned long, flush_counters_t*) /mariadb/10.5/storage/innobase/buf/buf0flu.cc:1840
#8 0x3139f7c in buf_flush_do_batch(buf_pool_t*, buf_flush_t, unsigned long, unsigned long, flush_counters_t*) /mariadb/10.5/storage/innobase/buf/buf0flu.cc:1998
#9 0x313d030 in buf_flush_lists(unsigned long, unsigned long, unsigned long*) /mariadb/10.5/storage/innobase/buf/buf0flu.cc:2100:8
#10 0x33413ee in fil_crypt_flush_space(rotate_thread_t*) /mariadb/10.5/storage/innobase/fil/fil0crypt.cc:2179:14
#11 0x33413ee in fil_crypt_complete_rotate_space(rotate_thread_t*) /mariadb/10.5/storage/innobase/fil/fil0crypt.cc:2290
#12 0x333e598 in fil_crypt_thread /mariadb/10.5/storage/innobase/fil/fil0crypt.cc:2393:5
The error is reported for the following comparison:
(size - FIL_PAGE_FCRC32_CHECKSUM)));
We have size=16384 and FIL_PAGE_FCRC32_CHECKSUM=4. According to the following, the entire src is initialized, but tmp_mem is only partly initialized:
call (void)__msan_print_shadow(src,16384)
call (void)__msan_print_shadow(tmp_mem,16384)
Only the first 26 and last 12 bytes of tmp_mem are initialized.